Bug 1526831 [wpt PR 15295] - [Background Fetch] Fix flaky WP test that's timing out., a=testonly
authorRayan Kanso <rayankans@chromium.org>
Tue, 19 Feb 2019 11:46:15 +0000
changeset 461367 ada5ae17588cc11e5e5412b764c64c90d8979f0e
parent 461366 b13a4ab436c985eadf849abf5af7ee567b17ab4e
child 461368 811e9501d554977a9e90f8c96ff0095ab48a5e1c
push id35428
push userksteuber@mozilla.com
push dateThu, 28 Feb 2019 21:05:31 +0000
reviewerstestonly
bugs1526831, 15295, 929929, 1460924, 630316
milestone67.0a1
Bug 1526831 [wpt PR 15295] - [Background Fetch] Fix flaky WP test that's timing out., a=testonly Automatic update from web-platform-tests [Background Fetch] Fix flaky WP test that's timing out. Due to the scheduler handling multiple requests, there is an issue where the in-progress processed bytes are being overwritten. This CL fixes the test by not relying on that value. The underlying issue will be fixed in a follow-up CL. Bug: 929929 Change-Id: I48a1d7bb3899c441cdbf8dd2c13623204c1b9213 Reviewed-on: https://chromium-review.googlesource.com/c/1460924 Reviewed-by: Mugdha Lakhani <nator@google.com> Commit-Queue: Rayan Kanso <rayankans@chromium.org> Cr-Commit-Position: refs/heads/master@{#630316} -- wpt-commits: 7451c0c0cf527c8a91e56e539fad31f50356d494 wpt-pr: 15295
testing/web-platform/tests/background-fetch/fetch.https.window.js
--- a/testing/web-platform/tests/background-fetch/fetch.https.window.js
+++ b/testing/web-platform/tests/background-fetch/fetch.https.window.js
@@ -342,27 +342,14 @@ backgroundFetchTest(async (test, backgro
   assert_equals(eventRegistration.downloaded, 0);
 }, 'Responses failing CORS checks are not leaked');
 
 backgroundFetchTest(async (test, backgroundFetch) => {
   const registration = await backgroundFetch.fetch(
     uniqueId(), ['resources/feature-name.txt', '/common/slow.py']);
 
   const record = await registration.match('resources/feature-name.txt');
-
-  await new Promise(resolve => {
-    const expectedResultText = 'Background Fetch';
-
-    registration.onprogress = async event => {
-      if (event.target.downloaded < expectedResultText.length)
-        return;
-
-      const response = await record.responseReady;
-
-      assert_true(response.url.includes('resources/feature-name.txt'));
-      const completedResponseText = await response.text();
-      assert_equals(completedResponseText, expectedResultText);
-
-      resolve();
-    };
-  });
+  const response = await record.responseReady;
+  assert_true(response.url.includes('resources/feature-name.txt'));
+  const completedResponseText = await response.text();
+  assert_equals(completedResponseText, 'Background Fetch');
 
 }, 'Access to active fetches is supported.');