browser/devtools/canvasdebugger/test/browser_canvas-frontend-call-search.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:de96e271fb28
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 /**
5 * Tests if filtering the items in the call list works properly.
6 */
7
8 function ifTestingSupported() {
9 let [target, debuggee, panel] = yield initCanavsDebuggerFrontend(SIMPLE_CANVAS_URL);
10 let { window, $, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
11 let searchbox = $("#calls-searchbox");
12
13 yield reload(target);
14
15 let firstRecordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
16 let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
17 SnapshotsListView._onRecordButtonClick();
18 yield promise.all([firstRecordingFinished, callListPopulated]);
19
20 is(searchbox.value, "",
21 "The searchbox should be initially empty.");
22 is(CallsListView.visibleItems.length, 8,
23 "All the items should be initially visible in the calls list.");
24
25 searchbox.focus();
26 EventUtils.sendString("clear", window);
27
28 is(searchbox.value, "clear",
29 "The searchbox should now contain the 'clear' string.");
30 is(CallsListView.visibleItems.length, 1,
31 "Only one item should now be visible in the calls list.");
32
33 is(CallsListView.visibleItems[0].attachment.actor.type, CallWatcherFront.METHOD_FUNCTION,
34 "The visible item's type has the expected value.");
35 is(CallsListView.visibleItems[0].attachment.actor.name, "clearRect",
36 "The visible item's name has the expected value.");
37 is(CallsListView.visibleItems[0].attachment.actor.file, SIMPLE_CANVAS_URL,
38 "The visible item's file has the expected value.");
39 is(CallsListView.visibleItems[0].attachment.actor.line, 25,
40 "The visible item's line has the expected value.");
41 is(CallsListView.visibleItems[0].attachment.actor.argsPreview, "0, 0, 128, 128",
42 "The visible item's args have the expected value.");
43 is(CallsListView.visibleItems[0].attachment.actor.callerPreview, "ctx",
44 "The visible item's caller has the expected value.");
45
46 let secondRecordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
47 let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
48
49 SnapshotsListView._onRecordButtonClick();
50 yield secondRecordingFinished;
51
52 SnapshotsListView.selectedIndex = 1;
53 yield callListPopulated;
54
55 is(searchbox.value, "clear",
56 "The searchbox should still contain the 'clear' string.");
57 is(CallsListView.visibleItems.length, 1,
58 "Only one item should still be visible in the calls list.");
59
60 for (let i = 0; i < 5; i++) {
61 searchbox.focus();
62 EventUtils.sendKey("BACK_SPACE", window);
63 }
64
65 is(searchbox.value, "",
66 "The searchbox should now be emptied.");
67 is(CallsListView.visibleItems.length, 8,
68 "All the items should be initially visible again in the calls list.");
69
70 yield teardown(panel);
71 finish();
72 }

mercurial