fune/testing/web-platform/tests/js-self-profiling/inline-script.html
Andrew Comminos b03978edaa Bug 1720233 [wpt PR 29645] - Reattempt upstreaming of JS Self-Profiling API WPTs, a=testonly
Automatic update from web-platform-tests
Reattempt upstreaming of JS Self-Profiling API WPTs

Wait for a delay of SAMPLE_INTERVAL + 500ms to collect samples, ensuring that we're more robust to flakiness on Mac OS CI bots.

Bug: 956688
Change-Id: If39f1d59a09857d5bcb52c5c5d03782de4055b30
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3021557
Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
Commit-Queue: Andrew Comminos <acomminos@fb.com>
Cr-Commit-Position: refs/heads/master@{#901174}

--

wpt-commits: 9d6d7f8c5356ab9fc4b49656323ce196f1176613
wpt-pr: 29645
2021-07-19 15:59:40 +00:00

46 lines
1.2 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/profile-utils.js"></script>
</head>
<body>
<script>
// Note: moving these function definitions will change the expected
// outcomes below.
function nestedInlineScriptFunction(sample) {
sample();
}
function inlineScriptFunction(sample) {
nestedInlineScriptFunction(sample);
}
</script>
<script>
promise_test(async t => {
const trace = await ProfileUtils.profileFunction(inlineScriptFunction);
assert_true(ProfileUtils.containsResource(trace, location.href),
'inline script resource is included');
assert_true(ProfileUtils.containsSubstack(trace, [
{
name: 'nestedInlineScriptFunction',
resourceId: trace.resources.indexOf(location.href),
line: 13,
column: 40,
},
{
name: 'inlineScriptFunction',
resourceId: trace.resources.indexOf(location.href),
line: 17,
column: 34,
},
]));
}, 'inline script function details');
</script>
</body>
</html>