Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Unified Diff: ManualTests/webaudio/suspend-resume-2.html

Issue 1123603002: Process suspend() and resume() in call order (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/modules/webaudio/AudioContext.h » ('j') | Source/modules/webaudio/AudioContext.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ManualTests/webaudio/suspend-resume-2.html
diff --git a/ManualTests/webaudio/suspend-resume-2.html b/ManualTests/webaudio/suspend-resume-2.html
new file mode 100644
index 0000000000000000000000000000000000000000..63eb70ae36b94c93e0004266c1786188fcc5e577
--- /dev/null
+++ b/ManualTests/webaudio/suspend-resume-2.html
@@ -0,0 +1,144 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Test resume() failures</title>
+ <style type="text/css">
+ header {
+ margin: 20px 0;
+ }
+ #results {
+ white-space: pre;
+ font-family: monospace;
+ }
+ </style>
+ </head>
+
+ <body>
+ <h1>Test suspend()/resume() issues</h1>
+
+ <p>
+ The functionality of suspend()/resume() can't be tested with an OfflineAudioContext, so they
+ need to be tested manually here.
+ </p>
+
+ <p>
+ Do the tests in the order given.
+ </p>
+ <h2>Test 1</h2>
+ <p>
+ Test for <a href="crbug.com/483002">issue 483002</a>
+ </p>
+ <p>
+ Press the button to run the test. Each press should cause "suspended" and
+ "running" to be printed out in the Results section below and in the console.
+ </p>
+ <button onclick="test1Start()">Test 1: Start Test</button>
+ <button onclick="test1Run()">Test 1: Run Test</button>
+ <button onclick="test1End()">Test 1: End Test</button>
+ <br></br>
+
+ <h2>Test 2</h2>
+ <p>
+ Test for <a href="crbug.com/483269">issue 483269</a>
+ </p>
+ <p>
+ Perform the following steps
+ <ol>
+ <li>Start Test: you should hear a tone. Wait a little bit before proceeding.
+ </li>
+ <li>Run Test: This calls suspend()/resume() multiple times. The tone should stop
+ momentarily, but restart very quickly. You should still hear the tone.
+ </li>
+ <li>End Test: Stops the tone.
+ </li>
+ </ol>
+ </p>
+ <p>
+ If you do not hear a tone after running the test (but before ending), the test has failed.
+ </p>
+ <button onclick="test2Start()">Test 2: Start Test</button>
+ <button onclick="test2Run()">Test 2: Run Test </button>
+ <button onclick="test2End()">Test 2: End Test </button>
+
+ <header>Results</header>
+ <div id="results"></div>
+
+ <script>
+ var context = new AudioContext();
hongchan 2015/05/04 17:28:38 Can we have a rational or description why this tes
Raymond Toy 2015/05/04 17:38:34 Doesn't line 20 explain why? Should I expand on i
+ var testCount = 0;
+ var oscillator;
+
+ function test1Start() {
+ oscillator = context.createOscillator();
+ oscillator.connect(context.destination);
+ oscillator.start();
+ log("Test 1 Start");
+ }
+
+ function test1Run() {
+ testCount += 1;
+ context.suspend().then(function () {
+ log(context.state, testCount);
+ return context.resume().then(function () {
+ log(context.state, testCount);
+ }, function (e) {
+ log("Failed to resume context: " + e, testCount);
+ });
+ }, function (e) {
+ log("Failed to suspend context: " + e, testCount);
+ }).then(function () {;
+ log("Test 1 Run: should should be audible");
+ });
+ }
+
+ function test1End() {
+ oscillator.stop();
+ log("Test 1 End");
+ }
+
+ function test2Start() {
+ if (context.state === "suspended") {
+ context.resume().then(function () {},
+ function (e) { log("Failed to resume context: " + e); })
+ }
+
+ oscillator = context.createOscillator();
+ oscillator.connect(context.destination);
+ oscillator.start();
+ log("Test 2 Start");
+ }
+
+ function test2Run() {
+ context.suspend();
+ context.resume();
+ context.suspend();
+ context.suspend();
+ context.resume().then(function () {
+ if (context.state === "running") {
+ log("Test 2 Run: sound should be audible");
+ } else {
+ log("Test 2 Run: FAIL: context not running!");
+ }
+ });
+ }
+
+ function test2End() {
+ oscillator.stop();
+ log("Test 2 End");
+ }
+
+ function log(message, count) {
+ var prefix = count + ": ";
+
+ if (count === undefined)
+ prefix = "";
+ else
+ prefix = count + ": ";
+ console.log(prefix + message);
+ var results = document.querySelector("#results");
+ results.textContent += prefix + message + "\n";
+ }
+ </script>
+
+ </body>
+</html>
« no previous file with comments | « no previous file | Source/modules/webaudio/AudioContext.h » ('j') | Source/modules/webaudio/AudioContext.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698