browser/devtools/canvasdebugger/test/browser_canvas-frontend-img-thumbnails-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 thumbnails are correctly linked with other UI elements like
     6  * function call items and their respective screenshots.
     7  */
     9 function ifTestingSupported() {
    10   let [target, debuggee, panel] = yield initCanavsDebuggerFrontend(SIMPLE_CANVAS_URL);
    11   let { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
    13   yield reload(target);
    15   let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
    16   let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
    17   let thumbnailsDisplayed = once(window, EVENTS.THUMBNAILS_DISPLAYED);
    18   let screenshotDisplayed = once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
    19   SnapshotsListView._onRecordButtonClick();
    20   yield promise.all([
    21     recordingFinished,
    22     callListPopulated,
    23     thumbnailsDisplayed,
    24     screenshotDisplayed
    25   ]);
    27   is($all(".filmstrip-thumbnail[highlighted]").length, 0,
    28     "There should be no highlighted thumbnail available yet.");
    29   is(CallsListView.selectedIndex, -1,
    30     "There should be no selected item in the calls list view.");
    32   EventUtils.sendMouseEvent({ type: "mousedown" }, $all(".filmstrip-thumbnail")[0], window);
    33   yield once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
    34   info("The first draw call was selected, by clicking the first thumbnail.");
    36   isnot($(".filmstrip-thumbnail[highlighted][index='0']"), null,
    37     "There should be a highlighted thumbnail available now, for the first draw call.");
    38   is($all(".filmstrip-thumbnail[highlighted]").length, 1,
    39     "There should be only one highlighted thumbnail available now.");
    40   is(CallsListView.selectedIndex, 0,
    41     "The first draw call should be selected in the calls list view.");
    43   EventUtils.sendMouseEvent({ type: "mousedown" }, $all(".call-item-view")[1], window);
    44   yield once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
    45   info("The second context call was selected, by clicking the second call item.");
    47   isnot($(".filmstrip-thumbnail[highlighted][index='0']"), null,
    48     "There should be a highlighted thumbnail available, for the first draw call.");
    49   is($all(".filmstrip-thumbnail[highlighted]").length, 1,
    50     "There should be only one highlighted thumbnail available.");
    51   is(CallsListView.selectedIndex, 1,
    52     "The second draw call should be selected in the calls list view.");
    54   EventUtils.sendMouseEvent({ type: "mousedown" }, $all(".call-item-view")[2], window);
    55   yield once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
    56   info("The second draw call was selected, by clicking the third call item.");
    58   isnot($(".filmstrip-thumbnail[highlighted][index='2']"), null,
    59     "There should be a highlighted thumbnail available, for the second draw call.");
    60   is($all(".filmstrip-thumbnail[highlighted]").length, 1,
    61     "There should be only one highlighted thumbnail available.");
    62   is(CallsListView.selectedIndex, 2,
    63     "The second draw call should be selected in the calls list view.");
    65   yield teardown(panel);
    66   finish();
    67 }

mercurial