Changeset 216805 in webkit


Ignore:
Timestamp:
May 12, 2017 5:31:47 PM (7 years ago)
Author:
beidson@apple.com
Message:

REGRESSION (r216711): API test WKWebView.ClearAppCache is failing.
https://bugs.webkit.org/show_bug.cgi?id=172030

Unreviewed - Test gardening

Try to resolve this once and for all by using the WebsiteDataStore API to nuke everything
before the test starts.

  • TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageClear.mm:

(defaultWebsiteCacheDirectory):
(defaultApplicationCacheDirectory):
(TEST):
(defaultWebsiteDataDirectory): Deleted.

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r216802 r216805  
     12017-05-12  Brady Eidson  <beidson@apple.com>
     2
     3        REGRESSION (r216711): API test WKWebView.ClearAppCache is failing.
     4        https://bugs.webkit.org/show_bug.cgi?id=172030
     5
     6        Unreviewed - Test gardening
     7
     8        Try to resolve this once and for all by using the WebsiteDataStore API to nuke everything
     9        before the test starts.
     10
     11        * TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageClear.mm:
     12        (defaultWebsiteCacheDirectory):
     13        (defaultApplicationCacheDirectory):
     14        (TEST):
     15        (defaultWebsiteDataDirectory): Deleted.
     16
    1172017-05-12  David Quesada  <david_quesada@apple.com>
    218
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageClear.mm

    r216800 r216805  
    108108}
    109109
    110 NSString *defaultWebsiteDataDirectory()
     110NSString *defaultWebsiteCacheDirectory()
    111111{
    112112#if PLATFORM(IOS)
     
    123123    return [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches/com.apple.WebAppCache"];
    124124#else
    125     return [defaultWebsiteDataDirectory() stringByAppendingString:@"/OfflineWebApplicationCache"];
     125    return [defaultWebsiteCacheDirectory() stringByAppendingString:@"/OfflineWebApplicationCache"];
    126126#endif
    127127}
     
    133133    TestWebKitAPI::InstanceMethodSwizzler swizzle([NSBundle class], @selector(bundleIdentifier), reinterpret_cast<IMP>(swizzledBundleIdentifierWebBookmarksD));
    134134#endif
     135
     136    // Start with a clean slate of WebsiteData.
     137    readyToContinue = false;
     138    [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^()
     139    {
     140        readyToContinue = true;
     141    }];
     142    TestWebKitAPI::Util::run(&readyToContinue);
     143
     144    // Start with a clean slate of Website caches.
     145    if (auto *websiteCacheDirectory = defaultWebsiteCacheDirectory()) {
     146        NSURL *websiteCacheURL = [NSURL fileURLWithPath:[websiteCacheDirectory stringByExpandingTildeInPath]];
     147        [[NSFileManager defaultManager] removeItemAtURL:websiteCacheURL error:nil];
     148    }
     149
    135150    NSURL *dbResourceURL = [[NSBundle mainBundle] URLForResource:@"ApplicationCache" withExtension:@"db" subdirectory:@"TestWebKitAPI.resources"];
    136151    NSURL *shmResourceURL = [[NSBundle mainBundle] URLForResource:@"ApplicationCache" withExtension:@"db-shm" subdirectory:@"TestWebKitAPI.resources"];
    137152    NSURL *walResourceURL = [[NSBundle mainBundle] URLForResource:@"ApplicationCache" withExtension:@"db-wal" subdirectory:@"TestWebKitAPI.resources"];
    138 
    139     // Clean up any website data files left from any previous test run.
    140     if (auto *websiteDataDirectory = defaultWebsiteDataDirectory()) {
    141         NSURL *websiteDataURL = [NSURL fileURLWithPath:[websiteDataDirectory stringByExpandingTildeInPath]];
    142         [[NSFileManager defaultManager] removeItemAtURL:websiteDataURL error:nil];
    143     }
    144153
    145154    NSURL *targetURL = [NSURL fileURLWithPath:[defaultApplicationCacheDirectory() stringByExpandingTildeInPath]];
Note: See TracChangeset for help on using the changeset viewer.