browser/devtools/canvasdebugger/test/browser_canvas-frontend-stepping.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 the stepping buttons in the call list toolbar work as advertised.
     6  */
     8 function ifTestingSupported() {
     9   let [target, debuggee, panel] = yield initCanavsDebuggerFrontend(SIMPLE_CANVAS_URL);
    10   let { window, $, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
    12   yield reload(target);
    14   let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
    15   let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
    16   SnapshotsListView._onRecordButtonClick();
    17   yield promise.all([recordingFinished, callListPopulated]);
    19   checkSteppingButtons(1, 1, 1, 1);
    20   is(CallsListView.selectedIndex, -1,
    21     "There should be no selected item in the calls list view initially.");
    23   CallsListView._onResume();
    24   checkSteppingButtons(1, 1, 1, 1);
    25   is(CallsListView.selectedIndex, 0,
    26     "The first draw call should now be selected.");
    28   CallsListView._onResume();
    29   checkSteppingButtons(1, 1, 1, 1);
    30   is(CallsListView.selectedIndex, 2,
    31     "The second draw call should now be selected.");
    33   CallsListView._onStepOver();
    34   checkSteppingButtons(1, 1, 1, 1);
    35   is(CallsListView.selectedIndex, 3,
    36     "The next context call should now be selected.");
    38   CallsListView._onStepOut();
    39   checkSteppingButtons(0, 0, 1, 0);
    40   is(CallsListView.selectedIndex, 7,
    41     "The last context call should now be selected.");
    43   function checkSteppingButtons(resume, stepOver, stepIn, stepOut) {
    44     if (!resume) {
    45       is($("#resume").getAttribute("disabled"), "true",
    46         "The resume button doesn't have the expected disabled state.");
    47     } else {
    48       is($("#resume").hasAttribute("disabled"), false,
    49         "The resume button doesn't have the expected enabled state.");
    50     }
    51     if (!stepOver) {
    52       is($("#step-over").getAttribute("disabled"), "true",
    53         "The stepOver button doesn't have the expected disabled state.");
    54     } else {
    55       is($("#step-over").hasAttribute("disabled"), false,
    56         "The stepOver button doesn't have the expected enabled state.");
    57     }
    58     if (!stepIn) {
    59       is($("#step-in").getAttribute("disabled"), "true",
    60         "The stepIn button doesn't have the expected disabled state.");
    61     } else {
    62       is($("#step-in").hasAttribute("disabled"), false,
    63         "The stepIn button doesn't have the expected enabled state.");
    64     }
    65     if (!stepOut) {
    66       is($("#step-out").getAttribute("disabled"), "true",
    67         "The stepOut button doesn't have the expected disabled state.");
    68     } else {
    69       is($("#step-out").hasAttribute("disabled"), false,
    70         "The stepOut button doesn't have the expected enabled state.");
    71     }
    72   }
    74   yield teardown(panel);
    75   finish();
    76 }

mercurial