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.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 /**
     5  * Tests if filtering the items in the call list works properly.
     6  */
     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");
    13   yield reload(target);
    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]);
    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.");
    25   searchbox.focus();
    26   EventUtils.sendString("clear", window);
    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.");
    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.");
    46   let secondRecordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
    47   let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
    49   SnapshotsListView._onRecordButtonClick();
    50   yield secondRecordingFinished;
    52   SnapshotsListView.selectedIndex = 1;
    53   yield callListPopulated;
    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.");
    60   for (let i = 0; i < 5; i++) {
    61     searchbox.focus();
    62     EventUtils.sendKey("BACK_SPACE", window);
    63   }
    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.");
    70   yield teardown(panel);
    71   finish();
    72 }

mercurial