Index: third_party/WebKit/LayoutTests/fast/workers/worker-atomics-wait.html |
diff --git a/third_party/WebKit/LayoutTests/fast/workers/worker-atomics-wait.html b/third_party/WebKit/LayoutTests/fast/workers/worker-atomics-wait.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bd470361f05f556c164d738ae05ba524456ea8e4 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/workers/worker-atomics-wait.html |
@@ -0,0 +1,45 @@ |
+<!DOCTYPE html> |
+<html> |
+<body> |
+<p>Test that Atomics.wait is not allowed on the main thread.</p> |
+<div id="result"></div> |
+<script type="text/javascript"> |
+function log(message) |
+{ |
+ document.getElementById("result").innerHTML += message + "</br>"; |
+} |
+ |
+if (window.testRunner) { |
+ testRunner.dumpAsText(); |
+ testRunner.waitUntilDone(); |
+} |
+ |
+if (window.internals && internals.runtimeFlags.sharedArrayBufferEnabled && window.SharedArrayBuffer) { |
+ var view = new Int32Array(new SharedArrayBuffer(4)); |
+ try { |
+ Atomics.wait(view, 0, 0, 0); |
+ log("FAIL: Calling Atomics.wait on the main thread did not throw."); |
+ } catch (e) { |
+ log("PASS: Calling Atomics.wait on the main thread throws."); |
+ } |
+ |
+ var worker = new Worker('resources/worker-atomics-wait.js'); |
+ worker.postMessage(view); |
+ |
+ worker.onmessage = function(e) { |
+ log(e.data); |
+ if (e.data == 'DONE') { |
+ if (window.testRunner) |
+ testRunner.notifyDone(); |
+ } |
+ }; |
+} else { |
+ log("SharedArrayBuffers are not enabled -- skipping test."); |
+ if (window.testRunner) |
+ testRunner.notifyDone(); |
+} |
+ |
+</script> |
+</body> |
+</html> |
+ |