summaryrefslogtreecommitdiffstats
path: root/devtools/client/performance-new/test/browser/browser_aboutprofiling-interval.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /devtools/client/performance-new/test/browser/browser_aboutprofiling-interval.js
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/performance-new/test/browser/browser_aboutprofiling-interval.js')
-rw-r--r--devtools/client/performance-new/test/browser/browser_aboutprofiling-interval.js72
1 files changed, 72 insertions, 0 deletions
diff --git a/devtools/client/performance-new/test/browser/browser_aboutprofiling-interval.js b/devtools/client/performance-new/test/browser/browser_aboutprofiling-interval.js
new file mode 100644
index 0000000000..6dcc4e1156
--- /dev/null
+++ b/devtools/client/performance-new/test/browser/browser_aboutprofiling-interval.js
@@ -0,0 +1,72 @@
+/* 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 about:profiling can modify the sampling interval.");
+
+ await withAboutProfiling(async document => {
+ const intervalInput = await getNearestInputFromText(
+ document,
+ "Sampling interval:"
+ );
+ is(
+ getActiveConfiguration().interval,
+ 1,
+ "The active configuration's interval is set to a specific number initially."
+ );
+ is(
+ intervalInput.getAttribute("aria-valuemin"),
+ "0.01",
+ "aria-valuemin has the expected value"
+ );
+ is(
+ intervalInput.getAttribute("aria-valuemax"),
+ "100",
+ "aria-valuemax has the expected value"
+ );
+ is(
+ intervalInput.getAttribute("aria-valuenow"),
+ "1",
+ "aria-valuenow has the expected value"
+ );
+
+ info(
+ "Increase the interval by an arbitrary amount. The input range will " +
+ "scale that to the final value presented to the profiler."
+ );
+ setReactFriendlyInputValue(intervalInput, Number(intervalInput.value) + 1);
+
+ is(
+ getActiveConfiguration().interval,
+ 2,
+ "The configuration's interval was able to be increased."
+ );
+ is(
+ intervalInput.getAttribute("aria-valuenow"),
+ "2",
+ "aria-valuenow has the expected value"
+ );
+
+ intervalInput.focus();
+
+ info("Increase the interval with the keyboard");
+ EventUtils.synthesizeKey("VK_RIGHT");
+ await waitUntil(() => getActiveConfiguration().interval === 3);
+ is(
+ intervalInput.getAttribute("aria-valuenow"),
+ "3",
+ "aria-valuenow has the expected value"
+ );
+
+ info("Decrease the interval with the keyboard");
+ EventUtils.synthesizeKey("VK_LEFT");
+ await waitUntil(() => getActiveConfiguration().interval === 2);
+ is(
+ intervalInput.getAttribute("aria-valuenow"),
+ "2",
+ "aria-valuenow has the expected value"
+ );
+ });
+});