Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!doctype html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="../resources/js-test.js"></script> | |
| 5 <script src="resources/compatibility.js"></script> | |
| 6 <script src="resources/audio-testing.js"></script> | |
| 7 </head> | |
| 8 | |
| 9 <body> | |
| 10 <script> | |
| 11 description('Suspending OfflineAudioContext at the same rendering block bo undary.'); | |
| 12 window.jsTestIsAsync = true; | |
| 13 | |
| 14 var sampleRate = 44100; | |
| 15 var renderDuration = 1; | |
| 16 var renderQuantum = 128; | |
| 17 | |
| 18 var audit = Audit.createTaskRunner(); | |
| 19 | |
| 20 // Task: Calling suspend with no argument should reject the promise. | |
| 21 audit.defineTask('suspend-no-argument', function (done) { | |
| 22 var context = new OfflineAudioContext(1, sampleRate * renderDuration, sa mpleRate); | |
| 23 | |
| 24 Should('context.suspend()', context.suspend()).beRejected().then(done); | |
| 25 }); | |
| 26 | |
| 27 // Calling multiple suspends at the same rendering quantum should reject | |
| 28 // the promise. | |
| 29 audit.defineTask('identical-suspend-time', function (done) { | |
| 30 var context = new OfflineAudioContext(1, sampleRate * renderDuration, sa mpleRate); | |
| 31 var suspendTime1 = renderQuantum / sampleRate; | |
| 32 var suspendTime2 = (renderQuantum + renderQuantum * 0.5) / sampleRate; | |
| 33 | |
| 34 context.suspend(suspendTime1); | |
| 35 | |
| 36 Should('Calling multiple suspends at the same rendering quantum', | |
| 37 context.suspend(suspendTime2)).beRejected().then(done); | |
| 38 }); | |
| 39 | |
| 40 // Calling resume on non-suspended context should reject the promise. | |
| 41 audit.defineTask('resume-before-suspend', function (done) { | |
| 42 var context = new OfflineAudioContext(1, sampleRate * renderDuration, sa mpleRate); | |
| 43 | |
| 44 context.suspend(1.0); | |
|
Raymond Toy
2015/05/28 16:37:34
Doesn't this produce an error because the suspend
hongchan
2015/06/09 20:49:58
Oops. This is a mistake. This should be removed.
Raymond Toy
2015/06/09 22:34:58
Oh, yeah, 1.0 isn't the start of a rendering quant
| |
| 45 | |
| 46 Should('Calling resume on non-suspended context', context.resume()) | |
| 47 .beRejected().then(done); | |
|
Raymond Toy
2015/05/28 16:37:34
Should there also be a test for calling resume wit
hongchan
2015/06/09 20:49:58
Removing the suspend above.
| |
| 48 }); | |
| 49 | |
| 50 audit.defineTask('finish', function (done) { | |
| 51 finishJSTest(); | |
| 52 done(); | |
| 53 }); | |
| 54 | |
| 55 audit.runTasks( | |
| 56 'suspend-no-argument', | |
| 57 'identical-suspend-time', | |
| 58 'resume-before-suspend', | |
| 59 'finish' | |
| 60 ); | |
| 61 | |
| 62 successfullyParsed = true; | |
| 63 </script> | |
| 64 | |
| 65 </body> | |
| 66 </html> | |
| OLD | NEW |