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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext.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.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext.html b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext.html
index 786b1c89c3794f7a128aa61f9b27fb4c2554e7b5..872cb626f43f43e1470237ea25bfc9a8abc7143c 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext.html
@@ -1,38 +1,36 @@
<!DOCTYPE html>
-<script src="../../resources/js-test.js"></script>
+<title>Tests basic functionalities of OffscreenCanvas.getContext on the main thread.</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
<script>
-description("Tests basic functionalities of offscreenCanvas.getContext on the main thread");
+test(function() {
+ // Tests constructor of OffscreenCanvas and height/width change.
+ var aCanvas = new OffscreenCanvas(40, 60);
+ assert_equals(aCanvas.width, 40);
+ assert_equals(aCanvas.height, 60);
-// Tests onstructor of OffscreenCanvas and length/width change
-var aCanvas = new OffscreenCanvas(40, 60);
-shouldBe("aCanvas.width", "40");
-shouldBe("aCanvas.height", "60");
+ aCanvas.width = 110;
+ aCanvas.height = 90;
+ assert_equals(aCanvas.width, 110);
+ assert_equals(aCanvas.height, 90);
-aCanvas.width = 110;
-aCanvas.height = 90;
-shouldBe("aCanvas.width", "110");
-shouldBe("aCanvas.height", "90");
+ aCanvas.width = 0; // Zero dimension is allowed.
+ assert_equals(aCanvas.width, 0);
-aCanvas.width = 0; // Zero dimension is allowed
-shouldBe("aCanvas.width", "0");
+ // Tests object type of getContext('2d').
+ var ctx = aCanvas.getContext('2d');
+ assert_true(ctx instanceof OffscreenCanvasRenderingContext2D);
+ // Calling getContext on a different context type will return null.
+ var ctx2 = aCanvas.getContext("webgl");
+ assert_equals(ctx2, null);
-// Tests object type of getContext('2d')
-var ctx;
-shouldNotThrow("ctx = aCanvas.getContext('2d')");
-shouldBeType("ctx", "OffscreenCanvasRenderingContext2D");
+ // Calling getContext on the same context type will return the original context type.
+ var ctx3 = aCanvas.getContext("2d");
+ assert_not_equals(ctx3, null);
+ assert_equals(ctx3, ctx);
-// Calling getContext on a different context type will return null
-var ctx2 = aCanvas.getContext("webgl");
-shouldBeNull("ctx2");
-
-// Calling getContext on the same context type will return the original context type
-var ctx3 = aCanvas.getContext("2d");
-shouldBeNonNull("ctx3");
-shouldBeTrue("ctx3 == ctx");
-
-// TODO: change the below part of the test when webgl is supported.
-// Calling getContext on an unimplemented context type will return null
-var bCanvas = new OffscreenCanvas(20, 20);
-var ctx4 = bCanvas.getContext("webgl");
-shouldBeType("ctx4", "WebGLRenderingContext");
+ var bCanvas = new OffscreenCanvas(20, 20);
+ var ctx4 = bCanvas.getContext("webgl");
+ assert_true(ctx4 instanceof WebGLRenderingContext);
+});
</script>

Powered by Google App Engine
This is Rietveld 408576698