Chromium Code Reviews| 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..5dda81be0eb5f4ad96e01671f060c8bf106f541b |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/serviceworker/uncontrolled-page.html |
| @@ -0,0 +1,37 @@ |
| +<!DOCTYPE html> |
|
horo
2014/09/25 09:49:00
indent fix
<!DOCTYPE html>
<title>Service Worker
dmurph
2014/09/26 17:42:02
Done.
|
| +<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> |