From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- tools/profiler/tests/chrome/chrome.ini | 8 +++ tools/profiler/tests/chrome/profiler_test_utils.js | 66 ++++++++++++++++++++++ .../profiler/tests/chrome/test_profile_worker.html | 66 ++++++++++++++++++++++ .../chrome/test_profile_worker_bug_1428076.html | 58 +++++++++++++++++++ 4 files changed, 198 insertions(+) create mode 100644 tools/profiler/tests/chrome/chrome.ini create mode 100644 tools/profiler/tests/chrome/profiler_test_utils.js create mode 100644 tools/profiler/tests/chrome/test_profile_worker.html create mode 100644 tools/profiler/tests/chrome/test_profile_worker_bug_1428076.html (limited to 'tools/profiler/tests/chrome') diff --git a/tools/profiler/tests/chrome/chrome.ini b/tools/profiler/tests/chrome/chrome.ini new file mode 100644 index 0000000000..7089b8fb8e --- /dev/null +++ b/tools/profiler/tests/chrome/chrome.ini @@ -0,0 +1,8 @@ +[DEFAULT] +skip-if = tsan # Bug 1804081 +support-files=profiler_test_utils.js + +[test_profile_worker_bug_1428076.html] +skip-if = os == 'android' && processor == 'arm' # Bug 1541291 +[test_profile_worker.html] +skip-if = os == 'android' && processor == 'arm' # Bug 1541291 diff --git a/tools/profiler/tests/chrome/profiler_test_utils.js b/tools/profiler/tests/chrome/profiler_test_utils.js new file mode 100644 index 0000000000..d2e4499b34 --- /dev/null +++ b/tools/profiler/tests/chrome/profiler_test_utils.js @@ -0,0 +1,66 @@ +"use strict"; + +(function () { + async function startProfiler(settings) { + let startPromise = Services.profiler.StartProfiler( + settings.entries, + settings.interval, + settings.features, + settings.threads, + 0, + settings.duration + ); + + info("Parent Profiler has started"); + + await startPromise; + + info("Child profilers have started"); + } + + function getProfile() { + const profile = Services.profiler.getProfileData(); + info( + "We got a profile, run the mochitest with `--keep-open true` to see the logged profile in the Web Console." + ); + + // Run the mochitest with `--keep-open true` to see the logged profile in the + // Web console. + console.log(profile); + + return profile; + } + + async function stopProfiler() { + let stopPromise = Services.profiler.StopProfiler(); + info("Parent profiler has stopped"); + await stopPromise; + info("Child profilers have stopped"); + } + + function end(error) { + if (error) { + ok(false, `We got an error: ${error}`); + } else { + ok(true, "We ran the whole process"); + } + SimpleTest.finish(); + } + + async function runTest(settings, workload) { + SimpleTest.waitForExplicitFinish(); + try { + await startProfiler(settings); + await workload(); + await getProfile(); + await stopProfiler(); + await end(); + } catch (e) { + // By catching and handling the error, we're being nice to mochitest + // runners: instead of waiting for the timeout, we fail right away. + await end(e); + } + } + + window.runTest = runTest; +})(); diff --git a/tools/profiler/tests/chrome/test_profile_worker.html b/tools/profiler/tests/chrome/test_profile_worker.html new file mode 100644 index 0000000000..8e2bae7fbd --- /dev/null +++ b/tools/profiler/tests/chrome/test_profile_worker.html @@ -0,0 +1,66 @@ + + + + + + Test for Bug 1428076 + + + + +Mozilla Bug 1428076 + + + + + + diff --git a/tools/profiler/tests/chrome/test_profile_worker_bug_1428076.html b/tools/profiler/tests/chrome/test_profile_worker_bug_1428076.html new file mode 100644 index 0000000000..abe0e5748a --- /dev/null +++ b/tools/profiler/tests/chrome/test_profile_worker_bug_1428076.html @@ -0,0 +1,58 @@ + + + + + + Test for Bug 1428076 + + + + +Mozilla Bug 1428076 + + + + + + -- cgit v1.2.3