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

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

Issue 2508943003: Make OffscreenCanvas resizeable (Closed)
Patch Set: Created 4 years, 1 month 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/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script> 5 <script src="../../resources/testharnessreport.js"></script>
6 </head> 6 </head>
7 <body> 7 <body>
8 <script> 8 <script>
9 function createCanvas(width, height) { 9 function createCanvas(width, height) {
10 var canvas = document.createElement("canvas"); 10 var canvas = document.createElement("canvas");
(...skipping 26 matching lines...) Expand all
37 }, "transferControlToOffscreen from a canvas with context throws an exceptio n"); 37 }, "transferControlToOffscreen from a canvas with context throws an exceptio n");
38 38
39 var canvas2b = createCanvas(10, 10); 39 var canvas2b = createCanvas(10, 10);
40 var offscreenCanvas2b = canvas2b.transferControlToOffscreen(); 40 var offscreenCanvas2b = canvas2b.transferControlToOffscreen();
41 assert_throws("InvalidStateError", function() { 41 assert_throws("InvalidStateError", function() {
42 var anotherOffscreenCanvas = canvas2b.transferControlToOffscreen(); 42 var anotherOffscreenCanvas = canvas2b.transferControlToOffscreen();
43 }, "canvas.transferControlToOffscreen() is not allowed to called more than o nce for the same canvas."); 43 }, "canvas.transferControlToOffscreen() is not allowed to called more than o nce for the same canvas.");
44 }, "Tests whether transferControlToOffscreen throws exception correctly."); 44 }, "Tests whether transferControlToOffscreen throws exception correctly.");
45 45
46 test(function() { 46 test(function() {
47 var canvas3 = createCanvas(10, 10);
48 var offscreenCanvas3 = canvas3.transferControlToOffscreen();
49 assert_equals(offscreenCanvas3.width, 10);
50 assert_equals(offscreenCanvas3.height, 10);
51 assert_throws("InvalidStateError", function() { offscreenCanvas3.width = 20; });
52 assert_throws("InvalidStateError", function() { offscreenCanvas3.height = 20 ; });
53 }, "Test if resizing on offscreencanvas transferred from html canvas has thrown exceptions.");
54
55 test(function() {
56 var canvas4 = createCanvas(10, 10); 47 var canvas4 = createCanvas(10, 10);
57 var offscreenCanvas4 = canvas4.transferControlToOffscreen(); 48 var offscreenCanvas4 = canvas4.transferControlToOffscreen();
58 assert_throws("InvalidStateError", function() { 49 assert_throws("InvalidStateError", function() {
59 canvas4.getContext("2d"); 50 canvas4.getContext("2d");
60 }, "canvas.getContext() is not allowed after transferring control to offscre en."); 51 }, "canvas.getContext() is not allowed after transferring control to offscre en.");
61 assert_throws("InvalidStateError", function() { 52 assert_throws("InvalidStateError", function() {
62 canvas4.height = 20; 53 canvas4.height = 20;
63 }, "canvas resizing height is not allowed after transferring control to offs creen."); 54 }, "canvas resizing height is not allowed after transferring control to offs creen.");
64 assert_throws("InvalidStateError", function() { 55 assert_throws("InvalidStateError", function() {
65 canvas4.width = 20; 56 canvas4.width = 20;
66 }, "canvas resizing width is not allowed after transferring control to offsc reen."); 57 }, "canvas resizing width is not allowed after transferring control to offsc reen.");
67 }, "Test if modifying canvas after it transfers controls to offscreen throw exce ptions"); 58 }, "Test if modifying canvas after it transfers controls to offscreen throw exce ptions");
68 59
69 </script> 60 </script>
70 </body> 61 </body>
71 </html> 62 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698