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

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

Issue 1604893002: ServiceWorker: Rewrite windowclient-navigate.html test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Service Worker: WindowClient.navigate() tests</title> 2 <title>Service Worker: WindowClient.navigate() tests</title>
3 <script src="../resources/testharness.js"></script> 3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script> 4 <script src="../resources/testharnessreport.js"></script>
5 <script src="../resources/get-host-info.js"></script> 5 <script src="../resources/get-host-info.js"></script>
6 <script src="resources/test-helpers.js"></script> 6 <script src="resources/test-helpers.js"></script>
7 <script> 7 <script>
8 8
9 var scope = 'resources/blank.html?windowclient-navigate'; 9 var scope = 'resources/blank.html?windowclient-navigate';
10 var script_url = 'resources/windowclient-navigate-worker.js'; 10 var script_url = 'resources/windowclient-navigate-worker.js';
11 var client_frame; 11 var client_frame;
12 var worker; 12 var worker;
13 var test; 13 var test;
14 14
15 var current_index = 0; 15 var current_index = 0;
16 var test_list = [ 16 var test_list = [
17 { url : 'blank.html' }, 17 { url : 'blank.html' },
18 { url : '' }, 18 { url : '' },
19 { url : 'blank.html', init : 'uncontrolled/blank.html' }, 19 { url : 'blank.html', init : 'uncontrolled/blank.html' },
20 { url : get_host_info()['HTTP_REMOTE_ORIGIN'] + 20 { url : get_host_info()['HTTP_REMOTE_ORIGIN'] +
21 '/serviceworker/resources/blank.html' }, 21 '/serviceworker/resources/blank.html' },
22 { url : 'http://[example].com' }, 22 { url : 'http://[example].com' },
23 { url : 'view-source://example.com' }, 23 { url : 'view-source://example.com' },
24 { url : 'file:///' }, 24 { url : 'file:///' },
25 { url : 'about:blank' }, 25 { url : 'about:blank' },
26 { url : 'about:crash' } 26 { url : 'about:crash' }
27 ]; 27 ];
28 28
29 var expected = [ 29 var expected = [
30 'TypeError', // in-scope-but-not-controlled (start from serviceworker)
30 location.origin + '/serviceworker/resources/blank.html', 31 location.origin + '/serviceworker/resources/blank.html',
31 location.origin + '/serviceworker/' + script_url, 32 location.origin + '/serviceworker/' + script_url,
32 'TypeError', 33 'TypeError',
33 null, 34 null,
34 'TypeError', 35 'TypeError',
35 'TypeError', 36 'TypeError',
36 'TypeError', 37 'TypeError',
37 'TypeError', 38 'TypeError',
38 'TypeError' 39 'TypeError'
39 ]; 40 ];
(...skipping 13 matching lines...) Expand all
53 on_message(e, channel.port1); 54 on_message(e, channel.port1);
54 }); 55 });
55 worker.postMessage({ port : channel.port2 }, [channel.port2]); 56 worker.postMessage({ port : channel.port2 }, [channel.port2]);
56 }) 57 })
57 .catch(unreached_rejection(t)); 58 .catch(unreached_rejection(t));
58 }, 'WindowClient.navigate() test'); 59 }, 'WindowClient.navigate() test');
59 60
60 function on_message(e, port) { 61 function on_message(e, port) {
61 var message = e.data; 62 var message = e.data;
62 63
63 message == 'ready' || actual.push(message); 64 actual.push(message);
64 if (expected.length == actual.length) { 65 if (expected.length == actual.length) {
65 assert_array_equals(actual, expected); 66 assert_array_equals(actual, expected);
66 service_worker_unregister_and_done(test, scope); 67 service_worker_unregister_and_done(test, scope);
67 } else { 68 } else {
68 client_frame && client_frame.remove(); 69 client_frame && client_frame.remove();
69 var init_url = test_list[current_index].init || scope; 70 var init_url = test_list[current_index].init || scope;
70 with_iframe(init_url).then(function(f) { 71 with_iframe(init_url).then(function(f) {
71 client_frame = f; 72 client_frame = f;
72 port.postMessage(test_list[current_index++].url); 73 port.postMessage(test_list[current_index++].url);
73 }); 74 });
74 } 75 }
75 } 76 }
76 77
77 </script> 78 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698