OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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> |
OLD | NEW |