Commit 933489bc authored by arthursonzogni's avatar arthursonzogni Committed by Commit Bot

Service worker: Update usecounter.html test.

This test is flaky with the ServiceWorker servicification
More details in https://crbug.com/808964.

The previous test was checking the UseCounter immediatly after a new
window loads. It is racy because the UseCounter state is sent in
ServiceWorkerProviderHost::SendSetControllerServiceWorker(). In the case
of a very slow browser process, it can happens after the new window
loads.

Instead of checking the UseCounter state after a window loads, it uses
an observer to wait until its state is updated.

Bug: 808964
Change-Id: I53c2bf2775a837a3a4b0c6cf9b196f26fe7b7f5e
Reviewed-on: https://chromium-review.googlesource.com/901610Reviewed-by: default avatarMatt Falkenhagen <falken@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534667}
parent bdaadea6
......@@ -87,9 +87,14 @@ promise_test(t => {
return openWindow(kScope);
})
.then(win => {
assert_true(isUseCounted(win, kFeature));
assert_true(isUseCounted(win, kDeprecatedFeature));
});
// Check UseCounters have been sent to the new window. Since this is can
// happen after the new window's document load, an observer is used to
// wait until it happens.
return Promise.all([
observeUseCounter(win, kFeature),
observeUseCounter(win, kDeprecatedFeature)
]);
})
}, 'UseCounter on ServiceWorkerGlobalScope');
promise_test(t => {
......
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