browser/devtools/canvasdebugger/test/browser_canvas-frontend-img-thumbnails-02.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 thumbnails are correctly linked with other UI elements like
michael@0 6 * function call items and their respective screenshots.
michael@0 7 */
michael@0 8
michael@0 9 function ifTestingSupported() {
michael@0 10 let [target, debuggee, panel] = yield initCanavsDebuggerFrontend(SIMPLE_CANVAS_URL);
michael@0 11 let { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
michael@0 12
michael@0 13 yield reload(target);
michael@0 14
michael@0 15 let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
michael@0 16 let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
michael@0 17 let thumbnailsDisplayed = once(window, EVENTS.THUMBNAILS_DISPLAYED);
michael@0 18 let screenshotDisplayed = once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
michael@0 19 SnapshotsListView._onRecordButtonClick();
michael@0 20 yield promise.all([
michael@0 21 recordingFinished,
michael@0 22 callListPopulated,
michael@0 23 thumbnailsDisplayed,
michael@0 24 screenshotDisplayed
michael@0 25 ]);
michael@0 26
michael@0 27 is($all(".filmstrip-thumbnail[highlighted]").length, 0,
michael@0 28 "There should be no highlighted thumbnail available yet.");
michael@0 29 is(CallsListView.selectedIndex, -1,
michael@0 30 "There should be no selected item in the calls list view.");
michael@0 31
michael@0 32 EventUtils.sendMouseEvent({ type: "mousedown" }, $all(".filmstrip-thumbnail")[0], window);
michael@0 33 yield once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
michael@0 34 info("The first draw call was selected, by clicking the first thumbnail.");
michael@0 35
michael@0 36 isnot($(".filmstrip-thumbnail[highlighted][index='0']"), null,
michael@0 37 "There should be a highlighted thumbnail available now, for the first draw call.");
michael@0 38 is($all(".filmstrip-thumbnail[highlighted]").length, 1,
michael@0 39 "There should be only one highlighted thumbnail available now.");
michael@0 40 is(CallsListView.selectedIndex, 0,
michael@0 41 "The first draw call should be selected in the calls list view.");
michael@0 42
michael@0 43 EventUtils.sendMouseEvent({ type: "mousedown" }, $all(".call-item-view")[1], window);
michael@0 44 yield once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
michael@0 45 info("The second context call was selected, by clicking the second call item.");
michael@0 46
michael@0 47 isnot($(".filmstrip-thumbnail[highlighted][index='0']"), null,
michael@0 48 "There should be a highlighted thumbnail available, for the first draw call.");
michael@0 49 is($all(".filmstrip-thumbnail[highlighted]").length, 1,
michael@0 50 "There should be only one highlighted thumbnail available.");
michael@0 51 is(CallsListView.selectedIndex, 1,
michael@0 52 "The second draw call should be selected in the calls list view.");
michael@0 53
michael@0 54 EventUtils.sendMouseEvent({ type: "mousedown" }, $all(".call-item-view")[2], window);
michael@0 55 yield once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
michael@0 56 info("The second draw call was selected, by clicking the third call item.");
michael@0 57
michael@0 58 isnot($(".filmstrip-thumbnail[highlighted][index='2']"), null,
michael@0 59 "There should be a highlighted thumbnail available, for the second draw call.");
michael@0 60 is($all(".filmstrip-thumbnail[highlighted]").length, 1,
michael@0 61 "There should be only one highlighted thumbnail available.");
michael@0 62 is(CallsListView.selectedIndex, 2,
michael@0 63 "The second draw call should be selected in the calls list view.");
michael@0 64
michael@0 65 yield teardown(panel);
michael@0 66 finish();
michael@0 67 }

mercurial