Wed, 31 Dec 2014 06:09:35 +0100
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 a function call's stack can be shown/hidden by double-clicking
6 * on a function call item.
7 */
9 function ifTestingSupported() {
10 let [target, debuggee, panel] = yield initCanavsDebuggerFrontend(SIMPLE_CANVAS_DEEP_STACK_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 SnapshotsListView._onRecordButtonClick();
18 yield promise.all([recordingFinished, callListPopulated]);
20 let callItem = CallsListView.getItemAtIndex(2);
21 let view = $(".call-item-view", callItem.target);
22 let contents = $(".call-item-contents", callItem.target);
24 is(view.hasAttribute("call-stack-populated"), false,
25 "The call item's view should not have the stack populated yet.");
26 is(view.hasAttribute("call-stack-expanded"), false,
27 "The call item's view should not have the stack populated yet.");
28 is($(".call-item-stack", callItem.target), null,
29 "There should be no stack container available yet for the draw call.");
31 let callStackDisplayed = once(window, EVENTS.CALL_STACK_DISPLAYED);
32 EventUtils.sendMouseEvent({ type: "dblclick" }, contents, window);
33 yield callStackDisplayed;
35 is(view.hasAttribute("call-stack-populated"), true,
36 "The call item's view should have the stack populated now.");
37 is(view.getAttribute("call-stack-expanded"), "true",
38 "The call item's view should have the stack expanded now.");
39 isnot($(".call-item-stack", callItem.target), null,
40 "There should be a stack container available now for the draw call.");
41 is($(".call-item-stack", callItem.target).hidden, false,
42 "The stack container should now be visible.");
43 is($all(".call-item-stack-fn", callItem.target).length, 4,
44 "There should be 4 functions on the stack for the draw call.");
46 EventUtils.sendMouseEvent({ type: "dblclick" }, contents, window);
48 is(view.hasAttribute("call-stack-populated"), true,
49 "The call item's view should still have the stack populated.");
50 is(view.getAttribute("call-stack-expanded"), "false",
51 "The call item's view should not have the stack expanded anymore.");
52 isnot($(".call-item-stack", callItem.target), null,
53 "There should still be a stack container available for the draw call.");
54 is($(".call-item-stack", callItem.target).hidden, true,
55 "The stack container should now be hidden.");
56 is($all(".call-item-stack-fn", callItem.target).length, 4,
57 "There should still be 4 functions on the stack for the draw call.");
59 yield teardown(panel);
60 finish();
61 }