From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- tools/profiler/tests/chrome/chrome.toml | 9 +++ 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, 199 insertions(+) create mode 100644 tools/profiler/tests/chrome/chrome.toml 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.toml b/tools/profiler/tests/chrome/chrome.toml new file mode 100644 index 0000000000..905d1ffff3 --- /dev/null +++ b/tools/profiler/tests/chrome/chrome.toml @@ -0,0 +1,9 @@ +[DEFAULT] +skip-if = ["tsan"] # Bug 1804081 +support-files = ["profiler_test_utils.js"] + +["test_profile_worker.html"] +skip-if = ["os == 'android' && processor == 'arm'"] # Bug 1541291 + +["test_profile_worker_bug_1428076.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