Commit b72e8903 authored by Matt Falkenhagen's avatar Matt Falkenhagen Committed by Commit Bot

service worker: Deflake fetch-event.https.html.

The test was using add_result_callback() which is triggered after a test
finishes. Unfortunately this file uses both async_test and promise_test.
promise_tests run sequentially but async_tests run in parallel. Therefore,
the add_result_callback was being called every time an async_test finished,
causing a race when this promise_test was in the middle of execution.

R=shimazu

Bug: 807014
Change-Id: Ic1bc568fe812f540feec901f95cc89684ef1cae2
Reviewed-on: https://chromium-review.googlesource.com/892553Reviewed-by: default avatarMakoto Shimazu <shimazu@chromium.org>
Commit-Queue: Matt Falkenhagen <falken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532758}
parent b46e0efc
......@@ -649,13 +649,9 @@ crbug.com/538697 [ Win ] printing/webgl-oversized-printing.html [ Failure Crash
# Found 2061 tests; running 2060, skipping 1.
# 2060 tests ran as expected (1968 passed, 92 didn't).
# The outofblink-cors version of fetch-event.https.html, below, is also timeout-flaky.
crbug.com/807014 external/wpt/service-workers/service-worker/fetch-event.https.html [ Pass Timeout ]
crbug.com/807014 virtual/service-worker-script-streaming/external/wpt/service-workers/service-worker/fetch-event.https.html [ Pass Timeout ]
# Crashing tests in dictionary order.
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-cors-xhr.https.html [ Failure Crash ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-event.https.html [ Crash Timeout ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-event.https.html [ Crash ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-event-network-error.https.html [ Crash ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-request-fallback.https.html [ Crash Failure ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-request-redirect.https.html [ Crash ]
......
......@@ -197,7 +197,7 @@ function submit_form(action_url) {
form.appendChild(input2);
document.body.appendChild(form);
frame.onload = function() {
document.body.removeChild(form);
form.remove();
resolve(frame);
};
form.submit();
......@@ -206,9 +206,11 @@ function submit_form(action_url) {
promise_test(t => {
const scope = 'resources/simple.html?form-post';
let registration;
return service_worker_unregister_and_register(t, worker, scope)
.then(reg => {
add_result_callback(() => { reg.unregister(); });
registration = reg;
add_completion_callback(() => { reg.unregister(); });
return wait_for_state(t, reg.installing, 'activated');
})
.then(() => {
......@@ -219,15 +221,18 @@ promise_test(t => {
'POST:application/x-www-form-urlencoded:' +
'testName1=testValue1&testName2=testValue2');
frame.remove();
return registration.unregister();
});
}, 'Service Worker responds to fetch event with POST form');
promise_test(t => {
// Add '?ignore' to scope so the service worker falls back to network.
const scope = 'resources/echo-content.py?ignore';
let registration;
return service_worker_unregister_and_register(t, worker, scope)
.then(reg => {
add_result_callback(() => { reg.unregister(); });
registration = reg;
add_completion_callback(() => { reg.unregister(); });
return wait_for_state(t, reg.installing, 'activated');
})
.then(() => {
......@@ -237,6 +242,7 @@ promise_test(t => {
assert_equals(frame.contentDocument.body.textContent,
'testName1=testValue1&testName2=testValue2');
frame.remove();
return registration.unregister();
});
}, 'Service Worker falls back to network in fetch event with POST form');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment