Bug 1375562 - Test the interaction of AudioContext::Suspend and breakpoints. r=jlast

Differential Revision: https://phabricator.services.mozilla.com/D24916

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Paul Adenot 2019-04-02 11:09:32 +00:00
parent 653464a0cf
commit 2ca28a05ed
3 changed files with 68 additions and 0 deletions

View File

@ -636,6 +636,7 @@ support-files =
examples/doc-pause-points.html
examples/doc-return-values.html
examples/doc-wasm-sourcemaps.html
examples/doc-audiocontext.html
examples/asm.js
examples/async.js
examples/bogus-map.js
@ -665,6 +666,7 @@ support-files =
examples/doc-sourceURL-breakpoint.html
[browser_dbg-asm.js]
[browser_dbg-audiocontext.js]
[browser_dbg-async-stepping.js]
[browser_dbg-sourcemapped-breakpoint-console.js]
skip-if = (os == "win" && ccov) # Bug 1453549

View File

@ -0,0 +1,18 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Test the AudioContext are paused and resume appropriately when using the
// debugger.
add_task(async function() {
const dbg = await initDebugger("doc-audiocontext.html");
invokeInTab("myFunction");
invokeInTab("suspendAC");
invokeInTab("debuggerStatement");
await waitForPaused(dbg);
invokeInTab("checkACState");
ok(true, "No AudioContext state transition are caused by the debugger")
});

View File

@ -0,0 +1,48 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>Debugger test page</title>
</head>
<body>
<button id="start" onclick="myFunction()">start ac</button>
<button id="suspend" onclick="suspendAC()">suspend ac</button>
<button id="break" onclick="debuggerStatement()">break</button>
<button id="check" onclick="checkACState()">check ac state</button>
<script type="text/javascript">
var ac = null;
var suspend_called = false;
function suspendAC() {
suspend_called = true;
ac.suspend();
}
function debuggerStatement() {
debugger;
}
function checkACState() {
if (ac.state != "suspended") {
throw "AudioContext should be suspended.";
}
}
function myFunction() {
ac = new AudioContext();
function statechange_suspend() {
ac.onstatechange = statechange_fail;
}
function statechange_fail() {
throw "No state change should occur when paused in the debugger.";
}
ac.onstatechange = function() {
ac.onstatechange = statechange_suspend;
}
}
</script>
</body>
</html>