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

Unified Diff: LayoutTests/http/tests/serviceworker/uncontrolled-page.html

Issue 600843003: Test of uncontrolled page doing a fetch, which currently hits the sw. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed unneeded file. Created 6 years, 3 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 | « LayoutTests/http/tests/serviceworker/resources/fail-on-fetch-worker.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/serviceworker/uncontrolled-page.html
diff --git a/LayoutTests/http/tests/serviceworker/uncontrolled-page.html b/LayoutTests/http/tests/serviceworker/uncontrolled-page.html
new file mode 100644
index 0000000000000000000000000000000000000000..ae865e22a30c1fb415c4eecbe8052cfec5413417
--- /dev/null
+++ b/LayoutTests/http/tests/serviceworker/uncontrolled-page.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<title>Service Worker: Registration</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="resources/test-helpers.js"></script>
+<script>
+function fetch_url(url) {
+ return new Promise(function(resolve, reject) {
+ var request = new XMLHttpRequest();
+ request.addEventListener('load', function(event) {
+ if (request.status == 200)
+ resolve(request.response);
+ else
+ reject(Error(request.statusText));
+ });
+ request.open('GET', url);
+ request.send();
+ });
+}
+var worker = 'resources/fail-on-fetch-worker.js';
+
+async_test(function(t) {
+ var scope = '/';
+ service_worker_unregister_and_register(t, worker, scope)
+ .then(function(reg) { return wait_for_activated(t, reg, scope); })
+ .then(function() {
+ return fetch_url('/serviceworker/resources/simple.json');
+ })
+ .then(function(json) {
+ assert_equals(json, '{ "a" : 1, "b" : 2 }\n');
+ service_worker_unregister_and_done(t, scope);
+ })
+ .catch(t.step_func(function(reason) {
+ assert_unreached(reason.message);
+ }));
+ }, 'Fetch events should not go through uncontrolled page.');
+</script>
« no previous file with comments | « LayoutTests/http/tests/serviceworker/resources/fail-on-fetch-worker.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698