Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Unified Diff: LayoutTests/http/tests/serviceworker/clients-matchall-ordering.html

Issue 1286123004: Ensure that Service Worker clients are always returned in MRU order (2) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/serviceworker/clients-matchall-ordering.html
diff --git a/LayoutTests/http/tests/serviceworker/clients-matchall.html b/LayoutTests/http/tests/serviceworker/clients-matchall-ordering.html
similarity index 55%
copy from LayoutTests/http/tests/serviceworker/clients-matchall.html
copy to LayoutTests/http/tests/serviceworker/clients-matchall-ordering.html
index b76e6482902d04fa7ad00ca38fcd8a808783d556..d1d84e02abddb362914a6a9e56a8424aa8d0e787 100644
--- a/LayoutTests/http/tests/serviceworker/clients-matchall.html
+++ b/LayoutTests/http/tests/serviceworker/clients-matchall-ordering.html
@@ -7,40 +7,42 @@
var scope = 'resources/blank.html?clients-matchAll';
var t = async_test('Test Clients.matchAll()');
var frame1, frame2;
+
t.step(function() {
service_worker_unregister_and_register(
t, 'resources/clients-matchall-worker.js', scope)
.then(function(registration) {
return wait_for_state(t, registration.installing, 'activated');
})
- .then(function() { return with_iframe(scope + '#1'); })
+ .then(function() { return with_popup(scope + '#1'); })
nhiroki 2015/08/17 06:58:45 Why don't you use iframe? (iframe is a window-clie
falken 2015/08/17 07:10:19 I too would prefer iframe if possible. Otherwise w
.then(function(f) {
frame1 = f;
f.focus();
- return with_iframe(scope + '#2');
+ return with_popup(scope + '#2');
})
.then(function(f) {
frame2 = f;
var channel = new MessageChannel();
- channel.port1.onmessage = t.step_func(onMessage);
- f.contentWindow.navigator.serviceWorker.controller.postMessage(
- {port:channel.port2}, [channel.port2]);
+ channel.port1.onmessage = t.step_func(
+ onMessage.bind(null, pageOrder));
+ frame1.navigator.serviceWorker.controller.postMessage(
+ {port:channel.port2, retainOriginalOrder:true}, [channel.port2]);
})
.catch(unreached_rejection(t));
});
-var expected = [
- /* visibilityState, focused, url, frameType */
- ['visible', true, new URL(scope + '#1', location).toString(), 'nested'],
- ['visible', false, new URL(scope + '#2', location).toString(), 'nested']
-];
+var pageOrder = [
falken 2015/08/17 07:10:19 our wpt tests use snake_case for variables and fun
+ new URL(scope + '#2', location).toString(),
+ new URL(scope + '#1', location).toString()
falken 2015/08/17 07:10:19 This test can be more discerning, now if the impl
+]
nhiroki 2015/08/17 06:58:45 nit: ';'
-function onMessage(e) {
- assert_equals(e.data.length, 2);
- assert_array_equals(e.data[0], expected[0]);
- assert_array_equals(e.data[1], expected[1]);
- frame1.remove();
- frame2.remove();
+function onMessage(expected, e) {
+ var urls = [];
+ for (var i = 0; i < e.data.length; i++)
+ urls[i] = e.data[i][2];
+ assert_array_equals(urls, expected);
+ frame1.close();
+ frame2.close();
service_worker_unregister_and_done(t, scope);
}
</script>

Powered by Google App Engine
This is Rietveld 408576698