browser/devtools/canvasdebugger/test/browser_canvas-frontend-reload-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 that the frontend UI is properly reconfigured after reloading.
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, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
michael@0 11
michael@0 12 is(SnapshotsListView.itemCount, 0,
michael@0 13 "There should be no snapshots initially displayed in the UI.");
michael@0 14 is(CallsListView.itemCount, 0,
michael@0 15 "There should be no function calls initially displayed in the UI.");
michael@0 16
michael@0 17 is($("#screenshot-container").hidden, true,
michael@0 18 "The screenshot should not be initially displayed in the UI.");
michael@0 19 is($("#snapshot-filmstrip").hidden, true,
michael@0 20 "There should be no thumbnails initially displayed in the UI (1).");
michael@0 21 is($all(".filmstrip-thumbnail").length, 0,
michael@0 22 "There should be no thumbnails initially displayed in the UI (2).");
michael@0 23
michael@0 24 yield reload(target);
michael@0 25
michael@0 26 let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
michael@0 27 let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
michael@0 28 let thumbnailsDisplayed = once(window, EVENTS.THUMBNAILS_DISPLAYED);
michael@0 29 let screenshotDisplayed = once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
michael@0 30 SnapshotsListView._onRecordButtonClick();
michael@0 31 yield promise.all([
michael@0 32 recordingFinished,
michael@0 33 callListPopulated,
michael@0 34 thumbnailsDisplayed,
michael@0 35 screenshotDisplayed
michael@0 36 ]);
michael@0 37
michael@0 38 is(SnapshotsListView.itemCount, 1,
michael@0 39 "There should be one snapshot displayed in the UI.");
michael@0 40 is(CallsListView.itemCount, 8,
michael@0 41 "All the function calls should now be displayed in the UI.");
michael@0 42
michael@0 43 is($("#screenshot-container").hidden, false,
michael@0 44 "The screenshot should now be displayed in the UI.");
michael@0 45 is($("#snapshot-filmstrip").hidden, false,
michael@0 46 "All the thumbnails should now be displayed in the UI (1).");
michael@0 47 is($all(".filmstrip-thumbnail").length, 4,
michael@0 48 "All the thumbnails should now be displayed in the UI (2).");
michael@0 49
michael@0 50 let reset = once(window, EVENTS.UI_RESET);
michael@0 51 let navigated = reload(target);
michael@0 52
michael@0 53 yield reset;
michael@0 54 ok(true, "The UI was reset after the refresh button was clicked.");
michael@0 55
michael@0 56 is(SnapshotsListView.itemCount, 0,
michael@0 57 "There should be no snapshots displayed in the UI after navigating.");
michael@0 58 is(CallsListView.itemCount, 0,
michael@0 59 "There should be no function calls displayed in the UI after navigating.");
michael@0 60 is($("#snapshot-filmstrip").hidden, true,
michael@0 61 "There should be no thumbnails displayed in the UI after navigating.");
michael@0 62 is($("#screenshot-container").hidden, true,
michael@0 63 "The screenshot should not be displayed in the UI after navigating.");
michael@0 64
michael@0 65 yield navigated;
michael@0 66 ok(true, "The target finished reloading.");
michael@0 67
michael@0 68 yield teardown(panel);
michael@0 69 finish();
michael@0 70 }

mercurial