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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/windowclient-navigate.html

Issue 1387303002: Yaho Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/windowclient-navigate-worker.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>Service Worker: WindowClient.navigate() tests</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="../resources/get-host-info.js"></script>
6 <script src="resources/test-helpers.js"></script>
7 <script>
8
9 var scope = 'resources/blank.html?windowclient-navigate';
10 var client_frame;
11 var message_frame;
12 var test;
13
14 var current_index = 0;
15 var test_list = [
16 { url : 'blank.html' },
17 { url : 'blank.html', init : 'uncontrolled/blank.html' },
18 { url : get_host_info()['HTTP_REMOTE_ORIGIN'] +
19 '/serviceworker/resources/blank.html' },
20 { url : 'http://[example].com' },
21 { url : 'view-source://example.com' },
22 { url : 'file:///' },
23 { url : 'about:blank' },
24 { url : 'about:crash' }
25 ];
26
27 var expected = [
28 location.origin + '/serviceworker/resources/blank.html',
29 'TypeError',
30 null,
31 'TypeError',
32 'TypeError',
33 'SecurityError',
34 'TypeError',
35 'TypeError'
36 ];
37
38 var actual = [];
39
40 async_test(function(t) {
41 test = t;
42 return service_worker_unregister_and_register(
43 test, 'resources/windowclient-navigate-worker.js', scope)
44 .then(function(registration) {
45 return wait_for_state(test, registration.installing, 'activated');
46 })
47 .then(function() {
48 var init_url = test_list[current_index].init || scope;
49 return with_iframe(init_url + '#client');
50 })
51 .then(function(f) {
52 client_frame = f;
53 return with_iframe(scope + '#message');
54 })
55 .then(function(f) {
56 message_frame = f;
57 var worker = f.contentWindow.navigator.serviceWorker;
58 worker.onmessage = test.step_func(on_message);
59 worker.controller.postMessage(test_list[current_index++].url);
60 })
61 .catch(unreached_rejection(t));
62 }, 'WindowClient.navigate() test');
63
64 function on_message(e) {
65 var message = e.data;
66
67 actual.push(message);
68 if (expected.length == actual.length) {
69 assert_array_equals(actual, expected);
70 service_worker_unregister_and_done(test, scope);
71 } else {
72 client_frame.remove();
73 var init_url = test_list[current_index].init || scope;
74 with_iframe(init_url + '#client').then(function(f) {
75 client_frame = f;
76 e.source.postMessage(test_list[current_index++].url);
77 });
78 }
79 }
80
81 </script>
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/windowclient-navigate-worker.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698