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.

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

mercurial