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

Side by Side Diff: LayoutTests/http/tests/serviceworker/current-on-load.html

Issue 301103003: Rename navigator.serviceWorker.current to controller. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Bring rebaselines to head. Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>Service Worker: Current on load</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.js"></script>
6 <body>
7 <script>
8 var t = async_test('current is set for a controlled document');
9 t.step(function() {
10 var url = 'resources/worker-no-op.js';
11 var scope = 'resources/blank.html';
12 service_worker_unregister_and_register(t, url, scope, onRegister);
13
14 function onRegister(worker) {
15 worker.addEventListener('statechange', t.step_func(function(event) {
16 if (event.target.state == 'active')
17 onActive();
18 }));
19 }
20
21 function onActive() {
22 with_iframe(scope, t.step_func(function(frame) {
23 var w = frame.contentWindow;
24 var current = w.navigator.serviceWorker.current;
25 assert_true(current instanceof w.ServiceWorker,
26 'current should be a ServiceWorker object');
27 assert_equals(current.scope, normalizeURL(scope));
28 assert_equals(current.url, normalizeURL(url));
29 service_worker_unregister_and_done(t, scope);
30 }));
31 }
32 });
33 </script>
34 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698