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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/invalid-header-iframe.https.html

Issue 2865313003: Upstream service worker tests to WPT (Closed)
Patch Set: Re-introduce resource script 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="test-helpers.sub.js?pipe=sub"></script> 1 <script src="test-helpers.sub.js"></script>
2 <script> 2 <script>
3 3
4 function xhr_send(method, data) { 4 function xhr_send(method, data) {
5 return new Promise(function(resolve, reject) { 5 return new Promise(function(resolve, reject) {
6 var xhr = new XMLHttpRequest(); 6 var xhr = new XMLHttpRequest();
7 xhr.onload = function() { 7 xhr.onload = function() {
8 reject('XHR must fail.'); 8 reject('XHR must fail.');
9 }; 9 };
10 xhr.onerror = function() { 10 xhr.onerror = function() {
11 resolve(); 11 resolve();
12 }; 12 };
13 xhr.responseType = 'text'; 13 xhr.responseType = 'text';
14 xhr.open(method, './dummy?test', true); 14 xhr.open(method, './dummy?test', true);
15 xhr.send(data); 15 xhr.send(data);
16 }); 16 });
17 } 17 }
18 18
19 19
20 window.addEventListener('message', function(evt) { 20 window.addEventListener('message', function(evt) {
21 var port = evt.ports[0]; 21 var port = evt.ports[0];
22 xhr_send('POST', 'test string') 22 xhr_send('POST', 'test string')
23 .then(function() { port.postMessage({results: 'finish'}); }) 23 .then(function() { port.postMessage({results: 'finish'}); })
24 .catch(function(e) { port.postMessage({results: 'failure:' + e}); }); 24 .catch(function(e) { port.postMessage({results: 'failure:' + e}); });
25 }); 25 });
26 </script> 26 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698