Bug 1528032 [wpt PR 15377] - WPT: service worker: Loosen postmessage-to-client-message-queue.https.html., a=testonly
authorMatt Falkenhagen <falken@chromium.org>
Tue, 05 Mar 2019 12:13:40 +0000
changeset 525431 b172a1750aecc02b5489415c7b78474918a5f236
parent 525430 9af6b8db40bd483d631ba7535aa16a3de3ae345f
child 525432 6e9781f5e50fcc01521827c5743aec051ffd6a3d
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1528032, 15377, 926670, 1469842, 632030
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1528032 [wpt PR 15377] - WPT: service worker: Loosen postmessage-to-client-message-queue.https.html., a=testonly Automatic update from web-platform-tests WPT: service worker: Loosen postmessage-to-client-message-queue.https.html. Chrome flakily failed the test because it doesn't guarantee the order between message and fetch event. That might violate the spec, but the test doesn't need to test this. It's meant to test that the client message queue isn't enabled until a certain time. We can test that without requiring message/fetch ordering. Loosen the test to just check that the messages arrive after |earliest_dispatch|. Bug: 926670 Change-Id: Ic291b25443358412936b4a5eeb24ee6f8efa6b71 Reviewed-on: https://chromium-review.googlesource.com/c/1469842 Auto-Submit: Matt Falkenhagen <falken@chromium.org> Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org> Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org> Cr-Commit-Position: refs/heads/master@{#632030} -- wpt-commits: cde22888c0ffdde9842d380d11e0f09aab38006e wpt-pr: 15377
testing/web-platform/tests/service-workers/service-worker/postmessage-to-client-message-queue.https.html
--- a/testing/web-platform/tests/service-workers/service-worker/postmessage-to-client-message-queue.https.html
+++ b/testing/web-platform/tests/service-workers/service-worker/postmessage-to-client-message-queue.https.html
@@ -136,42 +136,43 @@ function client_message_queue_test(url, 
 }
 
 function client_message_queue_enable_test(
     install_script,
     start_script,
     earliest_dispatch,
     description)
 {
-    function later_state(state1, state2) {
+    function assert_state_less_than_equal(state1, state2, explanation) {
         const states = ['init', 'install', 'start', 'finish', 'loaded'];
         const index1 = states.indexOf(state1);
         const index2 = states.indexOf(state2);
-        const max_index = Math.max(index1, index2);
-        return states[max_index];
+        if (index1 > index2)
+          assert_unreached(explanation);
     }
 
     client_message_queue_test('enable-client-message-queue.html', async t => {
         // While parsing the child's document, the child transitions
         // from the 'init' state all the way to the 'finish' state.
         // Once parsing is finished it would enter the final 'loaded'
         // state. All but the last transition require assitance from
         // the test.
         await t.state_transition('init', 'install', [install_script]);
         await t.state_transition('install', 'start', [start_script]);
         await t.state_transition('start', 'finish', []);
 
         // Wait for all messages to get dispatched on the child's
         // ServiceWorkerContainer and then verify that each message
-        // was dispatched while the child was in the correct state.
+        // was dispatched after |earliest_dispatch|.
         const report = await t.frame.report;
         ['init', 'install', 'start'].forEach(state => {
-            const dispatch = later_state(state, earliest_dispatch);
-            assert_equals(report[state], dispatch,
-                          `Message sent in state '${state}' dispatched in state '${dispatch}'`);
+            const explanation = `Message sent in state '${state}' was dispatched in '${report[state]}', should be dispatched no earlier than '${earliest_dispatch}'`;
+            assert_state_less_than_equal(earliest_dispatch,
+                                         report[state],
+                                         explanation);
         });
     }, description);
 }
 
 const empty_script = ``;
 
 const add_event_listener =
     `navigator.serviceWorker.addEventListener('message', handle_message);`;