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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-invalid-args.html

Issue 2264953003: Use testharness.js instead of js-test.js in OffscreenCanvas tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change attribute to plural. 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-invalid-args.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-invalid-args.html b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-invalid-args.html
index a0171befeb0f1c8f8c43ba37f5fef4d520e79f71..2f3b36e1a8366e6e439b973cf1c86a226aab0990 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-invalid-args.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-invalid-args.html
@@ -1,40 +1,39 @@
<!DOCTYPE html>
-<script src="../../resources/js-test.js"></script>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<title>Tests that the OffscreenCanvas can handle invalid arguments</title>
<script>
-description("Tests that the OffscreenCanvas can handle invalid arguments");
-
-// Since blink uses signed int internally, this case tests how the constructor
-// responds to the arguments that are larger than INT_MAX which would cause
-// overflow. The current implementation is expected to clamp.
-var setWidth = Math.pow(2, 31);
-var setHeight = Math.pow(2, 31);
-var obj = {Name: "John Doe", Age: 30};
-
-var canvas1 = new OffscreenCanvas(setWidth, setHeight);
-shouldBe("canvas1.width", "setWidth-1");
-shouldBe("canvas1.height", "setHeight-1");
-
-canvas1.width = null;
-canvas1.height = null;
-shouldBe("canvas1.width", "0");
-shouldBe("canvas1.height", "0");
-
-shouldThrow("new OffscreenCanvas(-1, -1)");
-
-var canvas2 = new OffscreenCanvas(null, null);
-shouldBe("canvas2.width", "0");
-shouldBe("canvas2.height", "0");
-
-canvas2.width = setWidth;
-canvas2.height = setHeight;
-shouldBe("canvas2.width", "setWidth-1");
-shouldBe("canvas2.height", "setHeight-1");
-
-shouldThrow("canvas2.width = -1");
-shouldThrow("canvas2.height = -1");
-
-shouldThrow("canvas2.width = obj");
-shouldThrow("canvas2.height = obj");
-
-shouldThrow("new OffscreenCanvas(obj, obj)");
+test(function() {
+ // Since blink uses signed int internally, this case tests how the constructor
+ // responds to the arguments that are larger than INT_MAX which would cause
+ // overflow. The current implementation is expected to clamp.
+ var setWidth = Math.pow(2, 31);
+ var setHeight = Math.pow(2, 31);
+ var obj = {Name: "John Doe", Age: 30};
+
+ var canvas1 = new OffscreenCanvas(setWidth, setHeight);
+ assert_equals(canvas1.width, setWidth-1);
+ assert_equals(canvas1.height, setHeight-1);
+ canvas1.width = null;
+ canvas1.height = null;
+ assert_equals(canvas1.width, 0);
+ assert_equals(canvas1.height, 0);
+
+ assert_throws(new TypeError(), function() { new OffscreenCanvas(-1, -1); });
+
+ var canvas2 = new OffscreenCanvas(null, null);
+ assert_equals(canvas2.width, 0);
+ assert_equals(canvas2.height, 0);
+ canvas2.width = setWidth;
+ canvas2.height = setHeight;
+
+ assert_equals(canvas2.width, setWidth-1);
+ assert_equals(canvas2.height, setHeight-1);
+
+ assert_throws(new TypeError(), function() { canvas2.width = -1; });
+ assert_throws(new TypeError(), function() { canvas2.height = -1; });
+ assert_throws(new TypeError(), function() { canvas2.width = obj; });
+ assert_throws(new TypeError(), function() { canvas2.height = obj; });
+ assert_throws(new TypeError(), function() { new OffscreenCanvas(obj, obj); });
+});
</script>

Powered by Google App Engine
This is Rietveld 408576698