REGRESSION(r244162) Clearing website data from ephemeral WKWebsiteDataStore should...
[WebKit-https.git] / Tools / TestWebKitAPI / Tests / WebKitCocoa / WKWebsiteDatastore.mm
index 3c3b8a2..183233a 100644 (file)
@@ -27,6 +27,7 @@
 
 #import "PlatformUtilities.h"
 #import "Test.h"
+#import "TestWKWebView.h"
 #import <WebKit/WKWebsiteDataStorePrivate.h>
 #import <WebKit/WebKit.h>
 #import <wtf/text/WTFString.h>
@@ -48,3 +49,16 @@ TEST(WKWebsiteDataStore, RemoveAndFetchData)
     }];
     TestWebKitAPI::Util::run(&readyToContinue);
 }
+
+TEST(WKWebsiteDataStore, RemoveEphemeralData)
+{
+    auto configuration = adoptNS([WKWebViewConfiguration new]);
+    [configuration setWebsiteDataStore:[WKWebsiteDataStore nonPersistentDataStore]];
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+    [webView synchronouslyLoadTestPageNamed:@"simple"];
+    __block bool done = false;
+    [[configuration websiteDataStore] removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler: ^{
+        done = true;
+    }];
+    TestWebKitAPI::Util::run(&done);
+}