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

Side by Side 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, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!doctype html>
2 <html>
3 <head>
4 <title>Test resume() failures</title>
5 <style type="text/css">
6 header {
7 margin: 20px 0;
8 }
9 #results {
10 white-space: pre;
11 font-family: monospace;
12 }
13 </style>
14 </head>
15
16 <body>
17 <h1>Test suspend()/resume() issues</h1>
18
19 <p>
20 The functionality of suspend()/resume() can't be tested with an OfflineAud ioContext, so they
21 need to be tested manually here.
22 </p>
23
24 <p>
25 Do the tests in the order given.
26 </p>
27 <h2>Test 1</h2>
28 <p>
29 Test for <a href="crbug.com/483002">issue 483002</a>
30 </p>
31 <p>
32 Press the button to run the test. Each press should cause "suspended" and
33 "running" to be printed out in the Results section below and in the consol e.
34 </p>
35 <button onclick="test1Start()">Test 1: Start Test</button>
36 <button onclick="test1Run()">Test 1: Run Test</button>
37 <button onclick="test1End()">Test 1: End Test</button>
38 <br></br>
39
40 <h2>Test 2</h2>
41 <p>
42 Test for <a href="crbug.com/483269">issue 483269</a>
43 </p>
44 <p>
45 Perform the following steps
46 <ol>
47 <li>Start Test: you should hear a tone. Wait a little bit before procee ding.
48 </li>
49 <li>Run Test: This calls suspend()/resume() multiple times. The tone sh ould stop
50 momentarily, but restart very quickly. You should still hear the tone.
51 </li>
52 <li>End Test: Stops the tone.
53 </li>
54 </ol>
55 </p>
56 <p>
57 If you do not hear a tone after running the test (but before ending), the test has failed.
58 </p>
59 <button onclick="test2Start()">Test 2: Start Test</button>
60 <button onclick="test2Run()">Test 2: Run Test </button>
61 <button onclick="test2End()">Test 2: End Test </button>
62
63 <header>Results</header>
64 <div id="results"></div>
65
66 <script>
67 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
68 var testCount = 0;
69 var oscillator;
70
71 function test1Start() {
72 oscillator = context.createOscillator();
73 oscillator.connect(context.destination);
74 oscillator.start();
75 log("Test 1 Start");
76 }
77
78 function test1Run() {
79 testCount += 1;
80 context.suspend().then(function () {
81 log(context.state, testCount);
82 return context.resume().then(function () {
83 log(context.state, testCount);
84 }, function (e) {
85 log("Failed to resume context: " + e, testCount);
86 });
87 }, function (e) {
88 log("Failed to suspend context: " + e, testCount);
89 }).then(function () {;
90 log("Test 1 Run: should should be audible");
91 });
92 }
93
94 function test1End() {
95 oscillator.stop();
96 log("Test 1 End");
97 }
98
99 function test2Start() {
100 if (context.state === "suspended") {
101 context.resume().then(function () {},
102 function (e) { log("Failed to resume context: " + e); })
103 }
104
105 oscillator = context.createOscillator();
106 oscillator.connect(context.destination);
107 oscillator.start();
108 log("Test 2 Start");
109 }
110
111 function test2Run() {
112 context.suspend();
113 context.resume();
114 context.suspend();
115 context.suspend();
116 context.resume().then(function () {
117 if (context.state === "running") {
118 log("Test 2 Run: sound should be audible");
119 } else {
120 log("Test 2 Run: FAIL: context not running!");
121 }
122 });
123 }
124
125 function test2End() {
126 oscillator.stop();
127 log("Test 2 End");
128 }
129
130 function log(message, count) {
131 var prefix = count + ": ";
132
133 if (count === undefined)
134 prefix = "";
135 else
136 prefix = count + ": ";
137 console.log(prefix + message);
138 var results = document.querySelector("#results");
139 results.textContent += prefix + message + "\n";
140 }
141 </script>
142
143 </body>
144 </html>
OLDNEW
« 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