browser/devtools/canvasdebugger/test/browser_canvas-frontend-record-01.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 whether the frontend behaves correctly while reording a snapshot.
     6  */
     8 function ifTestingSupported() {
     9   let [target, debuggee, panel] = yield initCanavsDebuggerFrontend(SIMPLE_CANVAS_URL);
    10   let { window, EVENTS, $, SnapshotsListView } = panel.panelWin;
    12   yield reload(target);
    14   is($("#record-snapshot").hasAttribute("checked"), false,
    15     "The 'record snapshot' button should initially be unchecked.");
    16   is($("#record-snapshot").hasAttribute("disabled"), false,
    17     "The 'record snapshot' button should initially be enabled.");
    18   is($("#record-snapshot").hasAttribute("hidden"), false,
    19     "The 'record snapshot' button should now be visible.");
    21   is(SnapshotsListView.itemCount, 0,
    22     "There should be no items available in the snapshots list view.");
    23   is(SnapshotsListView.selectedIndex, -1,
    24     "There should be no selected item in the snapshots list view.");
    26   let recordingStarted = once(window, EVENTS.SNAPSHOT_RECORDING_STARTED);
    27   let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
    28   SnapshotsListView._onRecordButtonClick();
    30   yield recordingStarted;
    31   ok(true, "Started recording a snapshot of the animation loop.");
    33   is($("#record-snapshot").getAttribute("checked"), "true",
    34     "The 'record snapshot' button should now be checked.");
    35   is($("#record-snapshot").getAttribute("disabled"), "true",
    36     "The 'record snapshot' button should now be disabled.");
    37   is($("#record-snapshot").hasAttribute("hidden"), false,
    38     "The 'record snapshot' button should still be visible.");
    40   is(SnapshotsListView.itemCount, 1,
    41     "There should be one item available in the snapshots list view now.");
    42   is(SnapshotsListView.selectedIndex, -1,
    43     "There should be no selected item in the snapshots list view yet.");
    45   yield recordingFinished;
    46   ok(true, "Finished recording a snapshot of the animation loop.");
    48   is($("#record-snapshot").hasAttribute("checked"), false,
    49     "The 'record snapshot' button should now be unchecked.");
    50   is($("#record-snapshot").hasAttribute("disabled"), false,
    51     "The 'record snapshot' button should now be re-enabled.");
    52   is($("#record-snapshot").hasAttribute("hidden"), false,
    53     "The 'record snapshot' button should still be visible.");
    55   is(SnapshotsListView.itemCount, 1,
    56     "There should still be only one item available in the snapshots list view.");
    57   is(SnapshotsListView.selectedIndex, 0,
    58     "There should be one selected item in the snapshots list view now.");
    60   yield teardown(panel);
    61   finish();
    62 }

mercurial