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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferControlToOffscreen.html

Issue 2313533002: Revert of Submit Compositor Frame from OffscreenCanvas on main (Closed)
Patch Set: 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 PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/testharness.js"></script> 4 <script src="../../resources/js-test.js"></script>
5 <script src="../../resources/testharnessreport.js"></script>
6 </head> 5 </head>
7 <body> 6 <body>
8 <script> 7 <script>
8
9 description("Test transferControlToOffscreen.");
10 window.jsTestIsAsync = true;
11
9 function createCanvas(width, height) { 12 function createCanvas(width, height) {
10 var canvas = document.createElement("canvas"); 13 var canvas = document.createElement("canvas");
11 canvas.width = width; 14 canvas.width = width;
12 canvas.height = height; 15 canvas.height = height;
13 return canvas; 16 return canvas;
14 } 17 }
15 18
16 test(function() { 19 // Tests whether transferControlToOffscreen can be run correctly.
17 var width = 50; 20 var width = 50;
18 var height = 50; 21 var height = 50;
19 var canvas1 = createCanvas(width, height); 22 var canvas1 = createCanvas(width, height);
20 var offscreenCanvas1; 23 var offscreenCanvas1;
21 try { 24 try {
22 offscreenCanvas1 = canvas1.transferControlToOffscreen(); 25 offscreenCanvas1 = canvas1.transferControlToOffscreen();
23 assert_equals(offscreenCanvas1.width, width); 26 testPassed("Successfully created layer for offscreencanvas");
24 assert_equals(offscreenCanvas1.height, height); 27 shouldBe("offscreenCanvas1.width", "width");
25 } catch (ex) { 28 shouldBe("offscreenCanvas1.height", "height");
26 assert_false(ex.message); 29 } catch (ex) {
27 } 30 testFailed(ex.message);
28 }, "Tests whether transferControlToOffscreen can be run correctly."); 31 }
29 32
30 test(function() { 33 // Tests whether transferControlToOffscreen throws exception correctly.
31 var canvas2 = createCanvas(50, 50); 34 var canvas2 = createCanvas(50, 50);
32 var offscreenCanvas2; 35 var offscreenCanvas2;
33 var ctx = canvas2.getContext("2d"); 36 var ctx = canvas2.getContext("2d");
34 assert_throws("InvalidStateError", function() { 37 try {
35 offscreenCanvas2 = canvas2.transferControlToOffscreen(); 38 offscreenCanvas2 = canvas2.transferControlToOffscreen();
36 assert_false("transferControlToOffscreen from a canvas with context didn 't throw an exception."); 39 testFailed("transferControlToOffscreen from a canvas with context didn't thr ow an exception.");
37 }, "transferControlToOffscreen from a canvas with context throws an exceptio n"); 40 } catch (ex) {
38 }, "Tests whether transferControlToOffscreen throws exception correctly."); 41 testPassed("transferControlToOffscreen from a canvas with context throws an exception: " + ex);
42 }
39 43
40 test(function() { 44 finishJSTest();
41 var canvas3 = createCanvas(10, 10);
42 var offscreenCanvas3 = canvas3.transferControlToOffscreen();
43 assert_equals(offscreenCanvas3.width, 10);
44 assert_equals(offscreenCanvas3.height, 10);
45 offscreenCanvas3.width = 20;
46 offscreenCanvas3.height = 20;
47 assert_equals(offscreenCanvas3.width, 10);
48 assert_equals(offscreenCanvas3.height, 10);
49 }, "Test if resizing on offscreencanvas transferred from html canvas has no effe ct");
50
51 </script> 45 </script>
52 </body> 46 </body>
53 </html> 47 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698