OLD | NEW |
1 <body> | 1 <body> |
2 <p>Test Worker constructor functionality. Should print a series of PASS messages
, followed with DONE.</p> | 2 <p>Test Worker constructor functionality. Should print a series of PASS messages
, followed with DONE.</p> |
3 <div id=result></div> | 3 <div id=result></div> |
4 <script> | 4 <script> |
5 function log(message) | 5 function log(message) |
6 { | 6 { |
7 document.getElementById("result").innerHTML += message + "<br>"; | 7 document.getElementById("result").innerHTML += message + "<br>"; |
8 } | 8 } |
9 | 9 |
10 var testCases = [ | 10 var testCases = [ |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } catch (ex) { | 64 } catch (ex) { |
65 log("PASS: invoking Worker constructor without arguments resulted in an
exception (" + ex + ")"); | 65 log("PASS: invoking Worker constructor without arguments resulted in an
exception (" + ex + ")"); |
66 } | 66 } |
67 runNextTest(); | 67 runNextTest(); |
68 } | 68 } |
69 | 69 |
70 function testEmptyScriptUrl() | 70 function testEmptyScriptUrl() |
71 { | 71 { |
72 try { | 72 try { |
73 var worker = new Worker(""); | 73 var worker = new Worker(""); |
74 worker.onerror = function() { | 74 worker.onerror = function(e) { |
75 log("FAIL: onerror invoked for an empty script URL."); | 75 log("PASS: onerror invoked for an empty script URL, resolving to thi
s HTML document's URL."); |
| 76 e.preventDefault(); |
76 runNextTest(); | 77 runNextTest(); |
77 } | 78 } |
78 } catch (ex) { | 79 } catch (ex) { |
79 log("PASS: invoking Worker constructor with empty script URL resulted in
an exception (" + ex + ")"); | 80 log("FAIL: invoking Worker constructor with empty script URL resulted in
a exception (" + ex + ")"); |
80 runNextTest(); | 81 runNextTest(); |
81 } | 82 } |
82 } | 83 } |
83 | 84 |
84 function testInvalidScriptUrl() | 85 function testInvalidScriptUrl() |
85 { | 86 { |
86 try { | 87 try { |
87 var worker = new Worker("http://invalid:123$"); | 88 var worker = new Worker("http://invalid:123$"); |
88 worker.onerror = function() { | 89 worker.onerror = function() { |
89 log("FAIL: onerror invoked for an invalid script URL."); | 90 log("FAIL: onerror invoked for an invalid script URL."); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 129 |
129 if (window.testRunner) { | 130 if (window.testRunner) { |
130 testRunner.dumpAsText(); | 131 testRunner.dumpAsText(); |
131 testRunner.waitUntilDone(); | 132 testRunner.waitUntilDone(); |
132 } | 133 } |
133 | 134 |
134 runNextTest(); | 135 runNextTest(); |
135 | 136 |
136 </script> | 137 </script> |
137 </body> | 138 </body> |
OLD | NEW |