Bug 208260 - TestWebKitAPI and WebKitTestRunner should have bundle identifiers
Summary: TestWebKitAPI and WebKitTestRunner should have bundle identifiers
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kate Cheney
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-02-26 13:55 PST by Kate Cheney
Modified: 2020-02-27 19:43 PST (History)
5 users (show)

See Also:


Attachments
Patch (7.43 KB, patch)
2020-02-26 14:10 PST, Kate Cheney
no flags Details | Formatted Diff | Diff
Patch for landing (8.40 KB, patch)
2020-02-26 14:58 PST, Kate Cheney
no flags Details | Formatted Diff | Diff
Patch (39.89 KB, patch)
2020-02-27 08:03 PST, Kate Cheney
no flags Details | Formatted Diff | Diff
Patch (40.86 KB, patch)
2020-02-27 14:00 PST, Kate Cheney
no flags Details | Formatted Diff | Diff
Patch (41.58 KB, patch)
2020-02-27 14:27 PST, Kate Cheney
no flags Details | Formatted Diff | Diff
Patch (41.53 KB, patch)
2020-02-27 15:37 PST, Kate Cheney
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kate Cheney 2020-02-26 13:55:22 PST
This is useful for testing layout and api cases where a bundle identifier is needed, so we don't have to manually set it each time.
Comment 1 Radar WebKit Bug Importer 2020-02-26 13:55:57 PST
<rdar://problem/59820107>
Comment 2 Kate Cheney 2020-02-26 14:10:42 PST
Created attachment 391779 [details]
Patch
Comment 3 Tim Horton 2020-02-26 14:14:23 PST
Comment on attachment 391779 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=391779&action=review

> Tools/TestWebKitAPI/Configurations/TestWebKitAPI.xcconfig:27
> +PRODUCT_BUNDLE_IDENTIFIER = com.apple.TestWebKitAPI;

I wonder if these should be com.apple.WebKit.* like the subprocesses are

> Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:5333
> +				CREATE_INFOPLIST_SECTION_IN_BINARY = YES;
> +				INFOPLIST_FILE = "$(SRCROOT)/Info.plist";

You should move these two lines to the xcconfig, not here.

> Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:5342
> +				CREATE_INFOPLIST_SECTION_IN_BINARY = YES;
> +				INFOPLIST_FILE = "$(SRCROOT)/Info.plist";

Ditto

> Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:1291
> +				CREATE_INFOPLIST_SECTION_IN_BINARY = YES;
> +				INFOPLIST_FILE = "$(SRCROOT)/Info.plist";

Ditto etc etc etc
Comment 4 Kate Cheney 2020-02-26 14:58:28 PST
Created attachment 391784 [details]
Patch for landing
Comment 5 Kate Cheney 2020-02-26 14:59:16 PST
(In reply to Tim Horton from comment #3)
> Comment on attachment 391779 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=391779&action=review
> 
> > Tools/TestWebKitAPI/Configurations/TestWebKitAPI.xcconfig:27
> > +PRODUCT_BUNDLE_IDENTIFIER = com.apple.TestWebKitAPI;
> 
> I wonder if these should be com.apple.WebKit.* like the subprocesses are
> 

Good call.

> > Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:5333
> > +				CREATE_INFOPLIST_SECTION_IN_BINARY = YES;
> > +				INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
> 
> You should move these two lines to the xcconfig, not here.
> 
> > Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:5342
> > +				CREATE_INFOPLIST_SECTION_IN_BINARY = YES;
> > +				INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
> 
> Ditto
> 
> > Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:1291
> > +				CREATE_INFOPLIST_SECTION_IN_BINARY = YES;
> > +				INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
> 
> Ditto etc etc etc


Done! Thanks Tim.
Comment 6 WebKit Commit Bot 2020-02-26 15:30:54 PST
Comment on attachment 391784 [details]
Patch for landing

Clearing flags on attachment: 391784

Committed r257522: <https://trac.webkit.org/changeset/257522>
Comment 7 WebKit Commit Bot 2020-02-26 15:30:55 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Ryan Haddad 2020-02-26 17:37:16 PST
This change caused 16 API test failures on the bots:
https://build.webkit.org/builders/Apple-Catalina-Release-WK2-Tests/builds/3268

Please let API test EWS bots complete before re-landing.
Comment 9 Ryan Haddad 2020-02-26 17:38:17 PST
Reverted r257522 for reason:

Caused 16 API test failures on the bots

Committed r257540: <https://trac.webkit.org/changeset/257540>
Comment 10 Kate Cheney 2020-02-27 08:03:05 PST
Created attachment 391872 [details]
Patch
Comment 11 Kate Cheney 2020-02-27 08:08:51 PST
Letting EWS run. 

Adding a bundle ID changes the file path for TestWebKitAPI website data, so this patch updates the expectations for tests which need to know it. There should probably be a central place where tests can construct the default path the same way the default WebsiteDataStore does instead of hardcoding it each time. That would avoid test failures like these if the default path changes in the future.
Comment 12 Jonathan Bedard 2020-02-27 08:14:21 PST
(In reply to katherine_cheney from comment #11)
> Letting EWS run. 
> 
> Adding a bundle ID changes the file path for TestWebKitAPI website data, so
> this patch updates the expectations for tests which need to know it. There
> should probably be a central place where tests can construct the default
> path the same way the default WebsiteDataStore does instead of hardcoding it
> each time. That would avoid test failures like these if the default path
> changes in the future.

We should be careful about this. That 'central place' needs to be in testing code, not WebKit, because we have had bugs where we used the wrong default data store, and we want API tests to catch that sort of thing.
Comment 13 Kate Cheney 2020-02-27 14:00:52 PST
Created attachment 391911 [details]
Patch
Comment 14 Kate Cheney 2020-02-27 14:27:28 PST
Created attachment 391918 [details]
Patch
Comment 15 Tim Horton 2020-02-27 15:13:50 PST
Comment on attachment 391918 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=391918&action=review

> Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm:456
> +    NSURL *defaultResourceLoadStatisticsFilePath = [NSURL fileURLWithPath:[@"~/Library/WebKit/com.apple.WebKit.TestWebKitAPI/WebsiteData/ResourceLoadStatistics/full_browsing_session_resourceLog.plist" stringByExpandingTildeInPath] isDirectory:NO];

I wonder if we should have a helper for "give me a path inside TWKAPI's library dir"

> Tools/TestWebKitAPI/Tests/mac/SetAndUpdateCacheModel.mm:49
> +static void resetTestState()
> +{
> +    WebPreferences *standardPreferences = [WebPreferences standardPreferences];
> +    [standardPreferences setCacheModel:WebCacheModelDocumentViewer];
> +}
> +
>  TEST(WebKitLegacy, SetAndUpdateCacheModelInitialModel)
>  {
> +    resetTestState();
> +
>      EXPECT_EQ((int)WebCacheModelDocumentViewer, (int)[WebView _cacheModel]);
>  

I think the point of this test is to test the default value, so it's wrong to set it to something beforehand.

Can you instead /delete/ the default, so we fall back to the default-default?
Comment 16 Tim Horton 2020-02-27 15:19:15 PST
(In reply to Tim Horton from comment #15)
> Comment on attachment 391918 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=391918&action=review
> 
> > Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm:456
> > +    NSURL *defaultResourceLoadStatisticsFilePath = [NSURL fileURLWithPath:[@"~/Library/WebKit/com.apple.WebKit.TestWebKitAPI/WebsiteData/ResourceLoadStatistics/full_browsing_session_resourceLog.plist" stringByExpandingTildeInPath] isDirectory:NO];
> 
> I wonder if we should have a helper for "give me a path inside TWKAPI's
> library dir"

... oh, you already said that
Comment 17 Kate Cheney 2020-02-27 15:35:43 PST
(In reply to Tim Horton from comment #15)
> Comment on attachment 391918 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=391918&action=review
> 
> > Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm:456
> > +    NSURL *defaultResourceLoadStatisticsFilePath = [NSURL fileURLWithPath:[@"~/Library/WebKit/com.apple.WebKit.TestWebKitAPI/WebsiteData/ResourceLoadStatistics/full_browsing_session_resourceLog.plist" stringByExpandingTildeInPath] isDirectory:NO];
> 
> I wonder if we should have a helper for "give me a path inside TWKAPI's
> library dir"
> 
> > Tools/TestWebKitAPI/Tests/mac/SetAndUpdateCacheModel.mm:49
> > +static void resetTestState()
> > +{
> > +    WebPreferences *standardPreferences = [WebPreferences standardPreferences];
> > +    [standardPreferences setCacheModel:WebCacheModelDocumentViewer];
> > +}
> > +
> >  TEST(WebKitLegacy, SetAndUpdateCacheModelInitialModel)
> >  {
> > +    resetTestState();
> > +
> >      EXPECT_EQ((int)WebCacheModelDocumentViewer, (int)[WebView _cacheModel]);
> >  
> 
> I think the point of this test is to test the default value, so it's wrong
> to set it to something beforehand.
> 
> Can you instead /delete/ the default, so we fall back to the default-default?

Yes. Very good idea.
Comment 18 Kate Cheney 2020-02-27 15:37:35 PST
Created attachment 391933 [details]
Patch
Comment 19 WebKit Commit Bot 2020-02-27 19:43:25 PST
Comment on attachment 391933 [details]
Patch

Clearing flags on attachment: 391933

Committed r257614: <https://trac.webkit.org/changeset/257614>
Comment 20 WebKit Commit Bot 2020-02-27 19:43:27 PST
All reviewed patches have been landed.  Closing bug.