summaryrefslogtreecommitdiffstats
path: root/devtools/client/performance-new/test/browser/browser_devtools-interrupted.js
blob: f6b17366c38a435fe2fb9eda6c5883c8d59701ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";

add_task(async function test() {
  info("Test what happens when a recording is interrupted by another tool.");

  const { stopProfiler: stopProfilerByAnotherTool } = ChromeUtils.import(
    "resource://devtools/client/performance-new/shared/background.jsm.js"
  );

  await withDevToolsPanel(async document => {
    const getRecordingState = setupGetRecordingState(document);

    const startRecording = await getActiveButtonFromText(
      document,
      "Start recording"
    );
    info("Click to start recording");
    startRecording.click();

    info("Wait until the profiler UI has updated to show that it is ready.");
    await getActiveButtonFromText(document, "Capture recording");

    info("Stop the profiler by another tool.");

    stopProfilerByAnotherTool();

    info("Check that the user was notified of this interruption.");
    await getElementFromDocumentByText(
      document,
      "The recording was stopped by another tool."
    );

    is(
      getRecordingState(),
      "available-to-record",
      "The client is ready to record again, even though it was interrupted."
    );
  });
});