Activate the WebResourceLoadStatisticsStore in the NetworkProcess and deactivate...
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Jan 2019 22:21:38 +0000 (22:21 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Jan 2019 22:21:38 +0000 (22:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=193297
<rdar://problem/47158841>

Unreviewed test case fix.

These test cases require ResourceLoadStatistics to be active, so the feature must be turned on.
Previously, the default data store turned the feature on automatically, allowing these tests to pass.

* TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadStatistics.mm:
(TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240509 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadStatistics.mm

index bff132b..338a409 100644 (file)
@@ -1,3 +1,17 @@
+2019-01-25  Brent Fulgham  <bfulgham@apple.com>
+
+        Activate the WebResourceLoadStatisticsStore in the NetworkProcess and deactivate it in the UIProcess.
+        https://bugs.webkit.org/show_bug.cgi?id=193297
+        <rdar://problem/47158841>
+
+        Unreviewed test case fix.
+
+        These test cases require ResourceLoadStatistics to be active, so the feature must be turned on.
+        Previously, the default data store turned the feature on automatically, allowing these tests to pass.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadStatistics.mm:
+        (TEST):
+
 2019-01-25  Keith Rollin  <krollin@apple.com>
 
         Update existing .xcfilelists
index 59e5785..43852fa 100644 (file)
@@ -57,11 +57,7 @@ static bool finishedNavigation = false;
 
 TEST(ResourceLoadStatistics, GrandfatherCallback)
 {
-    // We need an active NetworkProcess to perform ResourceLoadStatistics operations.
-    auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
-
     auto *dataStore = [WKWebsiteDataStore defaultDataStore];
-    [dataStore _setResourceLoadStatisticsEnabled:NO];
 
     NSURL *statisticsDirectoryURL = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/WebsiteData/ResourceLoadStatistics" stringByExpandingTildeInPath] isDirectory:YES];
     NSURL *fileURL = [statisticsDirectoryURL URLByAppendingPathComponent:@"full_browsing_session_resourceLog.plist"];
@@ -77,6 +73,10 @@ TEST(ResourceLoadStatistics, GrandfatherCallback)
         grandfatheredFlag = true;
     }];
 
+    // We need an active NetworkProcess to perform ResourceLoadStatistics operations.
+    auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+    [dataStore _setResourceLoadStatisticsEnabled:YES];
+
     TestWebKitAPI::Util::run(&grandfatheredFlag);
 
     // Spin the runloop until the resource load statistics file has written to disk.
@@ -121,11 +121,7 @@ TEST(ResourceLoadStatistics, GrandfatherCallback)
 
 TEST(ResourceLoadStatistics, ShouldNotGrandfatherOnStartup)
 {
-    // We need an active NetworkProcess to perform ResourceLoadStatistics operations.
-    auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
-
     auto *dataStore = [WKWebsiteDataStore defaultDataStore];
-    [dataStore _setResourceLoadStatisticsEnabled:NO];
 
     NSURL *statisticsDirectoryURL = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/WebsiteData/ResourceLoadStatistics" stringByExpandingTildeInPath] isDirectory:YES];
     NSURL *targetURL = [statisticsDirectoryURL URLByAppendingPathComponent:@"full_browsing_session_resourceLog.plist"];
@@ -142,6 +138,10 @@ TEST(ResourceLoadStatistics, ShouldNotGrandfatherOnStartup)
         callbackFlag = true;
     }];
 
+    // We need an active NetworkProcess to perform ResourceLoadStatistics operations.
+    auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+    [dataStore _setResourceLoadStatisticsEnabled:YES];
+
     TestWebKitAPI::Util::run(&callbackFlag);
 }
 
@@ -152,11 +152,7 @@ TEST(ResourceLoadStatistics, ChildProcessesNotLaunched)
 
     EXPECT_EQ((size_t)0, [sharedProcessPool _pluginProcessCount]);
 
-    // We need an active NetworkProcess to perform ResourceLoadStatistics operations.
-    auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
-
     auto *dataStore = [WKWebsiteDataStore defaultDataStore];
-    [dataStore _setResourceLoadStatisticsEnabled:NO];
 
     NSURL *statisticsDirectoryURL = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/WebsiteData/ResourceLoadStatistics" stringByExpandingTildeInPath] isDirectory:YES];
     NSURL *targetURL = [statisticsDirectoryURL URLByAppendingPathComponent:@"full_browsing_session_resourceLog.plist"];
@@ -173,6 +169,10 @@ TEST(ResourceLoadStatistics, ChildProcessesNotLaunched)
         doneFlag = true;
     }];
 
+    // We need an active NetworkProcess to perform ResourceLoadStatistics operations.
+    auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+    [dataStore _setResourceLoadStatisticsEnabled:YES];
+
     TestWebKitAPI::Util::run(&doneFlag);
 
     EXPECT_TRUE([[NSFileManager defaultManager] fileExistsAtPath:targetURL.path]);