michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Tests that the frontend UI is properly reconfigured after reloading. michael@0: */ michael@0: michael@0: function ifTestingSupported() { michael@0: let [target, debuggee, panel] = yield initCanavsDebuggerFrontend(SIMPLE_CANVAS_URL); michael@0: let { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin; michael@0: michael@0: is(SnapshotsListView.itemCount, 0, michael@0: "There should be no snapshots initially displayed in the UI."); michael@0: is(CallsListView.itemCount, 0, michael@0: "There should be no function calls initially displayed in the UI."); michael@0: michael@0: is($("#screenshot-container").hidden, true, michael@0: "The screenshot should not be initially displayed in the UI."); michael@0: is($("#snapshot-filmstrip").hidden, true, michael@0: "There should be no thumbnails initially displayed in the UI (1)."); michael@0: is($all(".filmstrip-thumbnail").length, 0, michael@0: "There should be no thumbnails initially displayed in the UI (2)."); michael@0: michael@0: yield reload(target); michael@0: michael@0: let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED); michael@0: let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED); michael@0: let thumbnailsDisplayed = once(window, EVENTS.THUMBNAILS_DISPLAYED); michael@0: let screenshotDisplayed = once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED); michael@0: SnapshotsListView._onRecordButtonClick(); michael@0: yield promise.all([ michael@0: recordingFinished, michael@0: callListPopulated, michael@0: thumbnailsDisplayed, michael@0: screenshotDisplayed michael@0: ]); michael@0: michael@0: is(SnapshotsListView.itemCount, 1, michael@0: "There should be one snapshot displayed in the UI."); michael@0: is(CallsListView.itemCount, 8, michael@0: "All the function calls should now be displayed in the UI."); michael@0: michael@0: is($("#screenshot-container").hidden, false, michael@0: "The screenshot should now be displayed in the UI."); michael@0: is($("#snapshot-filmstrip").hidden, false, michael@0: "All the thumbnails should now be displayed in the UI (1)."); michael@0: is($all(".filmstrip-thumbnail").length, 4, michael@0: "All the thumbnails should now be displayed in the UI (2)."); michael@0: michael@0: let reset = once(window, EVENTS.UI_RESET); michael@0: let navigated = reload(target); michael@0: michael@0: yield reset; michael@0: ok(true, "The UI was reset after the refresh button was clicked."); michael@0: michael@0: is(SnapshotsListView.itemCount, 0, michael@0: "There should be no snapshots displayed in the UI after navigating."); michael@0: is(CallsListView.itemCount, 0, michael@0: "There should be no function calls displayed in the UI after navigating."); michael@0: is($("#snapshot-filmstrip").hidden, true, michael@0: "There should be no thumbnails displayed in the UI after navigating."); michael@0: is($("#screenshot-container").hidden, true, michael@0: "The screenshot should not be displayed in the UI after navigating."); michael@0: michael@0: yield navigated; michael@0: ok(true, "The target finished reloading."); michael@0: michael@0: yield teardown(panel); michael@0: finish(); michael@0: }