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

Side by Side 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, 3 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script> 2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 <title>Tests that the OffscreenCanvas can handle invalid arguments</title>
3 <script> 5 <script>
4 description("Tests that the OffscreenCanvas can handle invalid arguments"); 6 test(function() {
7 // Since blink uses signed int internally, this case tests how the construct or
8 // responds to the arguments that are larger than INT_MAX which would cause
9 // overflow. The current implementation is expected to clamp.
10 var setWidth = Math.pow(2, 31);
11 var setHeight = Math.pow(2, 31);
12 var obj = {Name: "John Doe", Age: 30};
5 13
6 // Since blink uses signed int internally, this case tests how the constructor 14 var canvas1 = new OffscreenCanvas(setWidth, setHeight);
7 // responds to the arguments that are larger than INT_MAX which would cause 15 assert_equals(canvas1.width, setWidth-1);
8 // overflow. The current implementation is expected to clamp. 16 assert_equals(canvas1.height, setHeight-1);
9 var setWidth = Math.pow(2, 31); 17 canvas1.width = null;
10 var setHeight = Math.pow(2, 31); 18 canvas1.height = null;
11 var obj = {Name: "John Doe", Age: 30}; 19 assert_equals(canvas1.width, 0);
20 assert_equals(canvas1.height, 0);
12 21
13 var canvas1 = new OffscreenCanvas(setWidth, setHeight); 22 assert_throws(new TypeError(), function() { new OffscreenCanvas(-1, -1); });
14 shouldBe("canvas1.width", "setWidth-1");
15 shouldBe("canvas1.height", "setHeight-1");
16 23
17 canvas1.width = null; 24 var canvas2 = new OffscreenCanvas(null, null);
18 canvas1.height = null; 25 assert_equals(canvas2.width, 0);
19 shouldBe("canvas1.width", "0"); 26 assert_equals(canvas2.height, 0);
20 shouldBe("canvas1.height", "0"); 27 canvas2.width = setWidth;
28 canvas2.height = setHeight;
21 29
22 shouldThrow("new OffscreenCanvas(-1, -1)"); 30 assert_equals(canvas2.width, setWidth-1);
31 assert_equals(canvas2.height, setHeight-1);
23 32
24 var canvas2 = new OffscreenCanvas(null, null); 33 assert_throws(new TypeError(), function() { canvas2.width = -1; });
25 shouldBe("canvas2.width", "0"); 34 assert_throws(new TypeError(), function() { canvas2.height = -1; });
26 shouldBe("canvas2.height", "0"); 35 assert_throws(new TypeError(), function() { canvas2.width = obj; });
27 36 assert_throws(new TypeError(), function() { canvas2.height = obj; });
28 canvas2.width = setWidth; 37 assert_throws(new TypeError(), function() { new OffscreenCanvas(obj, obj); } );
29 canvas2.height = setHeight; 38 });
30 shouldBe("canvas2.width", "setWidth-1");
31 shouldBe("canvas2.height", "setHeight-1");
32
33 shouldThrow("canvas2.width = -1");
34 shouldThrow("canvas2.height = -1");
35
36 shouldThrow("canvas2.width = obj");
37 shouldThrow("canvas2.height = obj");
38
39 shouldThrow("new OffscreenCanvas(obj, obj)");
40 </script> 39 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698