summaryrefslogtreecommitdiffstats
path: root/devtools/client/webconsole/test/browser/browser_console_restore.js
blob: 5941c744fce528db41515aab1eea38cc6c34a89e (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
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

// Check that the browser console gets session state is set correctly, and that
// it re-opens when restore is requested.

"use strict";

add_task(async function () {
  is(
    BrowserConsoleManager.getBrowserConsoleSessionState(),
    false,
    "Session state false by default"
  );
  BrowserConsoleManager.storeBrowserConsoleSessionState();
  is(
    BrowserConsoleManager.getBrowserConsoleSessionState(),
    false,
    "Session state still not true even after setting (since Browser Console is closed)"
  );

  const hud = await BrowserConsoleManager.toggleBrowserConsole();
  BrowserConsoleManager.storeBrowserConsoleSessionState();
  is(
    BrowserConsoleManager.getBrowserConsoleSessionState(),
    true,
    "Session state true (since Browser Console is opened)"
  );

  info(
    "Closing the browser console and waiting for the session restore to reopen it"
  );
  await safeCloseBrowserConsole();

  const opened = waitForBrowserConsole(hud);
  await gDevTools.restoreDevToolsSession({
    browserConsole: true,
  });

  info("Waiting for the console to open after session restore");
  await opened;
});