fune/devtools/client/performance-new/test/browser/browser_aboutprofiling-env-restart-button.js
Cristian Tuns 4d37cf70f1 Backed out 19 changesets (bug 1541508) for causing xpcshell failures on test_notHeadlessByDefault.js CLOSED TREE
Backed out changeset 08476fa2bc27 (bug 1541508)
Backed out changeset 0bf7514845db (bug 1541508)
Backed out changeset aa612a5e9ef7 (bug 1541508)
Backed out changeset 6bb9360473f7 (bug 1541508)
Backed out changeset b3d8e92f50c2 (bug 1541508)
Backed out changeset fa40dded133e (bug 1541508)
Backed out changeset 2e7db4aa8d4f (bug 1541508)
Backed out changeset 6098e2eb62ea (bug 1541508)
Backed out changeset 2c599ee639c4 (bug 1541508)
Backed out changeset 7d44f6e2644c (bug 1541508)
Backed out changeset c1279c3d674c (bug 1541508)
Backed out changeset 8bd08a62a590 (bug 1541508)
Backed out changeset 740010cb005c (bug 1541508)
Backed out changeset 0bfc7dd85c62 (bug 1541508)
Backed out changeset c4374a351356 (bug 1541508)
Backed out changeset 44ccfeca7364 (bug 1541508)
Backed out changeset e944e706a523 (bug 1541508)
Backed out changeset 2c59d66f43e4 (bug 1541508)
Backed out changeset a1896eacb6f1 (bug 1541508)
2022-11-01 22:38:52 -04:00

81 lines
2.2 KiB
JavaScript

/* 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 that the popup offers to restart the browser to set an enviroment flag."
);
if (!Services.profiler.GetFeatures().includes("jstracer")) {
ok(
true,
"JS tracer is not supported on this platform, or is currently disabled. Skip the rest of the test."
);
return;
}
{
info("Ensure that JS Tracer is not currently enabled.");
const {
getEnvironmentVariable,
} = require("resource://devtools/client/performance-new/browser.js");
ok(
!getEnvironmentVariable("JS_TRACE_LOGGING"),
"The JS_TRACE_LOGGING is not currently enabled."
);
}
ok(
false,
"This test was migrated from the initial popup implementation to " +
"about:profiling, however JS Tracer was disabled at the time. When " +
"re-enabling JS Tracer, please audit that this text works as expected, " +
"especially in the UI."
);
await withAboutProfiling(async document => {
{
info(
"Test that there is offer to restart the browser when first loading up the popup."
);
const noRestartButton = maybeGetElementFromDocumentByText(
document,
"Restart"
);
ok(!noRestartButton, "There is no button to restart the browser.");
}
const jsTracerFeature = await getElementFromDocumentByText(
document,
"JSTracer"
);
{
info("Toggle the jstracer feature on.");
jsTracerFeature.click();
const restartButton = await getElementFromDocumentByText(
document,
"Restart"
);
ok(
restartButton,
"There is now a button to offer to restart the browser"
);
}
{
info("Toggle the jstracer feature back off.");
jsTracerFeature.click();
const noRestartButton = maybeGetElementFromDocumentByText(
document,
"Restart"
);
ok(!noRestartButton, "The offer to restart the browser goes away.");
}
});
});