tor-browser

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

browser_aboutprofiling-presets.js (1706B)


      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 
      5 "use strict";
      6 
      7 add_task(async function test() {
      8  info("Test that about:profiling presets configure the profiler");
      9 
     10  if (!Services.profiler.GetFeatures().includes("stackwalk")) {
     11    ok(true, "This platform does not support stackwalking, skip this test.");
     12    return;
     13  }
     14  // This test assumes that the Web Developer preset is set by default, which is
     15  // not the case on Nightly and custom builds.
     16  PrefsPresets.changePreset(
     17    "aboutprofiling",
     18    "web-developer",
     19    Services.profiler.GetFeatures()
     20  );
     21 
     22  await withAboutProfiling(async document => {
     23    const webdev = await getNearestInputFromText(document, "Web Developer");
     24    ok(webdev.checked, "By default the Web Developer preset is selected.");
     25 
     26    ok(
     27      !activeConfigurationHasFeature("stackwalk"),
     28      "Stackwalking is not enabled for the Web Developer workflow"
     29    );
     30 
     31    const graphics = await getNearestInputFromText(document, "Graphics");
     32 
     33    ok(!graphics.checked, "The Graphics preset is not checked.");
     34    graphics.click();
     35    ok(
     36      graphics.checked,
     37      "After clicking the input, the Graphics preset is now checked."
     38    );
     39 
     40    ok(
     41      activeConfigurationHasFeature("stackwalk"),
     42      "The graphics preset uses stackwalking."
     43    );
     44 
     45    const media = await getNearestInputFromText(document, "Media");
     46 
     47    ok(!media.checked, "The media preset is not checked.");
     48    media.click();
     49    ok(
     50      media.checked,
     51      "After clicking the input, the Media preset is now checked."
     52    );
     53  });
     54 });