Index: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext2D-in-worker.html |
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-constructor-in-worker.html b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext2D-in-worker.html |
similarity index 53% |
copy from third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-constructor-in-worker.html |
copy to third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext2D-in-worker.html |
index b87006d34ee0a8a45aa463d32a94ce20edd079f5..5d0c326866a772359de2c957dfe471fd8159715d 100644 |
--- a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-constructor-in-worker.html |
+++ b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext2D-in-worker.html |
@@ -5,20 +5,18 @@ |
<script id="myWorker" type="text/worker"> |
self.onmessage = function(e) { |
var aCanvas = new OffscreenCanvas(50, 50); |
- self.postMessage({version:'first', width:aCanvas.width, height:aCanvas.height}); |
- |
- aCanvas.width = 100; |
- aCanvas.height = 100; |
- self.postMessage({version:'second', width:aCanvas.width, height:aCanvas.height}); |
+ try { |
+ var ctx = aCanvas.getContext('2d'); |
+ self.postMessage({outcome:"success", errorMessage:""}); |
+ } catch (e) { |
+ self.postMessage({outcome:"error", errorMessage:e}); |
+ } |
}; |
</script> |
<script> |
jsTestIsAsync = true; |
-description("Tests that the OffscreenCanvas can be constructed on a worker thread."); |
- |
-var width; |
-var height; |
+description("Tests that the 2D context of OffscreenCanvas can be constructed on a worker thread."); |
function makeWorker(script) { |
var blob = new Blob([script]); |
@@ -26,22 +24,18 @@ function makeWorker(script) { |
} |
function handleMessageFromWorker(msg) { |
- width = msg.data.width; |
- height = msg.data.height; |
- switch (msg.data.version) { |
- case 'first': |
- shouldBe('width', '50'); |
- shouldBe('height', '50'); |
+ switch (msg.data.outcome) { |
+ case 'success': |
+ testPassed("getContext('2d') does not thrown."); |
break; |
- case 'second': |
- shouldBe('width', '100'); |
- shouldBe('height', '100'); |
- finishJSTest(); |
+ case 'error': |
+ testFailed(msg.data.errorMessage); |
break; |
default: |
testFailed("Unexpected failure"); |
break; |
} |
+ finishJSTest(); |
} |
var worker = makeWorker(document.getElementById('myWorker').textContent); |