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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/resources/fetch-response-xhr-iframe.https.html

Issue 2415873002: Import w3c tests for the service workers (Closed)
Patch Set: Rebase Created 4 years, 2 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="../../resources/testharness.js"></script> 1 <script src="../resources/get-host-info.sub.js"></script>
2 <script src="test-helpers.js"></script> 2 <script src="test-helpers.sub.js?pipe=sub"></script>
3 <script> 3 <script>
4 var host_info = get_host_info();
4 5
5 function xhr_send(method, data) { 6 function xhr_send(method, data) {
6 return new Promise(function(resolve, reject) { 7 return new Promise(function(resolve, reject) {
7 var xhr = new XMLHttpRequest(); 8 var xhr = new XMLHttpRequest();
8 xhr.onload = function() { 9 xhr.onload = function() {
9 resolve(xhr); 10 resolve(xhr);
10 }; 11 };
11 xhr.onerror = function() { 12 xhr.onerror = function() {
12 reject('XHR should succeed.'); 13 reject('XHR should succeed.');
13 }; 14 };
14 xhr.responseType = 'text'; 15 xhr.responseType = 'text';
15 xhr.open(method, './dummy?test', true); 16 xhr.open(method, './dummy?test', true);
16 xhr.send(data); 17 xhr.send(data);
17 }); 18 });
18 } 19 }
19 20
20 function coalesce_headers_test() { 21 function coalesce_headers_test() {
21 return xhr_send('POST', 'test string') 22 return xhr_send('POST', 'test string')
22 .then(function(xhr) { 23 .then(function(xhr) {
23 assert_equals(xhr.getResponseHeader('foo'), 'foo, bar'); 24 window.parent.postMessage({results: xhr.getResponseHeader('foo')},
25 host_info['HTTPS_ORIGIN']);
24 }); 26 });
25 } 27 }
26 28
27 window.addEventListener('message', function(evt) { 29 window.addEventListener('message', function(evt) {
28 var port = evt.ports[0]; 30 var port = evt.ports[0];
29 coalesce_headers_test() 31 coalesce_headers_test()
30 .then(function() { port.postMessage({results: 'finish'}); }) 32 .then(function() { port.postMessage({results: 'finish'}); })
31 .catch(function(e) { port.postMessage({results: 'failure:' + e}); }); 33 .catch(function(e) { port.postMessage({results: 'failure:' + e}); });
32 }); 34 });
33 </script> 35 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698