From 2aa4a82499d4becd2284cdb482213d541b8804dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 16:29:10 +0200 Subject: Adding upstream version 86.0.1. Signed-off-by: Daniel Baumann --- tools/profiler/tests/chrome/chrome.ini | 7 +++ tools/profiler/tests/chrome/profiler_test_utils.js | 64 +++++++++++++++++++++ .../profiler/tests/chrome/test_profile_worker.html | 66 ++++++++++++++++++++++ .../chrome/test_profile_worker_bug_1428076.html | 58 +++++++++++++++++++ 4 files changed, 195 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..76c0b2eaf1 --- /dev/null +++ b/tools/profiler/tests/chrome/chrome.ini @@ -0,0 +1,7 @@ +[DEFAULT] +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..b89a25995a --- /dev/null +++ b/tools/profiler/tests/chrome/profiler_test_utils.js @@ -0,0 +1,64 @@ +"use strict"; + +(function() { + const { Services } = ChromeUtils.import( + "resource://gre/modules/Services.jsm" + ); + + function startProfiler(settings) { + Services.profiler.StartProfiler( + settings.entries, + settings.interval, + settings.features, + settings.threads, + 0, + settings.duration + ); + + info("Profiler has 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; + } + + function stopProfiler() { + Services.profiler.StopProfiler(); + info("Profiler has 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..d32d36bb41 --- /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..30245b5b46 --- /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