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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 /**
     5  * Tests if draw calls inside a single animation frame generate and retrieve
     6  * the correct thumbnails.
     7  */
     9 function ifTestingSupported() {
    10   let [target, debuggee, front] = yield initCanavsDebuggerBackend(SIMPLE_CANVAS_URL);
    12   let navigated = once(target, "navigate");
    14   yield front.setup({ reload: true });
    15   ok(true, "The front was setup up successfully.");
    17   yield navigated;
    18   ok(true, "Target automatically navigated when the front was set up.");
    20   let snapshotActor = yield front.recordAnimationFrame();
    21   ok(snapshotActor,
    22     "A snapshot actor was sent after recording.");
    24   let animationOverview = yield snapshotActor.getOverview();
    25   ok(snapshotActor,
    26     "An animation overview could be retrieved after recording.");
    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.");
    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.");
    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.");
    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.");
    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.");
    78   yield removeTab(target.tab);
    79   finish();
    80 }

mercurial