browser/devtools/canvasdebugger/test/browser_canvas-actor-test-02.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 calls are recorded and stored for a canvas context,
     6  * and that their stack is successfully retrieved.
     7  */
     9 function ifTestingSupported() {
    10   let [target, debuggee, front] = yield initCallWatcherBackend(SIMPLE_CANVAS_URL);
    12   let navigated = once(target, "navigate");
    14   yield front.setup({
    15     tracedGlobals: ["CanvasRenderingContext2D", "WebGLRenderingContext"],
    16     startRecording: true,
    17     performReload: true
    18   });
    19   ok(true, "The front was setup up successfully.");
    21   yield navigated;
    22   ok(true, "Target automatically navigated when the front was set up.");
    24   // Allow the content to execute some functions.
    25   yield waitForTick();
    27   let functionCalls = yield front.pauseRecording();
    28   ok(functionCalls,
    29     "An array of function call actors was sent after reloading.");
    30   ok(functionCalls.length > 0,
    31     "There's at least one function call actor available.");
    33   is(functionCalls[0].type, CallWatcherFront.METHOD_FUNCTION,
    34     "The called function is correctly identified as a method.");
    35   is(functionCalls[0].name, "clearRect",
    36     "The called function's name is correct.");
    37   is(functionCalls[0].file, SIMPLE_CANVAS_URL,
    38     "The called function's file is correct.");
    39   is(functionCalls[0].line, 25,
    40     "The called function's line is correct.");
    42   is(functionCalls[0].callerPreview, "ctx",
    43     "The called function's caller preview is correct.");
    44   is(functionCalls[0].argsPreview, "0, 0, 128, 128",
    45     "The called function's args preview is correct.");
    47   let details = yield functionCalls[1].getDetails();
    48   ok(details,
    49     "The first called function has some details available.")
    51   is(details.stack.length, 3,
    52     "The called function's stack depth is correct.");
    54   is(details.stack[0].name, "fillStyle",
    55     "The called function's stack is correct (1.1).");
    56   is(details.stack[0].file, SIMPLE_CANVAS_URL,
    57     "The called function's stack is correct (1.2).");
    58   is(details.stack[0].line, 20,
    59     "The called function's stack is correct (1.3).");
    61   is(details.stack[1].name, "drawRect",
    62     "The called function's stack is correct (2.1).");
    63   is(details.stack[1].file, SIMPLE_CANVAS_URL,
    64     "The called function's stack is correct (2.2).");
    65   is(details.stack[1].line, 26,
    66     "The called function's stack is correct (2.3).");
    68   is(details.stack[2].name, "drawScene",
    69     "The called function's stack is correct (3.1).");
    70   is(details.stack[2].file, SIMPLE_CANVAS_URL,
    71     "The called function's stack is correct (3.2).");
    72   is(details.stack[2].line, 33,
    73     "The called function's stack is correct (3.3).");
    75   yield removeTab(target.tab);
    76   finish();
    77 }

mercurial