[ios-simulator] API test WKWebView.ClearAppCache is failing.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 May 2017 19:34:28 +0000 (19:34 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 May 2017 19:34:28 +0000 (19:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=172120

Unreviewed test gardening.

* TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageClear.mm:
(TEST): ios-sim needs explicit deleting of the app cache paths that I'd removed in 216805.
  Restoring that code fixes this.

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

Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageClear.mm

index c6d1666..f7b0bc1 100644 (file)
@@ -1,3 +1,14 @@
+2017-05-15  Brady Eidson  <beidson@apple.com>
+
+        [ios-simulator] API test WKWebView.ClearAppCache is failing.
+        https://bugs.webkit.org/show_bug.cgi?id=172120
+
+        Unreviewed test gardening.
+
+        * TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageClear.mm:
+        (TEST): ios-sim needs explicit deleting of the app cache paths that I'd removed in 216805.
+          Restoring that code fixes this.
+
 2017-05-15  Timothy Horton  <timothy_horton@apple.com>
 
         Null deref under WebContentReader::readURL when interacting with a file URL
index 258e0e7..a0b6d14 100644 (file)
@@ -135,8 +135,7 @@ TEST(WKWebView, ClearAppCache)
 
     // Start with a clean slate of WebsiteData.
     readyToContinue = false;
-    [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^()
-    {
+    [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^() {
         readyToContinue = true;
     }];
     TestWebKitAPI::Util::run(&readyToContinue);
@@ -147,6 +146,11 @@ TEST(WKWebView, ClearAppCache)
         [[NSFileManager defaultManager] removeItemAtURL:websiteCacheURL error:nil];
     }
 
+    if (auto *appCacheDirectory = defaultApplicationCacheDirectory()) {
+        NSURL *appCacheURL = [NSURL fileURLWithPath:[appCacheDirectory stringByExpandingTildeInPath]];
+        [[NSFileManager defaultManager] removeItemAtURL:appCacheURL error:nil];
+    }
+
     NSURL *dbResourceURL = [[NSBundle mainBundle] URLForResource:@"ApplicationCache" withExtension:@"db" subdirectory:@"TestWebKitAPI.resources"];
     NSURL *shmResourceURL = [[NSBundle mainBundle] URLForResource:@"ApplicationCache" withExtension:@"db-shm" subdirectory:@"TestWebKitAPI.resources"];
     NSURL *walResourceURL = [[NSBundle mainBundle] URLForResource:@"ApplicationCache" withExtension:@"db-wal" subdirectory:@"TestWebKitAPI.resources"];