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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/canvasdebugger/test/browser_canvas-actor-test-04.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,80 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +/**
     1.8 + * Tests if draw calls inside a single animation frame generate and retrieve
     1.9 + * the correct thumbnails.
    1.10 + */
    1.11 +
    1.12 +function ifTestingSupported() {
    1.13 +  let [target, debuggee, front] = yield initCanavsDebuggerBackend(SIMPLE_CANVAS_URL);
    1.14 +
    1.15 +  let navigated = once(target, "navigate");
    1.16 +
    1.17 +  yield front.setup({ reload: true });
    1.18 +  ok(true, "The front was setup up successfully.");
    1.19 +
    1.20 +  yield navigated;
    1.21 +  ok(true, "Target automatically navigated when the front was set up.");
    1.22 +
    1.23 +  let snapshotActor = yield front.recordAnimationFrame();
    1.24 +  ok(snapshotActor,
    1.25 +    "A snapshot actor was sent after recording.");
    1.26 +
    1.27 +  let animationOverview = yield snapshotActor.getOverview();
    1.28 +  ok(snapshotActor,
    1.29 +    "An animation overview could be retrieved after recording.");
    1.30 +
    1.31 +  let thumbnails = animationOverview.thumbnails;
    1.32 +  ok(thumbnails,
    1.33 +    "An array of thumbnails was sent after recording.");
    1.34 +  is(thumbnails.length, 4,
    1.35 +    "The number of thumbnails is correct.");
    1.36 +
    1.37 +  is(thumbnails[0].index, 0,
    1.38 +    "The first thumbnail's index is correct.");
    1.39 +  is(thumbnails[0].width, 50,
    1.40 +    "The first thumbnail's width is correct.");
    1.41 +  is(thumbnails[0].height, 50,
    1.42 +    "The first thumbnail's height is correct.");
    1.43 +  is(thumbnails[0].flipped, false,
    1.44 +    "The first thumbnail's flipped flag is correct.");
    1.45 +  is([].find.call(thumbnails[0].pixels, e => e > 0), undefined,
    1.46 +    "The first thumbnail's pixels seem to be completely transparent.");
    1.47 +
    1.48 +  is(thumbnails[1].index, 2,
    1.49 +    "The second thumbnail's index is correct.");
    1.50 +  is(thumbnails[1].width, 50,
    1.51 +    "The second thumbnail's width is correct.");
    1.52 +  is(thumbnails[1].height, 50,
    1.53 +    "The second thumbnail's height is correct.");
    1.54 +  is(thumbnails[1].flipped, false,
    1.55 +    "The second thumbnail's flipped flag is correct.");
    1.56 +  is([].find.call(thumbnails[1].pixels, e => e > 0), 4290822336,
    1.57 +    "The second thumbnail's pixels seem to not be completely transparent.");
    1.58 +
    1.59 +  is(thumbnails[2].index, 4,
    1.60 +    "The third thumbnail's index is correct.");
    1.61 +  is(thumbnails[2].width, 50,
    1.62 +    "The third thumbnail's width is correct.");
    1.63 +  is(thumbnails[2].height, 50,
    1.64 +    "The third thumbnail's height is correct.");
    1.65 +  is(thumbnails[2].flipped, false,
    1.66 +    "The third thumbnail's flipped flag is correct.");
    1.67 +  is([].find.call(thumbnails[2].pixels, e => e > 0), 4290822336,
    1.68 +    "The third thumbnail's pixels seem to not be completely transparent.");
    1.69 +
    1.70 +  is(thumbnails[3].index, 6,
    1.71 +    "The fourth thumbnail's index is correct.");
    1.72 +  is(thumbnails[3].width, 50,
    1.73 +    "The fourth thumbnail's width is correct.");
    1.74 +  is(thumbnails[3].height, 50,
    1.75 +    "The fourth thumbnail's height is correct.");
    1.76 +  is(thumbnails[3].flipped, false,
    1.77 +    "The fourth thumbnail's flipped flag is correct.");
    1.78 +  is([].find.call(thumbnails[3].pixels, e => e > 0), 4290822336,
    1.79 +    "The fourth thumbnail's pixels seem to not be completely transparent.");
    1.80 +
    1.81 +  yield removeTab(target.tab);
    1.82 +  finish();
    1.83 +}

mercurial