jer.noble@apple.com | 02b7320 | 2018-04-02 15:40:20 +0000 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | |
| 3 | <html> |
| 4 | <head> |
| 5 | <script src="../resources/js-test.js"></script> |
| 6 | <script type="text/javascript" src="resources/audio-testing.js"></script> |
| 7 | </head> |
| 8 | |
| 9 | <body> |
| 10 | <div id="description"></div> |
| 11 | <div id="console"></div> |
| 12 | |
| 13 | <script> |
| 14 | description('OfflineAudioContexts should not have behavior restrictions.'); |
| 15 | |
| 16 | var context = null; |
| 17 | var node = null; |
| 18 | var calledResumeWithUserGesture = false; |
| 19 | |
| 20 | function runTest() { |
| 21 | window.jsTestIsAsync = true; |
| 22 | |
| 23 | context = new webkitOfflineAudioContext(2, 1000, 44100); |
| 24 | |
| 25 | if (window.internals) |
| 26 | internals.setAudioContextRestrictions(context, 'RequireUserGestureForAudioStart'); |
| 27 | |
| 28 | shouldBe('context.state', '"suspended"'); |
| 29 | |
| 30 | node = context.createBufferSource(); |
| 31 | evalAndLog('node.connect(context.destination)'); |
| 32 | evalAndLog('node.start()'); |
| 33 | shouldBe('context.state', '"suspended"'); |
| 34 | |
| 35 | debug('Calling context.startRendering() without a user gesture'); |
| 36 | context.startRendering(); |
| 37 | shouldBe('context.state', '"running"'); |
| 38 | finishJSTest(); |
| 39 | } |
| 40 | |
| 41 | runTest(); |
| 42 | |
| 43 | </script> |
| 44 | </body> |
| 45 | </html> |