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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-commit-frameless-doc.html

Issue 2644653003: Make OffscreenCanvas animation in sync with its placeholder canvas's parent frame rate (Closed)
Patch Set: No Mojo for frameless canvas 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
(Empty)
1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 <script>
5 // This test aims to ensure that OffscreenCanvas.commit() does not
xlai (Olivia) 2017/01/24 20:54:12 Changing the pixel test to layout test.
6 // crash for a placeholder canvas under frameless document.
7 // Since the document is invisible, the resultant image should be
8 // not visible too. But users must be able to draw to the OffscreenCanvas
9 // and do canvas-operations on the frameless placeholder canvas.
10 // TODO(crbug.com/683172): Modify this test after handling for
11 // frameless canvas is done.
12 function createFramelessCanvas() {
13 var framelessDoc = document.implementation.createHTMLDocument("frameless");
14 var canvas = framelessDoc.createElement("canvas");
15 canvas.width = 50;
16 canvas.height = 50;
17 return canvas;
18 }
19
20 function transferControlAndCommit(canvas) {
21 var offscreenCanvas = canvas.transferControlToOffscreen();
22 var ctx = offscreenCanvas.getContext("2d");
23 ctx.fillStyle = "blue";
24 ctx.fillRect(0, 0, 50, 50);
25 ctx.commit();
26 return offscreenCanvas;
27 }
28
29 test(function() {
30 var offscreenCanvas = transferControlAndCommit(createFramelessCanvas());
31 var ctx = offscreenCanvas.getContext("2d");
32 var pixels = ctx.getImageData(0, 0, 1, 1).data;
33 assert_array_equals(pixels, [0, 0, 255, 255]);
34 }, "Verify that the getImageData() works on the OffscreenCanvas context of a fra meless canvas");
35
36 async_test(function(t) {
37 var canvas = createFramelessCanvas();
38 var offscreenCanvas = transferControlAndCommit(canvas);
39
40 var c = document.createElement("canvas");
41 c.width = 50;
42 c.height = 50;
43 var ctx2 = c.getContext("2d");
44 setTimeout(function() {
45 ctx2.drawImage(canvas, 0, 0);
46 var pixels = ctx2.getImageData(0, 0, 1, 1).data;
47 t.step(function() {
48 assert_array_equals(pixels, [0, 0, 255, 255]);
49 });
50 t.done();
51 }, 0);
52 }, "Verify that the placeholder canvas can be used as an image source");
53 </script>
OLDNEW
« no previous file with comments | « content/test/gpu/gpu_tests/pixel_test_pages.py ('k') | third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698