browser/devtools/canvasdebugger/test/browser_canvas-frontend-call-search.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 filtering the items in the call list works properly.
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 let searchbox = $("#calls-searchbox");
michael@0 12
michael@0 13 yield reload(target);
michael@0 14
michael@0 15 let firstRecordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
michael@0 16 let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
michael@0 17 SnapshotsListView._onRecordButtonClick();
michael@0 18 yield promise.all([firstRecordingFinished, callListPopulated]);
michael@0 19
michael@0 20 is(searchbox.value, "",
michael@0 21 "The searchbox should be initially empty.");
michael@0 22 is(CallsListView.visibleItems.length, 8,
michael@0 23 "All the items should be initially visible in the calls list.");
michael@0 24
michael@0 25 searchbox.focus();
michael@0 26 EventUtils.sendString("clear", window);
michael@0 27
michael@0 28 is(searchbox.value, "clear",
michael@0 29 "The searchbox should now contain the 'clear' string.");
michael@0 30 is(CallsListView.visibleItems.length, 1,
michael@0 31 "Only one item should now be visible in the calls list.");
michael@0 32
michael@0 33 is(CallsListView.visibleItems[0].attachment.actor.type, CallWatcherFront.METHOD_FUNCTION,
michael@0 34 "The visible item's type has the expected value.");
michael@0 35 is(CallsListView.visibleItems[0].attachment.actor.name, "clearRect",
michael@0 36 "The visible item's name has the expected value.");
michael@0 37 is(CallsListView.visibleItems[0].attachment.actor.file, SIMPLE_CANVAS_URL,
michael@0 38 "The visible item's file has the expected value.");
michael@0 39 is(CallsListView.visibleItems[0].attachment.actor.line, 25,
michael@0 40 "The visible item's line has the expected value.");
michael@0 41 is(CallsListView.visibleItems[0].attachment.actor.argsPreview, "0, 0, 128, 128",
michael@0 42 "The visible item's args have the expected value.");
michael@0 43 is(CallsListView.visibleItems[0].attachment.actor.callerPreview, "ctx",
michael@0 44 "The visible item's caller has the expected value.");
michael@0 45
michael@0 46 let secondRecordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
michael@0 47 let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
michael@0 48
michael@0 49 SnapshotsListView._onRecordButtonClick();
michael@0 50 yield secondRecordingFinished;
michael@0 51
michael@0 52 SnapshotsListView.selectedIndex = 1;
michael@0 53 yield callListPopulated;
michael@0 54
michael@0 55 is(searchbox.value, "clear",
michael@0 56 "The searchbox should still contain the 'clear' string.");
michael@0 57 is(CallsListView.visibleItems.length, 1,
michael@0 58 "Only one item should still be visible in the calls list.");
michael@0 59
michael@0 60 for (let i = 0; i < 5; i++) {
michael@0 61 searchbox.focus();
michael@0 62 EventUtils.sendKey("BACK_SPACE", window);
michael@0 63 }
michael@0 64
michael@0 65 is(searchbox.value, "",
michael@0 66 "The searchbox should now be emptied.");
michael@0 67 is(CallsListView.visibleItems.length, 8,
michael@0 68 "All the items should be initially visible again in the calls list.");
michael@0 69
michael@0 70 yield teardown(panel);
michael@0 71 finish();
michael@0 72 }

mercurial