browser/devtools/canvasdebugger/test/browser_canvas-frontend-img-thumbnails-02.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:841e825d52a4
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 /**
5 * Tests if thumbnails are correctly linked with other UI elements like
6 * function call items and their respective screenshots.
7 */
8
9 function ifTestingSupported() {
10 let [target, debuggee, panel] = yield initCanavsDebuggerFrontend(SIMPLE_CANVAS_URL);
11 let { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
12
13 yield reload(target);
14
15 let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
16 let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
17 let thumbnailsDisplayed = once(window, EVENTS.THUMBNAILS_DISPLAYED);
18 let screenshotDisplayed = once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
19 SnapshotsListView._onRecordButtonClick();
20 yield promise.all([
21 recordingFinished,
22 callListPopulated,
23 thumbnailsDisplayed,
24 screenshotDisplayed
25 ]);
26
27 is($all(".filmstrip-thumbnail[highlighted]").length, 0,
28 "There should be no highlighted thumbnail available yet.");
29 is(CallsListView.selectedIndex, -1,
30 "There should be no selected item in the calls list view.");
31
32 EventUtils.sendMouseEvent({ type: "mousedown" }, $all(".filmstrip-thumbnail")[0], window);
33 yield once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
34 info("The first draw call was selected, by clicking the first thumbnail.");
35
36 isnot($(".filmstrip-thumbnail[highlighted][index='0']"), null,
37 "There should be a highlighted thumbnail available now, for the first draw call.");
38 is($all(".filmstrip-thumbnail[highlighted]").length, 1,
39 "There should be only one highlighted thumbnail available now.");
40 is(CallsListView.selectedIndex, 0,
41 "The first draw call should be selected in the calls list view.");
42
43 EventUtils.sendMouseEvent({ type: "mousedown" }, $all(".call-item-view")[1], window);
44 yield once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
45 info("The second context call was selected, by clicking the second call item.");
46
47 isnot($(".filmstrip-thumbnail[highlighted][index='0']"), null,
48 "There should be a highlighted thumbnail available, for the first draw call.");
49 is($all(".filmstrip-thumbnail[highlighted]").length, 1,
50 "There should be only one highlighted thumbnail available.");
51 is(CallsListView.selectedIndex, 1,
52 "The second draw call should be selected in the calls list view.");
53
54 EventUtils.sendMouseEvent({ type: "mousedown" }, $all(".call-item-view")[2], window);
55 yield once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
56 info("The second draw call was selected, by clicking the third call item.");
57
58 isnot($(".filmstrip-thumbnail[highlighted][index='2']"), null,
59 "There should be a highlighted thumbnail available, for the second draw call.");
60 is($all(".filmstrip-thumbnail[highlighted]").length, 1,
61 "There should be only one highlighted thumbnail available.");
62 is(CallsListView.selectedIndex, 2,
63 "The second draw call should be selected in the calls list view.");
64
65 yield teardown(panel);
66 finish();
67 }

mercurial