browser/devtools/canvasdebugger/test/browser_canvas-frontend-record-02.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:d288a4e961a2
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 /**
5 * Tests whether the frontend displays a placeholder snapshot while recording.
6 */
7
8 function ifTestingSupported() {
9 let [target, debuggee, panel] = yield initCanavsDebuggerFrontend(SIMPLE_CANVAS_URL);
10 let { window, EVENTS, L10N, $, SnapshotsListView } = panel.panelWin;
11
12 yield reload(target);
13
14 let recordingStarted = once(window, EVENTS.SNAPSHOT_RECORDING_STARTED);
15 let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
16 let recordingSelected = once(window, EVENTS.SNAPSHOT_RECORDING_SELECTED);
17 SnapshotsListView._onRecordButtonClick();
18
19 yield recordingStarted;
20 ok(true, "Started recording a snapshot of the animation loop.");
21
22 let item = SnapshotsListView.getItemAtIndex(0);
23
24 is($(".snapshot-item-title", item.target).getAttribute("value"),
25 L10N.getFormatStr("snapshotsList.itemLabel", 1),
26 "The placeholder item's title label is correct.");
27
28 is($(".snapshot-item-calls", item.target).getAttribute("value"),
29 L10N.getStr("snapshotsList.loadingLabel"),
30 "The placeholder item's calls label is correct.");
31
32 is($(".snapshot-item-save", item.target).getAttribute("value"), "",
33 "The placeholder item's save label should not have a value yet.");
34
35 is($("#reload-notice").getAttribute("hidden"), "true",
36 "The reload notice should now be hidden.");
37 is($("#empty-notice").getAttribute("hidden"), "true",
38 "The empty notice should now be hidden.");
39 is($("#import-notice").hasAttribute("hidden"), false,
40 "The import notice should now be visible.");
41
42 is($("#screenshot-container").getAttribute("hidden"), "true",
43 "The screenshot container should still be hidden.");
44 is($("#snapshot-filmstrip").getAttribute("hidden"), "true",
45 "The snapshot filmstrip should still be hidden.");
46
47 is($("#debugging-pane-contents").getAttribute("hidden"), "true",
48 "The rest of the UI should still be hidden.");
49
50 yield recordingFinished;
51 ok(true, "Finished recording a snapshot of the animation loop.");
52
53 yield recordingSelected;
54 ok(true, "Finished selecting a snapshot of the animation loop.");
55
56 is($("#reload-notice").getAttribute("hidden"), "true",
57 "The reload notice should now be hidden.");
58 is($("#empty-notice").getAttribute("hidden"), "true",
59 "The empty notice should now be hidden.");
60 is($("#import-notice").getAttribute("hidden"), "true",
61 "The import notice should now be hidden.");
62
63 is($("#screenshot-container").hasAttribute("hidden"), false,
64 "The screenshot container should now be visible.");
65 is($("#snapshot-filmstrip").hasAttribute("hidden"), false,
66 "The snapshot filmstrip should now be visible.");
67
68 is($("#debugging-pane-contents").hasAttribute("hidden"), false,
69 "The rest of the UI should now be visible.");
70
71 yield teardown(panel);
72 finish();
73 }

mercurial