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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext2D-in-worker.html

Issue 1748163003: Add rendering context and rendering 2D context to OffscreenCanvas (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove CanvasRenderingContextBase Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698