Changeset 235570 in webkit
- Timestamp:
- Aug 31, 2018 2:48:18 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r235569 r235570 1 2018-08-31 Chris Dumez <cdumez@apple.com> 2 3 [ WK2 ] http/tests/workers/service/client-*-page-cache.html LayoutTests are flaky 4 https://bugs.webkit.org/show_bug.cgi?id=183705 5 <rdar://problem/42440606> 6 7 Reviewed by Youenn Fablet. 8 9 Update Layout tests to not rely on the total number of clients as this is flaky. Instead, check for specific client 10 identifiers to see if they are present or not. 11 12 * http/tests/workers/service/client-added-to-clients-when-restored-from-page-cache.html: 13 * http/tests/workers/service/client-removed-from-clients-while-in-page-cache.html: 14 * http/tests/workers/service/resources/getClientIds-worker.js: Renamed from LayoutTests/http/tests/workers/service/resources/getClientCount-worker.js. 15 (event.then): 16 * http/tests/workers/service/serviceworkerclients-matchAll-worker.js: 17 (async.doTestAfterMessage): 18 * http/tests/workers/service/serviceworkerclients-matchAll.https.html: 19 20 * platform/ios-wk2/TestExpectations: 21 * platform/mac-wk2/TestExpectations: 22 Unskip tests as they should no longer be flaky. 23 1 24 2018-08-31 John Wilander <wilander@apple.com> 2 25 -
trunk/LayoutTests/http/tests/workers/service/client-added-to-clients-when-restored-from-page-cache.html
r234061 r235570 14 14 let tries = 0; 15 15 16 let expectedClientIdentifiers = []; 17 18 function containsExpectedClients(clientIdentifiers) 19 { 20 for (let expectedIdentifier of expectedClientIdentifiers) { 21 if (!clientIdentifiers.includes(expectedIdentifier)) 22 return false; 23 } 24 return true; 25 } 26 16 27 navigator.serviceWorker.addEventListener("message", function(event) { 17 28 if (step == "BothClientsInitiallyActive") { 18 if ( event.data != 2) {29 if (!containsExpectedClients(event.data)) { 19 30 if (++tries > 20) { 20 log("FAIL: Wrong initial number of clients : " + event.data);31 log("FAIL: Wrong initial number of clients"); 21 32 finishSWTest(); 22 33 return; 23 34 } 24 worker.postMessage("getClient Count");35 worker.postMessage("getClientIds"); 25 36 return; 26 37 } … … 44 55 setTimeout(function() { 45 56 step = "SecondClientRestoredFromPageCache"; 46 worker.postMessage("getClient Count");57 worker.postMessage("getClientIds"); 47 58 }, 0); 48 59 }); … … 53 64 54 65 if (step == "SecondClientRestoredFromPageCache") { 55 if ( event.data != 2) {56 log("FAIL: Wrong number of clients after one client was restored from page cache : " + event.data);66 if (!containsExpectedClients(event.data)) { 67 log("FAIL: Wrong number of clients after one client was restored from page cache"); 57 68 finishSWTest(); 58 69 } … … 63 74 }); 64 75 65 navigator.serviceWorker.register("resources/getClientCount-worker.js", { }).then(function(registration) { 76 navigator.serviceWorker.register("resources/getClientIds-worker.js", { }).then(function(registration) { 77 expectedClientIdentifiers.push(internals.serviceWorkerClientIdentifier(document)); 78 66 79 worker = registration.installing; 67 80 otherWindow = open("other_resources/test.html"); 68 81 otherWindow.onload = function() { 82 expectedClientIdentifiers.push(internals.serviceWorkerClientIdentifier(otherWindow.document)); 69 83 step = "BothClientsInitiallyActive" 70 worker.postMessage("getClient Count");84 worker.postMessage("getClientIds"); 71 85 }; 72 86 }); -
trunk/LayoutTests/http/tests/workers/service/client-removed-from-clients-while-in-page-cache.html
r234061 r235570 12 12 } 13 13 14 let topClientIdentifier = null; 15 let windowClientIdentifier = null; 16 14 17 let tries = 0; 18 19 function containsBothClients(clientIdentifiers) 20 { 21 return clientIdentifiers.includes(topClientIdentifier) && clientIdentifiers.includes(windowClientIdentifier); 22 } 23 24 function containsOnlyTopClient(clientIdentifiers) 25 { 26 return clientIdentifiers.includes(topClientIdentifier) && !clientIdentifiers.includes(windowClientIdentifier); 27 } 15 28 16 29 navigator.serviceWorker.addEventListener("message", function(event) { 17 30 if (step == "BothClientsInitiallyActive") { 18 if ( event.data != 2) {31 if (!containsBothClients(event.data)) { 19 32 if (++tries > 20) { 20 log("FAIL: Wrong initial number of clients : " + event.data);33 log("FAIL: Wrong initial number of clients"); 21 34 finishSWTest(); 22 35 return; 23 36 } 24 worker.postMessage("getClient Count");37 worker.postMessage("getClientIds"); 25 38 return; 26 39 } … … 37 50 setTimeout(function() { 38 51 step = "OnlyOneClientRemainsActive" 39 worker.postMessage("getClient Count");52 worker.postMessage("getClientIds"); 40 53 }, 0); 41 54 }); … … 46 59 47 60 if (step == "OnlyOneClientRemainsActive") { 48 if ( event.data != 1) {49 log("FAIL: Wrong number of clients after one client entered page cache : " + event.data);61 if (!containsOnlyTopClient(event.data)) { 62 log("FAIL: Wrong number of clients after one client entered page cache"); 50 63 finishSWTest(); 51 64 } … … 56 69 }); 57 70 58 navigator.serviceWorker.register("resources/getClientCount-worker.js", { }).then(function(registration) { 71 navigator.serviceWorker.register("resources/getClientIds-worker.js", { }).then(function(registration) { 72 topClientIdentifier = internals.serviceWorkerClientIdentifier(document); 73 59 74 worker = registration.installing; 60 75 otherWindow = open("other_resources/test.html"); 61 76 otherWindow.onload = function() { 77 windowClientIdentifier = internals.serviceWorkerClientIdentifier(otherWindow.document); 62 78 step = "BothClientsInitiallyActive" 63 worker.postMessage("getClient Count");79 worker.postMessage("getClientIds"); 64 80 }; 65 81 }); -
trunk/LayoutTests/http/tests/workers/service/resources/getClientIds-worker.js
r235569 r235570 1 1 self.addEventListener("message", (event) => { 2 2 source = event.source; 3 clients.matchAll({ includeUncontrolled : true }).then(function(clientList) { 4 source.postMessage(clientList.length); 3 clients.matchAll({ includeUncontrolled : true }).then(function(clients) { 4 let ids = []; 5 for (let client of clients) 6 ids.push(client.id); 7 source.postMessage(ids); 5 8 }); 6 9 }); -
trunk/LayoutTests/http/tests/workers/service/serviceworkerclients-matchAll-worker.js
r234107 r235570 4 4 } 5 5 6 function matchAllPromise1()6 function checkClientNotInControlledClients(clientIdentifier) 7 7 { 8 8 return self.clients.matchAll().then((clients) => { 9 return clients.length === 0 ? "PASS" : "FAIL: expected no matched client, got " + clients.length; 9 for (let client of clients) { 10 if (client.id == clientIdentifier) 11 return "FAIL: Client should not have matched"; 12 } 13 return "PASS"; 10 14 }, (e) => { 11 return "FAIL: matchAll 1rejected with " + e;15 return "FAIL: First matchAll() request rejected with " + e; 12 16 }); 13 17 } 14 18 15 var matchedClients; 16 function matchAllPromise2() 19 function checkClientInUncontrolledClients(clientIdentifier) 17 20 { 18 return self.clients.matchAll({ includeUncontrolled : true }).then((c) => { 19 matchedClients = c; 20 return matchedClients.length === 1 ? "PASS" : "FAIL: expected one matched client, got " + matchedClients.length; 21 return self.clients.matchAll({ includeUncontrolled : true }).then((clients) => { 22 for (let client of clients) { 23 if (client.id == clientIdentifier) 24 return "PASS"; 25 } 26 return "FAIL: Client should have matched with includeUncontrolled set to true"; 21 27 }, (e) => { 22 return "FAIL: matchAll 2rejected with " + e;28 return "FAIL: Second matchAll() request rejected with " + e; 23 29 }); 24 30 } … … 27 33 { 28 34 try { 29 if (event.data !== "start") {35 if (event.data.test !== "checkClientIsUncontrolled") { 30 36 event.source.postMessage("FAIL: received unexpected message from client"); 37 return; 38 } 39 40 const clientIdentifier = event.data.identifier; 41 42 let result = await checkClientNotInControlledClients(clientIdentifier); 43 if (result !== "PASS") { 44 event.source.postMessage(result); 31 45 return; 32 46 } … … 36 50 if (tries) 37 51 await waitFor(50); 38 result = await matchAllPromise1();52 result = await checkClientInUncontrolledClients(clientIdentifier); 39 53 } while (result !== "PASS" && ++tries <= 200); 40 54 41 if (result !== "PASS") { 42 event.source.postMessage(result); 43 return; 44 } 45 46 tries = 0; 47 do { 48 if (tries) 49 await waitFor(50); 50 result = await matchAllPromise2(); 51 } while (result !== "PASS" && ++tries <= 200); 52 53 if (result !== "PASS") { 54 event.source.postMessage(result); 55 return; 56 } 57 event.source.postMessage("PASS"); 55 event.source.postMessage(result); 58 56 } catch (e) { 59 57 event.source.postMessage("FAIL: received exception " + e); -
trunk/LayoutTests/http/tests/workers/service/serviceworkerclients-matchAll.https.html
r225452 r235570 28 28 29 29 promise_test(async (test) => { 30 const serviceWorkerClientIdentifier = internals.serviceWorkerClientIdentifier(document); 30 31 var promise = new Promise((resolve, reject) => { 31 32 navigator.serviceWorker.addEventListener("message", test.step_func((event) => { … … 35 36 }); 36 37 37 activeWorker.postMessage( "start");38 activeWorker.postMessage({test: "checkClientIsUncontrolled", identifier: serviceWorkerClientIdentifier }); 38 39 await promise; 39 40 }, "Test self.clients.matchAll"); -
trunk/LayoutTests/platform/ios-wk2/TestExpectations
r235468 r235570 1278 1278 webkit.org/b/184783 compositing/ios/overflow-scroll-touch-tiles.html [ Pass Failure ] 1279 1279 1280 webkit.org/b/183705 http/tests/workers/service/client-added-to-clients-when-restored-from-page-cache.html [ Pass Failure ]1281 webkit.org/b/183705 http/tests/workers/service/client-removed-from-clients-while-in-page-cache.html [ Pass Failure ]1282 webkit.org/b/183705 http/tests/workers/service/serviceworkerclients-matchAll.https.html [ Pass Failure ]1283 1284 1280 webkit.org/b/179853 [ Debug ] imported/blink/fast/text/international-iteration-simple-text.html [ Pass Failure ] 1285 1281 -
trunk/LayoutTests/platform/mac-wk2/TestExpectations
r235569 r235570 832 832 webkit.org/b/186425 [ Debug ] inspector/console/webcore-logging.html [ Pass Failure ] 833 833 834 webkit.org/b/183705 http/tests/workers/service/client-added-to-clients-when-restored-from-page-cache.html [ Pass Failure ]835 webkit.org/b/183705 http/tests/workers/service/client-removed-from-clients-while-in-page-cache.html [ Pass Failure ]836 webkit.org/b/183705 http/tests/workers/service/serviceworkerclients-matchAll.https.html [ Pass Failure ]837 838 834 webkit.org/b/187658 http/tests/security/bypassing-cors-checks-for-extension-urls.html [ Pass Failure ] 839 835 -
trunk/Source/WebCore/ChangeLog
r235569 r235570 1 2018-08-31 Chris Dumez <cdumez@apple.com> 2 3 [ WK2 ] http/tests/workers/service/client-*-page-cache.html LayoutTests are flaky 4 https://bugs.webkit.org/show_bug.cgi?id=183705 5 <rdar://problem/42440606> 6 7 Reviewed by Youenn Fablet. 8 9 Add internals.serviceWorkerClientIdentifier() utility function so that a layout test can get the 10 service worker client identifier of a document. 11 12 * testing/Internals.cpp: 13 (WebCore::Internals::serviceWorkerClientIdentifier const): 14 * testing/Internals.h: 15 * testing/Internals.idl: 16 1 17 2018-08-31 John Wilander <wilander@apple.com> 2 18 -
trunk/Source/WebCore/testing/Internals.cpp
r235560 r235570 2329 2329 } 2330 2330 2331 String Internals::serviceWorkerClientIdentifier(const Document& document) const 2332 { 2333 #if ENABLE(SERVICE_WORKER) 2334 return ServiceWorkerClientIdentifier { ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(document.sessionID()).serverConnectionIdentifier(), document.identifier() }.toString(); 2335 #else 2336 UNUSED_PARAM(document); 2337 return String(); 2338 #endif 2339 } 2340 2331 2341 RefPtr<WindowProxy> Internals::openDummyInspectorFrontend(const String& url) 2332 2342 { -
trunk/Source/WebCore/testing/Internals.h
r235086 r235570 372 372 bool isDocumentAlive(uint64_t documentIdentifier) const; 373 373 374 String serviceWorkerClientIdentifier(const Document&) const; 375 374 376 RefPtr<WindowProxy> openDummyInspectorFrontend(const String& url); 375 377 void closeDummyInspectorFrontend(); -
trunk/Source/WebCore/testing/Internals.idl
r235086 r235570 625 625 boolean isDocumentAlive(unsigned long long documentIdentifier); 626 626 627 DOMString serviceWorkerClientIdentifier(Document document); 628 627 629 Promise<void> clearCacheStorageMemoryRepresentation(); 628 630 Promise<DOMString> cacheStorageEngineRepresentation();
Note: See TracChangeset
for help on using the changeset viewer.