tor-browser

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

browser_UITour_showProtectionReport.js (1412B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 var gTestTab;
      7 var gContentAPI;
      8 
      9 add_task(setup_UITourTest);
     10 
     11 add_setup(async function () {
     12  await SpecialPowers.pushPrefEnv({
     13    set: [
     14      ["browser.contentblocking.database.enabled", false],
     15      ["browser.contentblocking.report.monitor.enabled", false],
     16      ["browser.contentblocking.report.lockwise.enabled", false],
     17      ["browser.contentblocking.report.proxy.enabled", false],
     18    ],
     19  });
     20 });
     21 
     22 // Test that we can switch to about:protections
     23 add_UITour_task(async function test_openProtectionReport() {
     24  let aboutProtectionsLoaded = BrowserTestUtils.browserLoaded(
     25    gBrowser.selectedBrowser,
     26    false,
     27    "about:protections"
     28  );
     29  info("Showing about:protections");
     30  await gContentAPI.showProtectionReport();
     31  info("Waiting for about:protections to load");
     32  await aboutProtectionsLoaded;
     33  // When the graph is built it means the messaging has finished,
     34  // we can close the tab.
     35  await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function () {
     36    await ContentTaskUtils.waitForCondition(() => {
     37      let bars = content.document.querySelectorAll(".graph-bar");
     38      return bars.length;
     39    }, "The graph has been built");
     40  });
     41 
     42  is(
     43    gBrowser.selectedBrowser.currentURI.spec,
     44    "about:protections",
     45    "Loaded about:protections"
     46  );
     47 });