Bug 1060885 - DevTools Profiler: Only uncheck the Record button once the recording has actually ended. r=vporof
authorSami Jaktholm <sjakthol@outlook.com>
Sun, 05 Oct 2014 12:30:00 +0200
changeset 212136 63decad50695bc398e49dac1243b9e107681bff7
parent 212135 52d7960cdb510d78766f7aa9151415b1ff032a23
child 212137 dfff6e9b01f66e643a5feef745750ba60b05bc58
push id27698
push usercbook@mozilla.com
push dateFri, 24 Oct 2014 13:53:50 +0000
treeherdermozilla-central@6e35802ae3e2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvporof
bugs1060885
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1060885 - DevTools Profiler: Only uncheck the Record button once the recording has actually ended. r=vporof
browser/devtools/profiler/test/browser.ini
browser/devtools/profiler/test/browser_profiler_recording-selected-03.js
browser/devtools/profiler/test/head.js
browser/devtools/profiler/ui-recordings.js
--- a/browser/devtools/profiler/test/browser.ini
+++ b/browser/devtools/profiler/test/browser.ini
@@ -40,16 +40,18 @@ skip-if = true # Bug 1047124
 skip-if = true # Bug 1047124
 [browser_profiler_profile-view-events.js]
 [browser_profiler_recording-cancelled.js]
 skip-if = true # Bug 1047124
 [browser_profiler_recording-selected-01.js]
 skip-if = true # Bug 1047124
 [browser_profiler_recording-selected-02.js]
 skip-if = true # Bug 1047124
+[browser_profiler_recording-selected-03.js]
+skip-if = true # Bug 1047124
 [browser_profiler_recording-utils.js]
 skip-if = true # Bug 1047124
 [browser_profiler_recordings-clear.js]
 skip-if = true # Bug 1047124
 [browser_profiler_recordings-io-01.js]
 skip-if = true # Bug 1047124
 [browser_profiler_recordings-io-02.js]
 [browser_profiler_recordings-io-03.js]
new file mode 100644
--- /dev/null
+++ b/browser/devtools/profiler/test/browser_profiler_recording-selected-03.js
@@ -0,0 +1,35 @@
+/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/**
+ * Tests if the profiler UI does not forget that recording is active when
+ * selected recording changes. Bug 1060885.
+ */
+
+let test = Task.async(function*() {
+  let [target, debuggee, panel] = yield initFrontend(SIMPLE_URL);
+  let { $, EVENTS, RecordingsListView, ProfileView } = panel.panelWin;
+
+  yield startRecording(panel);
+  yield stopRecording(panel, { waitForDisplay: true });
+
+  yield startRecording(panel);
+  yield stopRecording(panel, { waitForDisplay: true });
+
+  yield startRecording(panel);
+
+  info("Selecting recording #0 and waiting for it to be displayed.");
+  let selected = panel.panelWin.once(EVENTS.RECORDING_DISPLAYED);
+  RecordingsListView.selectedIndex = 0;
+  yield selected;
+
+  ok($("#record-button").hasAttribute("checked"),
+    "Button is still checked after selecting another item.");
+
+  ok(!$("#record-button").hasAttribute("locked"),
+    "Button is not locked after selecting another item.");
+
+  yield teardown(panel);
+  finish();
+});
--- a/browser/devtools/profiler/test/head.js
+++ b/browser/devtools/profiler/test/head.js
@@ -145,15 +145,16 @@ function* stopRecording(panel, { waitFor
 
   ok(button.hasAttribute("checked"),
     "The record button should still be checked.");
   ok(button.hasAttribute("locked"),
     "The record button now has a locked attribute.");
 
   if (waitForDisplay) {
     yield displayed;
-
-    ok(!button.hasAttribute("checked"),
-      "The record button should not be checked anymore.");
+    if (!win.RecordingsListView.getItemForPredicate(e => e.isRecording)) {
+      ok(!button.hasAttribute("checked"),
+        "The record button should not be checked anymore.");
+    }
     ok(!button.hasAttribute("locked"),
       "The record button should not be locked anymore.");
   }
 }
--- a/browser/devtools/profiler/ui-recordings.js
+++ b/browser/devtools/profiler/ui-recordings.js
@@ -197,17 +197,22 @@ let RecordingsListView = Heritage.extend
     ProfileView.showLoadingNotice();
     ProfileView.removeAllTabs();
 
     let recordingData = recordingItem.attachment;
     let durationMillis = recordingData.recordingDuration;
     yield ProfileView.addTabAndPopulate(recordingData, 0, durationMillis);
     ProfileView.showTabbedBrowser();
 
-    $("#record-button").removeAttribute("checked");
+    // Only clear the checked state if there's nothing recording.
+    if (!this.getItemForPredicate(e => e.isRecording)) {
+      $("#record-button").removeAttribute("checked");
+    }
+
+    // But don't leave it locked in any case.
     $("#record-button").removeAttribute("locked");
 
     window.emit(EVENTS.RECORDING_DISPLAYED);
   }),
 
   /**
    * The click listener for the "clear" button in this container.
    */