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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/windowclient-navigate.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/windowclient-navigate.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/windowclient-navigate.html
new file mode 100644
index 0000000000000000000000000000000000000000..92bc69be77617c0364e9496209798518d7d72457
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/windowclient-navigate.html
@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<title>Service Worker: WindowClient.navigate() tests</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="../resources/get-host-info.js"></script>
+<script src="resources/test-helpers.js"></script>
+<script>
+
+var scope = 'resources/blank.html?windowclient-navigate';
+var client_frame;
+var message_frame;
+var test;
+
+var current_index = 0;
+var test_list = [
+ { url : 'blank.html' },
+ { url : 'blank.html', init : 'uncontrolled/blank.html' },
+ { url : get_host_info()['HTTP_REMOTE_ORIGIN'] +
+ '/serviceworker/resources/blank.html' },
+ { url : 'http://[example].com' },
+ { url : 'view-source://example.com' },
+ { url : 'file:///' },
+ { url : 'about:blank' },
+ { url : 'about:crash' }
+];
+
+var expected = [
+ location.origin + '/serviceworker/resources/blank.html',
+ 'TypeError',
+ null,
+ 'TypeError',
+ 'TypeError',
+ 'SecurityError',
+ 'TypeError',
+ 'TypeError'
+];
+
+var actual = [];
+
+async_test(function(t) {
+ test = t;
+ return service_worker_unregister_and_register(
+ test, 'resources/windowclient-navigate-worker.js', scope)
+ .then(function(registration) {
+ return wait_for_state(test, registration.installing, 'activated');
+ })
+ .then(function() {
+ var init_url = test_list[current_index].init || scope;
+ return with_iframe(init_url + '#client');
+ })
+ .then(function(f) {
+ client_frame = f;
+ return with_iframe(scope + '#message');
+ })
+ .then(function(f) {
+ message_frame = f;
+ var worker = f.contentWindow.navigator.serviceWorker;
+ worker.onmessage = test.step_func(on_message);
+ worker.controller.postMessage(test_list[current_index++].url);
+ })
+ .catch(unreached_rejection(t));
+}, 'WindowClient.navigate() test');
+
+function on_message(e) {
+ var message = e.data;
+
+ actual.push(message);
+ if (expected.length == actual.length) {
+ assert_array_equals(actual, expected);
+ service_worker_unregister_and_done(test, scope);
+ } else {
+ client_frame.remove();
+ var init_url = test_list[current_index].init || scope;
+ with_iframe(init_url + '#client').then(function(f) {
+ client_frame = f;
+ e.source.postMessage(test_list[current_index++].url);
+ });
+ }
+}
+
+</script>
« 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