OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <title>Service Worker: FetchEvent for HTMLImports</title> | |
3 <script src="../resources/testharness.js"></script> | |
4 <script src="../resources/testharnessreport.js"></script> | |
5 <script src="../resources/get-host-info.js?pipe=sub"></script> | |
6 <script src="resources/test-helpers.js"></script> | |
7 <script> | |
8 async_test(function(t) { | |
9 var SCOPE = 'resources/fetch-request-html-imports-iframe.html'; | |
10 var SCRIPT = 'resources/fetch-request-html-imports-worker.js'; | |
11 var host_info = get_host_info(); | |
12 service_worker_unregister_and_register(t, SCRIPT, SCOPE) | |
13 .then(function(registration) { | |
14 return wait_for_state(t, registration.installing, 'activated'); | |
15 }) | |
16 .then(function() { return with_iframe(SCOPE); }) | |
17 .then(function(frame) { | |
18 var same = frame.contentWindow.document.getElementById("same").import; | |
19 var same_same = same.getElementById("same-same").import; | |
20 var same_other = same.getElementById("same-other").import; | |
21 var other = | |
22 frame.contentWindow.document.getElementById("other").import; | |
23 var other_same = other.getElementById("other-same").import; | |
24 var other_other = other.getElementById("other-other").import; | |
25 | |
26 assert_equals( | |
27 same.body.innerText, | |
28 'mode=cors credentials=same-origin', | |
29 'The request mode and credentials for same origin HTMLImport ' + | |
30 'must be set correctly.'); | |
31 assert_equals( | |
32 same_same.body.innerText, | |
33 'mode=cors credentials=same-origin', | |
34 'The request mode and credentials for same origin HTMLImport ' + | |
35 'from same origin HTMLImports must be set correctly.'); | |
36 assert_equals( | |
37 same_other.body.innerText, | |
38 'mode=cors credentials=same-origin', | |
39 'The request mode and credentials for other origin HTMLImport ' + | |
40 'from same origin HTMLImports must be set correctly.'); | |
41 assert_equals( | |
42 other.body.innerText, | |
43 'mode=cors credentials=same-origin', | |
44 'The request mode and credentials for other origin HTMLImport ' + | |
45 'must be set correctly.'); | |
46 assert_equals( | |
47 other_same.body.innerText, | |
48 'mode=cors credentials=same-origin', | |
49 'The request mode and credentials for same origin HTMLImport ' + | |
50 'from other origin HTMLImports must be set correctly.'); | |
51 assert_equals( | |
52 other_other.body.innerText, | |
53 'mode=cors credentials=same-origin', | |
54 'The request mode and credentials for other origin HTMLImport ' + | |
55 'from other origin HTMLImport must be set correctly.'); | |
56 | |
57 service_worker_unregister_and_done(t, SCOPE); | |
58 }) | |
59 .catch(unreached_rejection(t)); | |
60 }, 'Verify the FetchEvent for HTMLImports'); | |
61 </script> | |
OLD | NEW |