Title: [250613] trunk/Tools
Revision
250613
Author
[email protected]
Date
2019-10-02 10:31:08 -0700 (Wed, 02 Oct 2019)

Log Message

Add a test to check the case of launching two service worker processes shortly one after the other
https://bugs.webkit.org/show_bug.cgi?id=202450

Reviewed by Chris Dumez.

* TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (250612 => 250613)


--- trunk/Tools/ChangeLog	2019-10-02 17:23:57 UTC (rev 250612)
+++ trunk/Tools/ChangeLog	2019-10-02 17:31:08 UTC (rev 250613)
@@ -1,3 +1,12 @@
+2019-10-02  youenn fablet  <[email protected]>
+
+        Add a test to check the case of launching two service worker processes shortly one after the other
+        https://bugs.webkit.org/show_bug.cgi?id=202450
+
+        Reviewed by Chris Dumez.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:
+
 2019-10-02  Aakash Jain  <[email protected]>
 
         [ews] Dedicate a bot for macOS-High-Sierra-Debug-Build-EWS queue

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm (250612 => 250613)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm	2019-10-02 17:23:57 UTC (rev 250612)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm	2019-10-02 17:31:08 UTC (rev 250613)
@@ -1787,6 +1787,44 @@
     EXPECT_EQ(0U, processPool._serviceWorkerProcessCount);
 }
 
+TEST(ServiceWorkers, ParallelProcessLaunch)
+{
+    [WKWebsiteDataStore _allowWebsiteDataRecordsForAllOrigins];
+
+    // Start with a clean slate data store
+    [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^() {
+        done = true;
+    }];
+    TestWebKitAPI::Util::run(&done);
+    done = false;
+
+    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+
+    auto messageHandler = adoptNS([[SWMessageHandler alloc] init]);
+    [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"sw"];
+
+    auto handler1 = adoptNS([[SWSchemes alloc] init]);
+    handler1->resources.set("sw1://host/main.html", ResourceInfo { @"text/html", mainBytes });
+    handler1->resources.set("sw1://host/sw.js", ResourceInfo { @"application/_javascript_", scriptBytes });
+    handler1->resources.set("sw1://host2/main.html", ResourceInfo { @"text/html", mainBytes });
+    handler1->resources.set("sw1://host2/sw.js", ResourceInfo { @"application/_javascript_", scriptBytes });
+    [configuration setURLSchemeHandler:handler1.get() forURLScheme:@"sw1"];
+
+    auto *processPool = configuration.get().processPool;
+    [processPool _registerURLSchemeServiceWorkersCanHandle:@"sw1"];
+
+    auto webView1 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+    NSURLRequest *request1 = [NSURLRequest requestWithURL:[NSURL URLWithString:@"sw1://host/main.html"]];
+
+    auto webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+    NSURLRequest *request2 = [NSURLRequest requestWithURL:[NSURL URLWithString:@"sw1://host2/main.html"]];
+
+    [webView1 loadRequest:request1];
+    [webView2 loadRequest:request2];
+
+    waitUntilServiceWorkerProcessCount(processPool, 2);
+}
+
 TEST(ServiceWorkers, ThrottleCrash)
 {
     ASSERT(mainBytes);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to