browser/devtools/canvasdebugger/test/browser_canvas-actor-test-04.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:96fa87f2f932
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 /**
5 * Tests if draw calls inside a single animation frame generate and retrieve
6 * the correct thumbnails.
7 */
8
9 function ifTestingSupported() {
10 let [target, debuggee, front] = yield initCanavsDebuggerBackend(SIMPLE_CANVAS_URL);
11
12 let navigated = once(target, "navigate");
13
14 yield front.setup({ reload: true });
15 ok(true, "The front was setup up successfully.");
16
17 yield navigated;
18 ok(true, "Target automatically navigated when the front was set up.");
19
20 let snapshotActor = yield front.recordAnimationFrame();
21 ok(snapshotActor,
22 "A snapshot actor was sent after recording.");
23
24 let animationOverview = yield snapshotActor.getOverview();
25 ok(snapshotActor,
26 "An animation overview could be retrieved after recording.");
27
28 let thumbnails = animationOverview.thumbnails;
29 ok(thumbnails,
30 "An array of thumbnails was sent after recording.");
31 is(thumbnails.length, 4,
32 "The number of thumbnails is correct.");
33
34 is(thumbnails[0].index, 0,
35 "The first thumbnail's index is correct.");
36 is(thumbnails[0].width, 50,
37 "The first thumbnail's width is correct.");
38 is(thumbnails[0].height, 50,
39 "The first thumbnail's height is correct.");
40 is(thumbnails[0].flipped, false,
41 "The first thumbnail's flipped flag is correct.");
42 is([].find.call(thumbnails[0].pixels, e => e > 0), undefined,
43 "The first thumbnail's pixels seem to be completely transparent.");
44
45 is(thumbnails[1].index, 2,
46 "The second thumbnail's index is correct.");
47 is(thumbnails[1].width, 50,
48 "The second thumbnail's width is correct.");
49 is(thumbnails[1].height, 50,
50 "The second thumbnail's height is correct.");
51 is(thumbnails[1].flipped, false,
52 "The second thumbnail's flipped flag is correct.");
53 is([].find.call(thumbnails[1].pixels, e => e > 0), 4290822336,
54 "The second thumbnail's pixels seem to not be completely transparent.");
55
56 is(thumbnails[2].index, 4,
57 "The third thumbnail's index is correct.");
58 is(thumbnails[2].width, 50,
59 "The third thumbnail's width is correct.");
60 is(thumbnails[2].height, 50,
61 "The third thumbnail's height is correct.");
62 is(thumbnails[2].flipped, false,
63 "The third thumbnail's flipped flag is correct.");
64 is([].find.call(thumbnails[2].pixels, e => e > 0), 4290822336,
65 "The third thumbnail's pixels seem to not be completely transparent.");
66
67 is(thumbnails[3].index, 6,
68 "The fourth thumbnail's index is correct.");
69 is(thumbnails[3].width, 50,
70 "The fourth thumbnail's width is correct.");
71 is(thumbnails[3].height, 50,
72 "The fourth thumbnail's height is correct.");
73 is(thumbnails[3].flipped, false,
74 "The fourth thumbnail's flipped flag is correct.");
75 is([].find.call(thumbnails[3].pixels, e => e > 0), 4290822336,
76 "The fourth thumbnail's pixels seem to not be completely transparent.");
77
78 yield removeTab(target.tab);
79 finish();
80 }

mercurial