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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-after-detachment.html

Issue 2671853004: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: Corrections Created 3 years, 10 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 <script src="../../resources/testharness.js"></script>
2 <html> 2 <script src="../../resources/testharnessreport.js"></script>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <div id="parent"> 3 <div id="parent">
7 <canvas id="mycanvas" width="200" height="200"></canvas> 4 <canvas id="mycanvas" width="200" height="200"></canvas>
8 </div>
9 <script> 5 <script>
10 if (window.testRunner) { 6 test(function(t) {
11 testRunner.dumpAsText();
12 testRunner.waitUntilDone();
13 }
14
15 var data;
16 function runTest()
17 {
18 var parent = document.getElementById("parent"); 7 var parent = document.getElementById("parent");
19 var canvas = document.getElementById('mycanvas'); 8 var canvas = document.getElementById('mycanvas');
20 var ctx = canvas.getContext('2d'); 9 var ctx = canvas.getContext('2d');
21 ctx.fillStyle = 'red'; 10 ctx.fillStyle = 'red';
22 ctx.fillRect(0, 0, 200, 200); 11 ctx.fillRect(0, 0, 200, 200);
23 12
24 var imageData; 13 var imageData;
25 imageData = ctx.getImageData(100, 100, 1, 1); 14 imageData = ctx.getImageData(100, 100, 1, 1);
26 data = imageData.data; 15 var data = imageData.data;
27 shouldBe('data[0]', '255'); 16 assert_equals(data[0], 255);
28 shouldBe('data[1]', '0'); 17 assert_equals(data[1], 0);
29 shouldBe('data[2]', '0'); 18 assert_equals(data[2], 0);
30 19
31 parent.removeChild(canvas); 20 parent.removeChild(canvas);
32 // GC makes sure canvas element is removed. 21 // GC makes sure canvas element is removed.
33 if (window.GCController) 22 if (window.GCController)
34 GCController.collect(); 23 GCController.collect();
35 24
36 imageData = ctx.getImageData(100, 100, 1, 1); 25 imageData = ctx.getImageData(100, 100, 1, 1);
37 data = imageData.data; 26 data = imageData.data;
38 // The context is valid although the canvas is detached from document. 27 assert_equals(data[0], 255);
39 shouldBe('data[0]', '255'); 28 assert_equals(data[1], 0);
40 shouldBe('data[1]', '0'); 29 assert_equals(data[2], 0);
41 shouldBe('data[2]', '0'); 30 }, 'Test that the context is valid although the canvas is detached from document .');
42
43 if (window.testRunner)
44 testRunner.notifyDone();
45 }
46
47 runTest();
48 </script> 31 </script>
49 </body>
50 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698