Index: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext2D.html |
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext2D.html b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext2D.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..cf564fb8f0197de5f89a0d3ca837fc762c63ece3 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext2D.html |
@@ -0,0 +1,34 @@ |
+<!DOCTYPE html> |
+<script src="../../resources/js-test.js"></script> |
+<script> |
+description("Tests basic functionalities of offscreenCanvas.getContext on the main thread"); |
+ |
+// Tests onstructor of OffscreenCanvas and length/width change |
+var aCanvas = new OffscreenCanvas(50, 50); |
Justin Novosad
2016/03/07 15:30:26
Not new to this CL, but you should also test the e
|
+shouldBe("aCanvas.width", "50"); |
+shouldBe("aCanvas.height", "50"); |
+ |
+aCanvas.width = 100; |
+aCanvas.height = 100; |
+shouldBe("aCanvas.width", "100"); |
+shouldBe("aCanvas.height", "100"); |
+ |
+// Tests object type of getContext('2d') |
+var ctx; |
+shouldNotThrow("ctx = aCanvas.getContext('2d')"); |
+shouldBeType("ctx", "OffscreenCanvasRenderingContext2D"); |
+ |
+// Calling getContext on a different context type will return null |
+var ctx2 = aCanvas.getContext("webgl"); |
+shouldBeNull("ctx2"); |
Justin Novosad
2016/03/07 15:30:26
This is good, because this test will still be corr
|
+ |
+// Calling getContext on the same context type will return the original context type |
+var ctx3 = aCanvas.getContext("2d"); |
+shouldBeNonNull("ctx3"); |
+shouldBeTrue("ctx3 == ctx"); |
+ |
+// Calling getContext on an unimplemented context type will return null |
+var bCanvas = new OffscreenCanvas(20, 20); |
+var ctx4 = bCanvas.getContext("webgl"); |
Justin Novosad
2016/03/07 15:30:26
This test will break the day we support WebGL, mig
|
+shouldBeNull("ctx4"); |
+</script> |