mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1146239 - Show the recording as loading in the performance sidebar after it has stopped; r=jsantell
This commit is contained in:
parent
b3aeb0a897
commit
596c132024
@ -63,6 +63,7 @@ support-files =
|
||||
[browser_perf-jit-view-02.js]
|
||||
[browser_perf-jit-model-01.js]
|
||||
[browser_perf-jit-model-02.js]
|
||||
[browser_perf-loading-01.js]
|
||||
[browser_perf-options-01.js]
|
||||
[browser_perf-options-02.js]
|
||||
[browser_perf-options-invert-call-tree-01.js]
|
||||
|
52
browser/devtools/performance/test/browser_perf-loading-01.js
Normal file
52
browser/devtools/performance/test/browser_perf-loading-01.js
Normal file
@ -0,0 +1,52 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Tests that the recordings view shows the right label while recording, after
|
||||
* recording, and once the record has loaded.
|
||||
*/
|
||||
|
||||
let test = Task.async(function*() {
|
||||
let { target, panel, toolbox } = yield initPerformance(SIMPLE_URL);
|
||||
let { RecordingsView, PerformanceController, PerformanceView,
|
||||
EVENTS, $, L10N, ViewHelpers } = panel.panelWin;
|
||||
|
||||
// This should be removed with bug 1163763.
|
||||
let DBG_STRINGS_URI = "chrome://browser/locale/devtools/debugger.properties";
|
||||
let DBG_L10N = new ViewHelpers.L10N(DBG_STRINGS_URI);
|
||||
|
||||
info("Start to record");
|
||||
yield startRecording(panel);
|
||||
let durationNode = $(".recording-item-duration",
|
||||
RecordingsView.selectedItem.target);
|
||||
|
||||
is(durationNode.getAttribute("value"),
|
||||
L10N.getStr("recordingsList.recordingLabel"),
|
||||
"The duration node should show the 'recording' message while recording");
|
||||
|
||||
info("Stop the recording and wait for the WILL_STOP and STOPPED events");
|
||||
let clicked = PerformanceView.once(EVENTS.UI_STOP_RECORDING);
|
||||
let willStop = PerformanceController.once(EVENTS.RECORDING_WILL_STOP);
|
||||
let hasStopped = PerformanceController.once(EVENTS.RECORDING_STOPPED);
|
||||
|
||||
click(panel.panelWin, $("#main-record-button"));
|
||||
yield clicked;
|
||||
yield willStop;
|
||||
|
||||
is(durationNode.getAttribute("value"),
|
||||
DBG_L10N.getStr("loadingText"),
|
||||
"The duration node should show the 'loading' message while stopping");
|
||||
|
||||
let stateChanged = once(PerformanceView, EVENTS.UI_STATE_CHANGED);
|
||||
yield hasStopped;
|
||||
yield stateChanged;
|
||||
|
||||
let duration = RecordingsView.selectedItem.attachment.getDuration().toFixed(0);
|
||||
is(durationNode.getAttribute("value"),
|
||||
L10N.getFormatStr("recordingsList.durationLabel", duration),
|
||||
"The duration node should show the duration after the record has stopped");
|
||||
|
||||
yield PerformanceController.clearRecordings();
|
||||
yield teardown(panel);
|
||||
finish();
|
||||
});
|
@ -3,6 +3,10 @@
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
// This should be removed with bug 1163763.
|
||||
const DBG_STRINGS_URI = "chrome://browser/locale/devtools/debugger.properties";
|
||||
const DBG_L10N = new ViewHelpers.L10N(DBG_STRINGS_URI);
|
||||
|
||||
/**
|
||||
* Functions handling the recordings UI.
|
||||
*/
|
||||
@ -16,6 +20,7 @@ let RecordingsView = Heritage.extend(WidgetMethods, {
|
||||
this._onSelect = this._onSelect.bind(this);
|
||||
this._onRecordingStarted = this._onRecordingStarted.bind(this);
|
||||
this._onRecordingStopped = this._onRecordingStopped.bind(this);
|
||||
this._onRecordingWillStop = this._onRecordingWillStop.bind(this);
|
||||
this._onRecordingImported = this._onRecordingImported.bind(this);
|
||||
this._onSaveButtonClick = this._onSaveButtonClick.bind(this);
|
||||
this._onRecordingsCleared = this._onRecordingsCleared.bind(this);
|
||||
@ -24,6 +29,7 @@ let RecordingsView = Heritage.extend(WidgetMethods, {
|
||||
|
||||
PerformanceController.on(EVENTS.RECORDING_STARTED, this._onRecordingStarted);
|
||||
PerformanceController.on(EVENTS.RECORDING_STOPPED, this._onRecordingStopped);
|
||||
PerformanceController.on(EVENTS.RECORDING_WILL_STOP, this._onRecordingWillStop);
|
||||
PerformanceController.on(EVENTS.RECORDING_IMPORTED, this._onRecordingImported);
|
||||
PerformanceController.on(EVENTS.RECORDINGS_CLEARED, this._onRecordingsCleared);
|
||||
this.widget.addEventListener("select", this._onSelect, false);
|
||||
@ -35,6 +41,7 @@ let RecordingsView = Heritage.extend(WidgetMethods, {
|
||||
destroy: function() {
|
||||
PerformanceController.off(EVENTS.RECORDING_STARTED, this._onRecordingStarted);
|
||||
PerformanceController.off(EVENTS.RECORDING_STOPPED, this._onRecordingStopped);
|
||||
PerformanceController.off(EVENTS.RECORDING_WILL_STOP, this._onRecordingWillStop);
|
||||
PerformanceController.off(EVENTS.RECORDING_IMPORTED, this._onRecordingImported);
|
||||
PerformanceController.off(EVENTS.RECORDINGS_CLEARED, this._onRecordingsCleared);
|
||||
this.widget.removeEventListener("select", this._onSelect, false);
|
||||
@ -132,6 +139,21 @@ let RecordingsView = Heritage.extend(WidgetMethods, {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Signals that a recording session is ending, and hasn't finished being
|
||||
* processed yet.
|
||||
*
|
||||
* @param RecordingModel recording
|
||||
* The model of the recording that is being stopped.
|
||||
*/
|
||||
_onRecordingWillStop: function(_, recording) {
|
||||
let recordingItem = this.getItemForPredicate(e => e.attachment === recording);
|
||||
|
||||
// Mark the corresponding item as loading.
|
||||
let durationNode = $(".recording-item-duration", recordingItem.target);
|
||||
durationNode.setAttribute("value", DBG_L10N.getStr("loadingText"));
|
||||
},
|
||||
|
||||
/**
|
||||
* Signals that a recording has been imported.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user