browser/devtools/canvasdebugger/test/browser_canvas-frontend-record-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 whether the frontend displays a placeholder snapshot while recording.
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, L10N, $, SnapshotsListView } = panel.panelWin;
michael@0 11
michael@0 12 yield reload(target);
michael@0 13
michael@0 14 let recordingStarted = once(window, EVENTS.SNAPSHOT_RECORDING_STARTED);
michael@0 15 let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
michael@0 16 let recordingSelected = once(window, EVENTS.SNAPSHOT_RECORDING_SELECTED);
michael@0 17 SnapshotsListView._onRecordButtonClick();
michael@0 18
michael@0 19 yield recordingStarted;
michael@0 20 ok(true, "Started recording a snapshot of the animation loop.");
michael@0 21
michael@0 22 let item = SnapshotsListView.getItemAtIndex(0);
michael@0 23
michael@0 24 is($(".snapshot-item-title", item.target).getAttribute("value"),
michael@0 25 L10N.getFormatStr("snapshotsList.itemLabel", 1),
michael@0 26 "The placeholder item's title label is correct.");
michael@0 27
michael@0 28 is($(".snapshot-item-calls", item.target).getAttribute("value"),
michael@0 29 L10N.getStr("snapshotsList.loadingLabel"),
michael@0 30 "The placeholder item's calls label is correct.");
michael@0 31
michael@0 32 is($(".snapshot-item-save", item.target).getAttribute("value"), "",
michael@0 33 "The placeholder item's save label should not have a value yet.");
michael@0 34
michael@0 35 is($("#reload-notice").getAttribute("hidden"), "true",
michael@0 36 "The reload notice should now be hidden.");
michael@0 37 is($("#empty-notice").getAttribute("hidden"), "true",
michael@0 38 "The empty notice should now be hidden.");
michael@0 39 is($("#import-notice").hasAttribute("hidden"), false,
michael@0 40 "The import notice should now be visible.");
michael@0 41
michael@0 42 is($("#screenshot-container").getAttribute("hidden"), "true",
michael@0 43 "The screenshot container should still be hidden.");
michael@0 44 is($("#snapshot-filmstrip").getAttribute("hidden"), "true",
michael@0 45 "The snapshot filmstrip should still be hidden.");
michael@0 46
michael@0 47 is($("#debugging-pane-contents").getAttribute("hidden"), "true",
michael@0 48 "The rest of the UI should still be hidden.");
michael@0 49
michael@0 50 yield recordingFinished;
michael@0 51 ok(true, "Finished recording a snapshot of the animation loop.");
michael@0 52
michael@0 53 yield recordingSelected;
michael@0 54 ok(true, "Finished selecting a snapshot of the animation loop.");
michael@0 55
michael@0 56 is($("#reload-notice").getAttribute("hidden"), "true",
michael@0 57 "The reload notice should now be hidden.");
michael@0 58 is($("#empty-notice").getAttribute("hidden"), "true",
michael@0 59 "The empty notice should now be hidden.");
michael@0 60 is($("#import-notice").getAttribute("hidden"), "true",
michael@0 61 "The import notice should now be hidden.");
michael@0 62
michael@0 63 is($("#screenshot-container").hasAttribute("hidden"), false,
michael@0 64 "The screenshot container should now be visible.");
michael@0 65 is($("#snapshot-filmstrip").hasAttribute("hidden"), false,
michael@0 66 "The snapshot filmstrip should now be visible.");
michael@0 67
michael@0 68 is($("#debugging-pane-contents").hasAttribute("hidden"), false,
michael@0 69 "The rest of the UI should now be visible.");
michael@0 70
michael@0 71 yield teardown(panel);
michael@0 72 finish();
michael@0 73 }

mercurial