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

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

Issue 2271593002: Convert OffscreenCanvas-getContext tests to testharness. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed test as per the comments. Created 4 years, 4 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-getContext-in-worker.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext-in-worker.html b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext-in-worker.html
index 0838947b67235c2df4c071f2d09305950eaeac58..40e6ded7143a58a984a024f1baae31d8fbfb093c 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext-in-worker.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext-in-worker.html
@@ -1,50 +1,7 @@
<!DOCTYPE html>
-<html>
-<script src="../../resources/js-test.js"></script>
-<body>
-<script id="myWorker" type="text/worker">
-self.onmessage = function(e) {
- var aCanvas = new OffscreenCanvas(50, 50);
- var bCanvas = new OffscreenCanvas(50, 50);
- try {
- var ctx1 = aCanvas.getContext('2d');
- var ctx2 = bCanvas.getContext('webgl');
- if (!(ctx1 instanceof OffscreenCanvasRenderingContext2D)) {
- self.postMessage("aCanvas.getContext('2d') returns " + ctx1);
- } else if (!(ctx2 instanceof WebGLRenderingContext)) {
- self.postMessage("bCanvas.getContext('webgl') returns " + ctx2);
- } else {
- self.postMessage("success");
- }
- } catch (e) {
- self.postMessage(e);
- }
-};
-</script>
-
+<title>Tests that the 2D and webgl context of OffscreenCanvas can be constructed on a worker thread.</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
<script>
-jsTestIsAsync = true;
-description("Tests that the 2D and webgl context of OffscreenCanvas can be constructed on a worker thread.");
-
-function makeWorker(script) {
- var blob = new Blob([script]);
- return new Worker(URL.createObjectURL(blob));
-}
-
-function handleMessageFromWorker(msg)
-{
- if (msg.data == "success") {
- testPassed("getContext('2d') and getContext('webgl') works on a worker thread");
- } else {
- testFailed(msg.data);
- }
- finishJSTest();
-}
-
-var worker = makeWorker(document.getElementById('myWorker').textContent);
-worker.addEventListener('message', handleMessageFromWorker);
-worker.postMessage("");
+fetch_tests_from_worker(new Worker("OffscreenCanvas-getContext-in-worker.js"));
</script>
-
-</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698