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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/workers/constructors/Worker/same-origin.html

Issue 2418853003: Worker: Import "imported/wpt/workers" tests (Retry) (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
(Empty)
1 <!doctype html>
2 <meta charset=utf-8>
3 <title>same-origin checks; the script is in a script element</title>
4 <link rel=help href="http://www.whatwg.org/html/#dom-worker">
5 <script src="/resources/testharness.js"></script>
6 <script src="/resources/testharnessreport.js"></script>
7 <div id="log"></div>
8 <script>
9 // Needed to prevent a race condition if a worker throws an exception that may o r may
10 // not propogate to the window before the tests finish
11 setup({allow_uncaught_exception: true});
12
13 function testSharedWorkerHelper(t, script) {
14 try {
15 var worker = new SharedWorker(script, '');
16 worker.onerror = t.step_func_done(function(e) {
17 assert_true(e instanceof ErrorEvent);
18 });
19 } catch (e) {
20 t.step_func_done(function(e) { assert_true(true); });
21 }
22 }
23
24 test(function() {
25 assert_throws("SecurityError", function() { new Worker('unsupported:'); });
26 }, "unsupported_scheme");
27
28 async_test(function() {
29 var worker = new Worker('data:,postMessage(1);');
30 worker.onmessage = this.step_func_done(function(e) {
31 assert_equals(e.data, 1);
32 });
33 }, "data_url");
34
35 async_test(function(t) {
36 testSharedWorkerHelper(t, 'about:blank');
37 }, "about_blank");
38
39 async_test(function(t) {
40 testSharedWorkerHelper(t, 'http://www.example.invalid/');
41 }, "example_invalid");
42
43 async_test(function(t) {
44 testSharedWorkerHelper(t, location.protocol+'//'+location.hostname+':81/');
45 }, "port_81");
46
47 async_test(function(t) {
48 testSharedWorkerHelper(t, 'https://'+location.hostname+':80/');
49 }, "https_port_80");
50
51 async_test(function(t) {
52 testSharedWorkerHelper(t, 'https://'+location.hostname+':8000/');
53 }, "https_port_8000");
54
55 async_test(function(t) {
56 testSharedWorkerHelper(t, 'http://'+location.hostname+':8012/');
57 }, "http_post_8012");
58
59 async_test(function(t) {
60 testSharedWorkerHelper(t,'javascript:""');
61 }, "javascript_url");
62
63 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698