tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_devtools-interrupted.js (1355B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 "use strict";
      5 
      6 add_task(async function test() {
      7  info("Test what happens when a recording is interrupted by another tool.");
      8 
      9  const { stopProfiler: stopProfilerByAnotherTool } =
     10    ChromeUtils.importESModule(
     11      "resource://devtools/client/performance-new/shared/background.sys.mjs"
     12    );
     13 
     14  await withDevToolsPanel(async document => {
     15    const getRecordingState = setupGetRecordingState(document);
     16 
     17    const startRecording = await getActiveButtonFromText(
     18      document,
     19      "Start recording"
     20    );
     21    info("Click to start recording");
     22    startRecording.click();
     23 
     24    info("Wait until the profiler UI has updated to show that it is ready.");
     25    await getActiveButtonFromText(document, "Capture recording");
     26 
     27    info("Stop the profiler by another tool.");
     28 
     29    stopProfilerByAnotherTool();
     30 
     31    info("Check that the user was notified of this interruption.");
     32    await getElementFromDocumentByText(
     33      document,
     34      "The recording was stopped by another tool."
     35    );
     36 
     37    is(
     38      getRecordingState(),
     39      "available-to-record",
     40      "The client is ready to record again, even though it was interrupted."
     41    );
     42  });
     43 });