browser/devtools/canvasdebugger/test/browser_canvas-actor-test-03.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 functions inside a single animation frame are recorded and stored
     6  * for a canvas context.
     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 functionCalls = animationOverview.calls;
    29   ok(functionCalls,
    30     "An array of function call actors was sent after recording.");
    31   is(functionCalls.length, 8,
    32     "The number of function call actors is correct.");
    34   is(functionCalls[0].type, CallWatcherFront.METHOD_FUNCTION,
    35     "The first called function is correctly identified as a method.");
    36   is(functionCalls[0].name, "clearRect",
    37     "The first called function's name is correct.");
    38   is(functionCalls[0].file, SIMPLE_CANVAS_URL,
    39     "The first called function's file is correct.");
    40   is(functionCalls[0].line, 25,
    41     "The first called function's line is correct.");
    42   is(functionCalls[0].argsPreview, "0, 0, 128, 128",
    43     "The first called function's args preview is correct.");
    44   is(functionCalls[0].callerPreview, "ctx",
    45     "The first called function's caller preview is correct.");
    47   is(functionCalls[6].type, CallWatcherFront.METHOD_FUNCTION,
    48     "The penultimate called function is correctly identified as a method.");
    49   is(functionCalls[6].name, "fillRect",
    50     "The penultimate called function's name is correct.");
    51   is(functionCalls[6].file, SIMPLE_CANVAS_URL,
    52     "The penultimate called function's file is correct.");
    53   is(functionCalls[6].line, 21,
    54     "The penultimate called function's line is correct.");
    55   is(functionCalls[6].argsPreview, "10, 10, 55, 50",
    56     "The penultimate called function's args preview is correct.");
    57   is(functionCalls[6].callerPreview, "ctx",
    58     "The penultimate called function's caller preview is correct.");
    60   is(functionCalls[7].type, CallWatcherFront.METHOD_FUNCTION,
    61     "The last called function is correctly identified as a method.");
    62   is(functionCalls[7].name, "requestAnimationFrame",
    63     "The last called function's name is correct.");
    64   is(functionCalls[7].file, SIMPLE_CANVAS_URL,
    65     "The last called function's file is correct.");
    66   is(functionCalls[7].line, 30,
    67     "The last called function's line is correct.");
    68   ok(functionCalls[7].argsPreview.contains("Function"),
    69     "The last called function's args preview is correct.");
    70   is(functionCalls[7].callerPreview, "",
    71     "The last called function's caller preview is correct.");
    73   yield removeTab(target.tab);
    74   finish();
    75 }

mercurial