Commit 739259e7 authored by Hiroshige Hayashizaki's avatar Hiroshige Hayashizaki Committed by Commit Bot

Add tests for (module dedicated|classic shared) worker's URLs

This CL adds WPT tests for
- WorkerLocation (wpt/workers/interfaces/WorkerGlobalScope/location/),
- referrer (wpt/xhr/), and
- API base URL (wpt/workers/baseurl/)
that should reflect worker global scope's URL, for
- classic shared workers and
- module classic workers.

Some tests are half-migrated to fetch_tests_from_worker()-style
to test shared workers easily, while the tests for
module workers uses the existing non-fetch_tests_from_worker()-style
tests, because testharness.js can't be used from module scripts.

Bug: 861564
Change-Id: I62fa415647da47e00bf7cbf4d7648f5d64377c04
Reviewed-on: https://chromium-review.googlesource.com/1128517
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#573840}
parent 3d6e4b23
......@@ -3431,7 +3431,6 @@ crbug.com/626703 external/wpt/webvtt/rendering/cues-with-video/processing-model/
crbug.com/815116 external/wpt/workers/name-property.html [ Timeout Failure Pass ]
crbug.com/626703 external/wpt/xhr/abort-after-stop.htm [ Timeout ]
crbug.com/626703 external/wpt/xhr/event-readystatechange-loaded.htm [ Failure Timeout ]
crbug.com/626703 external/wpt/xhr/open-url-redirected-worker-origin.htm [ Failure ]
crbug.com/626703 external/wpt/xhr/preserve-ua-header-on-redirect.htm [ Failure ]
crbug.com/626703 external/wpt/xhr/send-content-type-string.htm [ Failure ]
crbug.com/626703 external/wpt/xhr/send-entity-body-document.htm [ Failure ]
......@@ -3472,6 +3471,26 @@ crbug.com/626703 external/wpt/html/rendering/non-replaced-elements/margin-collap
crbug.com/626703 external/wpt/html/rendering/non-replaced-elements/margin-collapsing-quirks/multicol-standards-mode.html [ Pass Crash Failure ]
crbug.com/762017 external/wpt/html/semantics/embedded-content/media-elements/video_loop_base.html [ Pass Crash ]
# Worker/SharedWorker are not exposed in WorkerGlobalScope.
crbug.com/850662 external/wpt/workers/baseurl/alpha/worker-in-worker.html [ Failure ]
crbug.com/850662 external/wpt/workers/baseurl/alpha/sharedworker-in-worker.html [ Failure ]
# crbug.com/861564 is ongoing for classic dedicated workers.
crbug.com/861564 external/wpt/workers/baseurl/alpha/importScripts-in-worker.html [ Failure ]
crbug.com/861564 external/wpt/workers/baseurl/alpha/xhr-in-worker.html [ Failure ]
crbug.com/861564 external/wpt/workers/interfaces/WorkerGlobalScope/location/redirect.html [ Failure ]
crbug.com/861564 external/wpt/xhr/open-url-redirected-worker-origin.htm [ Failure ]
# crbug.com/861564 is ongoing for classic shared workers.
crbug.com/861564 external/wpt/workers/baseurl/alpha/importScripts-in-sharedworker.html [ Failure ]
crbug.com/861564 external/wpt/workers/baseurl/alpha/xhr-in-sharedworker.html [ Failure ]
crbug.com/861564 external/wpt/workers/interfaces/WorkerGlobalScope/location/redirect-sharedworker.html [ Failure ]
crbug.com/861564 external/wpt/xhr/open-url-redirected-sharedworker-origin.htm [ Failure ]
# crbug.com/861564 is ongoing for module dedicated workers.
crbug.com/861564 external/wpt/workers/baseurl/alpha/xhr-in-moduleworker.html [ Failure ]
crbug.com/861564 external/wpt/workers/interfaces/WorkerGlobalScope/location/redirect-module.html [ Failure ]
# Other untriaged test failures, timeouts and crashes from newly-imported WPT tests.
crbug.com/666703 external/wpt/html/browsers/sandboxing/sandbox-disallow-same-origin.html [ Timeout ]
crbug.com/626703 external/wpt/html/dom/documents/dom-tree-accessors/Document.currentScript.html [ Timeout ]
......@@ -3480,11 +3499,8 @@ crbug.com/626703 external/wpt/html/browsers/history/the-location-interface/locat
crbug.com/785940 external/wpt/web-animations/timing-model/timelines/document-timelines.html [ Failure Pass ]
crbug.com/655458 external/wpt/workers/constructors/SharedWorker/undefined-arguments.html [ Failure ]
crbug.com/655458 external/wpt/workers/baseurl/alpha/worker.html [ Failure ]
crbug.com/655458 external/wpt/workers/interfaces/SharedWorkerGlobalScope/onconnect.html [ Failure ]
crbug.com/655458 external/wpt/workers/baseurl/alpha/importScripts.html [ Failure ]
crbug.com/655458 external/wpt/workers/constructors/SharedWorker/setting-port-members.html [ Failure ]
crbug.com/655458 external/wpt/workers/baseurl/alpha/xhr.html [ Failure ]
crbug.com/655458 external/wpt/workers/constructors/SharedWorker/connect-event.html [ Failure ]
crbug.com/655458 external/wpt/workers/semantics/interface-objects/003.html [ Failure ]
crbug.com/655458 external/wpt/workers/constructors/Worker/unresolvable-url.html [ Failure ]
......@@ -3497,7 +3513,6 @@ crbug.com/655458 external/wpt/workers/semantics/run-a-worker/003.html [ Failure
crbug.com/655458 external/wpt/workers/constructors/Worker/AbstractWorker.onerror.html [ Failure ]
crbug.com/655458 external/wpt/workers/interfaces/WorkerGlobalScope/onerror/exception-in-onerror.html [ Failure ]
crbug.com/655458 external/wpt/workers/interfaces/WorkerGlobalScope/onerror/not-handled.html [ Failure ]
crbug.com/655458 external/wpt/workers/baseurl/alpha/sharedworker.html [ Failure ]
crbug.com/655458 external/wpt/workers/Worker_terminate_event_queue.htm [ Timeout ]
crbug.com/655458 external/wpt/workers/interfaces/WorkerUtils/navigator/language.html [ Failure ]
crbug.com/655458 external/wpt/workers/interfaces/WorkerGlobalScope/onerror/handled.html [ Failure ]
......@@ -3506,7 +3521,6 @@ crbug.com/655458 external/wpt/workers/constructors/SharedWorker/unresolvable-url
crbug.com/655458 external/wpt/workers/constructors/SharedWorker/same-origin.html [ Failure Timeout ]
crbug.com/655458 external/wpt/workers/constructors/Worker/same-origin.html [ Failure Timeout ]
crbug.com/655458 external/wpt/workers/interfaces/WorkerGlobalScope/location/redirect.html [ Failure Timeout ]
crbug.com/655458 external/wpt/workers/interfaces/WorkerGlobalScope/onerror/propagate-to-window-onerror.html [ Failure Timeout ]
crbug.com/655458 external/wpt/workers/interfaces/WorkerUtils/importScripts/006.html [ Failure Timeout ]
crbug.com/655458 external/wpt/workers/semantics/multiple-workers/007.html [ Timeout ]
......
<!doctype html>
<meta charset=utf-8>
<title>Base URL in workers: importScripts</title>
<title>Base URL in module dedicated workers: import</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
async_test(function() {
var worker = new Worker("../beta/importScripts.py");
var worker = new Worker("../beta/import.py", {type: "module"});
worker.onmessage = this.step_func_done(function(e) {
assert_equals(e.data, "gamma");
assert_equals(e.data, "gamma/script-module.js");
});
worker.onerror = this.unreached_func("Got error event");
});
......
<!doctype html>
<meta charset=utf-8>
<title>Base URL in classic shared workers: importScripts</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
fetch_tests_from_worker(new SharedWorker("../beta/importScripts.py"));
</script>
<!doctype html>
<meta charset=utf-8>
<title>Base URL in classic dedicated workers: importScripts</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
fetch_tests_from_worker(new Worker("../beta/importScripts.py"));
</script>
<!doctype html>
<meta charset=utf-8>
<title>Base URL in workers: XHR</title>
<title>Base URL in module dedicated workers: XHR</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
async_test(function() {
var worker = new Worker("../beta/xhr.py");
var worker = new Worker("../beta/xhr.py", {type: "module"});
worker.onmessage = this.step_func_done(function(e) {
assert_equals(e.data, "gamma\n");
});
......
<!doctype html>
<meta charset=utf-8>
<title>Base URL in classic shared workers: XHR</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
fetch_tests_from_worker(new SharedWorker("../beta/xhr-worker.py"));
</script>
<!doctype html>
<meta charset=utf-8>
<title>Base URL in classic dedicated workers: XHR</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
fetch_tests_from_worker(new Worker("../beta/xhr-worker.py"));
</script>
def main(request, response):
return (302, "Moved"), [("Location", "../gamma/import.js")], "postMessage('executed redirecting script');"
def main(request, response):
return (302, "Moved"), [("Location", "../gamma/xhr-worker.js")], "postMessage('executed redirecting script');"
importScripts('/resources/testharness.js');
importScripts("script.js");
test(() => {
assert_equals(result, "gamma/script.js");
});
done();
importScripts('/resources/testharness.js');
test(t => {
var x = new XMLHttpRequest();
x.open("GET", "test.txt", false);
x.send();
assert_equals(x.response, "gamma\n");
});
done();
<!doctype html>
<title>WorkerLocation with redirects: module dedicated workers</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
async_test(function() {
var worker = new Worker('helper-redirect.py?fail', {type: 'module'});
worker.onmessage = this.step_func_done(function(e) {
assert_equals(e.data[0], location.href.replace(/\/[^\/]+$/, '/post-location-members.js?a'));
assert_equals(e.data[1], location.protocol);
assert_equals(e.data[2], location.host);
assert_equals(e.data[3], location.hostname);
assert_equals(e.data[4], location.port);
assert_equals(e.data[5], location.pathname.replace(/\/[^\/]+$/, '/post-location-members.js'));
assert_equals(e.data[6], '?a');
assert_equals(e.data[7], '');
});
});
</script>
<!doctype html>
<title>WorkerLocation with redirects: classic shared workers</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
fetch_tests_from_worker(
new SharedWorker('/common/redirect.py?location=/workers/interfaces/WorkerGlobalScope/location/redirect.js?a'));
</script>
......@@ -2,7 +2,7 @@
/*
-->
<!doctype html>
<title>location with a worker in separate file that redirects</title>
<title>WorkerLocation with redirects: classic dedicated workers</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
......
importScripts('/resources/testharness.js');
test(t => {
assert_equals(location.pathname, '/workers/interfaces/WorkerGlobalScope/location/redirect.js');
assert_equals(location.search, '?a');
assert_equals(location.hash, '');
});
done();
<!DOCTYPE html>
<meta charset="utf-8">
<title>XMLHttpRequest: redirected classic shared worker scripts, origin and referrer</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var finalWorkerURL = "workerxhr-origin-referrer.js";
var url = "resources/redirect.py?location=" + encodeURIComponent(finalWorkerURL);
fetch_tests_from_worker(new SharedWorker(url));
</script>
<!DOCTYPE html>
<meta charset="utf-8">
<title>XMLHttpRequest: redirected worker scripts, origin and referrer</title>
<title>XMLHttpRequest: redirected classic dedicated worker scripts, origin and referrer</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment