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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/fetch-csp-iframe.html

Issue 2805313003: Upstream service worker `fetch` tests to WPT (Closed)
Patch Set: Move files up a directory Created 3 years, 7 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 <script src="/common/get-host-info.sub.js"></script>
2 <script src="test-helpers.sub.js?pipe=sub"></script>
3 <script> 1 <script>
4 var image_path = base_path() + 'fetch-access-control.py?PNGIMAGE'; 2 var meta = document.createElement('meta');
5 var host_info = get_host_info(); 3 meta.setAttribute('http-equiv', 'Content-Security-Policy');
6 var results = ''; 4 meta.setAttribute('content', decodeURIComponent(location.search.substring(1)));
7 var port = undefined; 5 document.head.appendChild(meta);
8 6
9 function test1() { 7 function load_image(url) {
10 var img = document.createElement('img'); 8 return new Promise(function(resolve, reject) {
11 document.body.appendChild(img); 9 var img = document.createElement('img');
12 img.onload = function() { 10 document.body.appendChild(img);
13 test2(); 11 img.onload = resolve;
14 }; 12 img.onerror = reject;
15 img.onerror = function() { 13 img.src = url;
16 results += 'FAIL(1)'; 14 });
17 test2();
18 };
19 img.src = host_info['HTTPS_ORIGIN'] + image_path;
20 } 15 }
21
22 function test2() {
23 var img = document.createElement('img');
24 document.body.appendChild(img);
25 img.onload = function() {
26 results += 'FAIL(2)';
27 test3();
28 };
29 img.onerror = function() {
30 test3();
31 };
32 img.src = host_info['HTTPS_REMOTE_ORIGIN'] + image_path;
33 }
34
35 function test3() {
36 var img = document.createElement('img');
37 document.body.appendChild(img);
38 img.onload = function() {
39 test4();
40 };
41 img.onerror = function() {
42 results += 'FAIL(3)';
43 test4();
44 };
45 img.src = './dummy?url=' +
46 encodeURIComponent(host_info['HTTPS_ORIGIN'] + image_path);
47 }
48
49 function test4() {
50 var img = document.createElement('img');
51 document.body.appendChild(img);
52 img.onload = function() {
53 results += 'FAIL(4)';
54 finish();
55 };
56 img.onerror = function() {
57 finish();
58 };
59 img.src = './dummy?mode=no-cors&url=' +
60 encodeURIComponent(host_info['HTTPS_REMOTE_ORIGIN'] + image_path);
61 }
62
63 function finish() {
64 results += 'finish';
65 port.postMessage({results: results});
66 }
67
68 window.addEventListener('message', function(evt) {
69 port = evt.ports[0];
70 test1();
71 }, false);
72 </script> 16 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698