Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-origin-header-in-isolated-world.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-origin-header-in-isolated-world.html b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-origin-header-in-isolated-world.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0e6f4bb0fc11e4b10942026647fa37a6cdc7a170 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-origin-header-in-isolated-world.html |
| @@ -0,0 +1,33 @@ |
| +<!DOCTYPE html> |
| +<script src="/js-test-resources/testharness.js"></script> |
| +<script src="/js-test-resources/testharnessreport.js"></script> |
| +<script> |
| +if (window.testRunner) { |
| + // Testing with "http" scheme than "chrome-extension://" since content_shell |
| + // doesn't register the extension scheme as a web safe isolated scheme. |
| + testRunner.setIsolatedWorldSecurityOrigin(1, 'http://example.com'); |
| +} |
| + |
| +function runTest() { |
| + const xhr = new XMLHttpRequest(); |
| + xhr.open("GET", "http://localhost:8000/xmlhttprequest/resources/access-control-origin-header-in-isolated-world.php"); |
|
yhirano
2017/01/18 05:28:03
Please use double-quotation and quotation consiste
tyoshino (SeeGerritForStatus)
2017/01/18 06:53:42
Done.
|
| + xhr.setRequestHeader("X-Custom-Header", "PASS"); |
| + xhr.onerror = () => { |
| + postMessage('FAIL: XHR errored', '*'); |
| + }; |
| + xhr.onload = () => { |
| + postMessage(xhr.responseText, '*'); |
| + }; |
| + xhr.send(); |
| +} |
| + |
| +async_test(t => { |
| + addEventListener('message', t.step_func(event => { |
| + assert_equals(event.data, 'PASS'); |
| + t.done(); |
| + })); |
| + testRunner.evaluateScriptInIsolatedWorld(1, String(eval('runTest')) + '\nrunTest();'); |
| +}, 'The Origin header contains the origin of the isolated world where the script is running'); |
| + |
| +done(); |
| +</script> |