|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 /** |
|
5 * Tests if the stepping buttons in the call list toolbar work as advertised. |
|
6 */ |
|
7 |
|
8 function ifTestingSupported() { |
|
9 let [target, debuggee, panel] = yield initCanavsDebuggerFrontend(SIMPLE_CANVAS_URL); |
|
10 let { window, $, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin; |
|
11 |
|
12 yield reload(target); |
|
13 |
|
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]); |
|
18 |
|
19 checkSteppingButtons(1, 1, 1, 1); |
|
20 is(CallsListView.selectedIndex, -1, |
|
21 "There should be no selected item in the calls list view initially."); |
|
22 |
|
23 CallsListView._onResume(); |
|
24 checkSteppingButtons(1, 1, 1, 1); |
|
25 is(CallsListView.selectedIndex, 0, |
|
26 "The first draw call should now be selected."); |
|
27 |
|
28 CallsListView._onResume(); |
|
29 checkSteppingButtons(1, 1, 1, 1); |
|
30 is(CallsListView.selectedIndex, 2, |
|
31 "The second draw call should now be selected."); |
|
32 |
|
33 CallsListView._onStepOver(); |
|
34 checkSteppingButtons(1, 1, 1, 1); |
|
35 is(CallsListView.selectedIndex, 3, |
|
36 "The next context call should now be selected."); |
|
37 |
|
38 CallsListView._onStepOut(); |
|
39 checkSteppingButtons(0, 0, 1, 0); |
|
40 is(CallsListView.selectedIndex, 7, |
|
41 "The last context call should now be selected."); |
|
42 |
|
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 } |
|
73 |
|
74 yield teardown(panel); |
|
75 finish(); |
|
76 } |