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

Side by Side Diff: LayoutTests/http/tests/serviceworker/resources/fetch-cors-xhr-iframe.html

Issue 588093003: [ServiceWorker] Add test for the rejected result of FetchEvent using XHR. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/resources/fetch-rewrite-worker.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <script src="test-helpers.js?pipe=sub"></script> 1 <script src="test-helpers.js?pipe=sub"></script>
2 <script> 2 <script>
3 var path = base_path() + 'fetch-access-control.php'; 3 var path = base_path() + 'fetch-access-control.php';
4 var host_info = get_host_info(); 4 var host_info = get_host_info();
5 5
6 function create_success_test_promise(url, with_credentials) { 6 function create_success_test_promise(url, with_credentials) {
7 return new Promise(function(resolve, reject) { 7 return new Promise(function(resolve, reject) {
8 var xhr = new XMLHttpRequest(); 8 var xhr = new XMLHttpRequest();
9 xhr.onload = resolve; 9 xhr.onload = resolve;
10 xhr.onerror = function() { 10 xhr.onerror = function() {
(...skipping 24 matching lines...) Expand all
35 35
36 window.addEventListener('message', function(evt) { 36 window.addEventListener('message', function(evt) {
37 var port = evt.ports[0]; 37 var port = evt.ports[0];
38 create_success_test_promise(host_info['HTTP_ORIGIN'] + path, false) 38 create_success_test_promise(host_info['HTTP_ORIGIN'] + path, false)
39 .then(function() { 39 .then(function() {
40 return create_failure_test_promise( 40 return create_failure_test_promise(
41 host_info['HTTP_REMOTE_ORIGIN'] + path, 41 host_info['HTTP_REMOTE_ORIGIN'] + path,
42 false); 42 false);
43 }) 43 })
44 .then(function() { 44 .then(function() {
45 return create_failure_test_promise('./dummy?reject', false);
yhirano 2014/09/22 07:42:51 Do we have a test for resolve-but-not-with-respons
horo 2014/09/22 09:00:28 Done.
46 })
47 .then(function() {
45 return create_success_test_promise( 48 return create_success_test_promise(
46 './dummy?url=' + 49 './dummy?url=' +
47 encodeURIComponent(host_info['HTTP_ORIGIN'] + path), 50 encodeURIComponent(host_info['HTTP_ORIGIN'] + path),
48 false); 51 false);
49 }) 52 })
50 .then(function() { 53 .then(function() {
51 return create_failure_test_promise( 54 return create_failure_test_promise(
52 './dummy?mode=no-cors&url=' + 55 './dummy?mode=no-cors&url=' +
53 encodeURIComponent(host_info['HTTP_REMOTE_ORIGIN'] + path), 56 encodeURIComponent(host_info['HTTP_REMOTE_ORIGIN'] + path),
54 false); 57 false);
(...skipping 21 matching lines...) Expand all
76 true); 79 true);
77 }) 80 })
78 .then(function() { 81 .then(function() {
79 port.postMessage({results: 'finish'}); 82 port.postMessage({results: 'finish'});
80 }) 83 })
81 .catch(function(e) { 84 .catch(function(e) {
82 port.postMessage({results: 'failure:' + e}); 85 port.postMessage({results: 'failure:' + e});
83 }); 86 });
84 }, false); 87 }, false);
85 </script> 88 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/resources/fetch-rewrite-worker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698