Title: [250156] trunk/Tools
Revision
250156
Author
achristen...@apple.com
Date
2019-09-20 14:45:53 -0700 (Fri, 20 Sep 2019)

Log Message

Begin moving WebsiteDataStore setters to WebsiteDataStoreConfiguration
https://bugs.webkit.org/show_bug.cgi?id=202025

Reviewed by Chris Dumez.

One expected change in behavior is that the resource load statistics directory is not created on startup with an ephemeral session any more
because we call the constructor of WebsiteDataStoreConfiguration inside _WKWebsiteDataStoreConfiguration and set the default directory like we do the other directories.

* TestWebKitAPI/Tests/WebKitCocoa/StorageQuota.mm:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::websiteDataStore):
(WTR::TestController::generatePageConfiguration):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (250155 => 250156)


--- trunk/Tools/ChangeLog	2019-09-20 21:40:23 UTC (rev 250155)
+++ trunk/Tools/ChangeLog	2019-09-20 21:45:53 UTC (rev 250156)
@@ -1,3 +1,18 @@
+2019-09-20  Alex Christensen  <achristen...@webkit.org>
+
+        Begin moving WebsiteDataStore setters to WebsiteDataStoreConfiguration
+        https://bugs.webkit.org/show_bug.cgi?id=202025
+
+        Reviewed by Chris Dumez.
+
+        One expected change in behavior is that the resource load statistics directory is not created on startup with an ephemeral session any more
+        because we call the constructor of WebsiteDataStoreConfiguration inside _WKWebsiteDataStoreConfiguration and set the default directory like we do the other directories.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/StorageQuota.mm:
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::websiteDataStore):
+        (WTR::TestController::generatePageConfiguration):
+
 2019-09-20  Keith Rollin  <krol...@apple.com>
 
         Remove some support for < iOS 13

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/StorageQuota.mm (250155 => 250156)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/StorageQuota.mm	2019-09-20 21:40:23 UTC (rev 250155)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/StorageQuota.mm	2019-09-20 21:45:53 UTC (rev 250156)
@@ -225,15 +225,17 @@
 TEST(WebKit, QuotaDelegate)
 {
     done = false;
-    [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^() {
+    _WKWebsiteDataStoreConfiguration *storeConfiguration = [[[_WKWebsiteDataStoreConfiguration alloc] init] autorelease];
+    storeConfiguration.perOriginStorageQuota = 1024 * 400;
+    WKWebsiteDataStore *dataStore = [[[WKWebsiteDataStore alloc] _initWithConfiguration:storeConfiguration] autorelease];
+    [dataStore removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^() {
         done = true;
     }];
     TestWebKitAPI::Util::run(&done);
 
     auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+    [configuration setWebsiteDataStore:dataStore];
 
-    [[configuration websiteDataStore] _setPerOriginStorageQuota: 1024 * 400];
-    
     auto messageHandler = adoptNS([[QuotaMessageHandler alloc] init]);
     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"qt"];
 
@@ -286,15 +288,17 @@
 TEST(WebKit, QuotaDelegateReload)
 {
     done = false;
-    [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^() {
+    _WKWebsiteDataStoreConfiguration *storeConfiguration = [[[_WKWebsiteDataStoreConfiguration alloc] init] autorelease];
+    storeConfiguration.perOriginStorageQuota = 1024 * 400;
+    WKWebsiteDataStore *dataStore = [[[WKWebsiteDataStore alloc] _initWithConfiguration:storeConfiguration] autorelease];
+    [dataStore removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^() {
         done = true;
     }];
     TestWebKitAPI::Util::run(&done);
     
     auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+    [configuration setWebsiteDataStore:dataStore];
     
-    [[configuration websiteDataStore] _setPerOriginStorageQuota: 1024 * 400];
-    
     auto messageHandler = adoptNS([[QuotaMessageHandler alloc] init]);
     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"qt"];
     
@@ -332,15 +336,17 @@
 TEST(WebKit, QuotaDelegateNavigateFragment)
 {
     done = false;
-    [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^() {
+    _WKWebsiteDataStoreConfiguration *storeConfiguration = [[[_WKWebsiteDataStoreConfiguration alloc] init] autorelease];
+    storeConfiguration.perOriginStorageQuota = 1024 * 400;
+    WKWebsiteDataStore *dataStore = [[[WKWebsiteDataStore alloc] _initWithConfiguration:storeConfiguration] autorelease];
+    [dataStore removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^() {
         done = true;
     }];
     TestWebKitAPI::Util::run(&done);
 
     auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+    [configuration setWebsiteDataStore:dataStore];
 
-    [[configuration websiteDataStore] _setPerOriginStorageQuota: 1024 * 400];
-
     auto messageHandler = adoptNS([[QuotaMessageHandler alloc] init]);
     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"qt"];
 

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm (250155 => 250156)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm	2019-09-20 21:40:23 UTC (rev 250155)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm	2019-09-20 21:45:53 UTC (rev 250156)
@@ -406,8 +406,7 @@
     configuration.get().websiteDataStore = [WKWebsiteDataStore nonPersistentDataStore];
     [configuration.get().websiteDataStore _setResourceLoadStatisticsEnabled:YES];
 
-    // We expect the directory to be created by starting up the data store machinery, but not the data file.
-    EXPECT_TRUE([[NSFileManager defaultManager] fileExistsAtPath:defaultResourceLoadStatisticsPath.path]);
+    EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:defaultResourceLoadStatisticsPath.path]);
 
     NSURL *defaultResourceLoadStatisticsFilePath = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/WebsiteData/ResourceLoadStatistics/full_browsing_session_resourceLog.plist" stringByExpandingTildeInPath] isDirectory:NO];
     EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:defaultResourceLoadStatisticsFilePath.path]);
@@ -450,8 +449,7 @@
     configuration.get().websiteDataStore = [[[WKWebsiteDataStore alloc] _initWithConfiguration:dataStoreConfiguration.get()] autorelease];
     [configuration.get().websiteDataStore _setResourceLoadStatisticsEnabled:YES];
 
-    // We expect the directory to be created by starting up the data store machinery, but not the data file.
-    EXPECT_TRUE([[NSFileManager defaultManager] fileExistsAtPath:defaultResourceLoadStatisticsPath.path]);
+    EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:defaultResourceLoadStatisticsPath.path]);
 
     NSURL *defaultResourceLoadStatisticsFilePath = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/WebsiteData/ResourceLoadStatistics/full_browsing_session_resourceLog.plist" stringByExpandingTildeInPath] isDirectory:NO];
     EXPECT_FALSE([[NSFileManager defaultManager] fileExistsAtPath:defaultResourceLoadStatisticsFilePath.path]);

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (250155 => 250156)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2019-09-20 21:40:23 UTC (rev 250155)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2019-09-20 21:45:53 UTC (rev 250156)
@@ -523,6 +523,7 @@
             WKWebsiteDataStoreConfigurationSetWebSQLDatabaseDirectory(configuration.get(), toWK(temporaryFolder + pathSeparator + "Databases" + pathSeparator + "WebSQL").get());
             WKWebsiteDataStoreConfigurationSetMediaKeysStorageDirectory(configuration.get(), toWK(temporaryFolder + pathSeparator + "MediaKeys").get());
             WKWebsiteDataStoreConfigurationSetResourceLoadStatisticsDirectory(configuration.get(), toWK(temporaryFolder + pathSeparator + "ResourceLoadStatistics").get());
+            WKWebsiteDataStoreConfigurationSetPerOriginStorageQuota(configuration.get(), 400 * 1024);
         }
         dataStore = WKWebsiteDataStoreCreateWithConfiguration(configuration.get());
     }
@@ -551,8 +552,6 @@
         WKContextUseTestingNetworkSession(m_context.get());
         WKContextSetCacheModel(m_context.get(), kWKCacheModelDocumentBrowser);
 
-        WKWebsiteDataStoreSetPerOriginStorageQuota(TestController::websiteDataStore(), 400 * 1024);
-
         platformInitializeContext();
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to