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

Side by Side Diff: LayoutTests/fast/canvas/canvas-lose-restore-googol-size.html

Issue 1350883002: Fix bug where setting canvas size to 0 was treated as if context was lost (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix layout test Created 5 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/canvas/bug532148-expected.html ('k') | Source/core/html/HTMLCanvasElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/js-test.js"></script> 4 <script src="../../resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <script> 7 <script>
8 description("Tests to ensure correct behaviour of canvas loss and restoration wh en size is extremely large then, restored to a reasonable value."); 8 description("Tests to ensure correct behaviour of canvas loss and restoration wh en size is extremely large then, restored to a reasonable value.");
9 9
10 if (window.testRunner) { 10 if (window.testRunner) {
11 testRunner.dumpAsText(); 11 testRunner.dumpAsText();
12 testRunner.waitUntilDone(); 12 testRunner.waitUntilDone();
13 } 13 }
14 14
15 var canvas = document.createElement('canvas') 15 var canvas = document.createElement('canvas')
16 canvas.addEventListener('contextlost', contextLost); 16 canvas.addEventListener('contextlost', contextLost);
17 canvas.addEventListener('contextrestored', contextRestored); 17 canvas.addEventListener('contextrestored', contextRestored);
18 var ctx = canvas.getContext('2d'); 18 var ctx = canvas.getContext('2d');
19 var lostEventHasFired = false; 19 var lostEventHasFired = false;
20 verifyContextLost(false); 20 verifyContextLost(false);
21 21
22 var googol = Math.pow(10,100); 22 var bigsize = 1000000000;
23 canvas.width = googol; 23 canvas.width = bigsize;
24 canvas.height = googol; 24 canvas.height = bigsize;
25 verifyContextLost(true); 25 verifyContextLost(true);
26 canvas.width = googol; 26 canvas.width = bigsize;
27 verifyContextLost(true); 27 verifyContextLost(true);
28 canvas.width = 100; 28 canvas.width = 100;
29 canvas.height = 100; 29 canvas.height = 100;
30 verifyContextLost(true); // Restoration is async. 30 verifyContextLost(true); // Restoration is async.
31 31
32 // Restore a sane dimension 32 // Restore a sane dimension
33 33
34 function verifyContextLost(shouldBeLost) { 34 function verifyContextLost(shouldBeLost) {
35 // Verify context loss experimentally as well as isContextLost() 35 // Verify context loss experimentally as well as isContextLost()
36 ctx.fillStyle = '#0f0'; 36 ctx.fillStyle = '#0f0';
(...skipping 25 matching lines...) Expand all
62 testFailed('Context restored event was dispatched before a context lost event.'); 62 testFailed('Context restored event was dispatched before a context lost event.');
63 } 63 }
64 verifyContextLost(false); 64 verifyContextLost(false);
65 if (window.testRunner) { 65 if (window.testRunner) {
66 testRunner.notifyDone(); 66 testRunner.notifyDone();
67 } 67 }
68 } 68 }
69 </script> 69 </script>
70 </body> 70 </body>
71 </html> 71 </html>
OLDNEW
« no previous file with comments | « LayoutTests/fast/canvas/bug532148-expected.html ('k') | Source/core/html/HTMLCanvasElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698