| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../resources/js-test.js"></script> | 4 <script src="../resources/js-test.js"></script> |
| 5 <script src="resources/compatibility.js"></script> | 5 <script src="resources/compatibility.js"></script> |
| 6 </head> | 6 </head> |
| 7 <body> | 7 <body> |
| 8 <script> | 8 <script> |
| 9 description("Tests the OfflineAudioContext constructor"); | 9 description("Tests the OfflineAudioContext constructor"); |
| 10 | 10 |
| 11 var context; | 11 var context; |
| 12 // Make sure we don't crash when giving 0 as number of frames. | 12 // Make sure we don't crash when giving 0 as number of frames. |
| 13 shouldThrow("new OfflineAudioContext(1, 0, 44100)"); | 13 shouldThrow("new OfflineAudioContext(1, 0, 44100)"); |
| 14 // Make sure we don't throw exceptions for supported ranges of sample rates for
an OfflineAudioContext. | 14 // Make sure we don't throw exceptions for supported ranges of sample rates for
an OfflineAudioContext. |
| 15 shouldThrow("context = new OfflineAudioContext(2, 512, 2999)"); |
| 15 shouldNotThrow("context = new OfflineAudioContext(2, 512, 3000)"); | 16 shouldNotThrow("context = new OfflineAudioContext(2, 512, 3000)"); |
| 16 shouldBeEqualToNumber("context.length", 512); | 17 shouldBeEqualToNumber("context.length", 512); |
| 17 shouldNotThrow("context = new OfflineAudioContext(2, 1024, 192000)"); | 18 shouldNotThrow("context = new OfflineAudioContext(2, 1024, 384000)"); |
| 18 shouldBeEqualToNumber("context.length", 1024); | 19 shouldBeEqualToNumber("context.length", 1024); |
| 20 shouldThrow("context = new OfflineAudioContext(2, 1024, 384001)"); |
| 19 shouldNotThrow("context = new OfflineAudioContext(2, 2048, 8000)"); | 21 shouldNotThrow("context = new OfflineAudioContext(2, 2048, 8000)"); |
| 20 shouldBeEqualToNumber("context.length", 2048); | 22 shouldBeEqualToNumber("context.length", 2048); |
| 21 shouldNotThrow("context = new OfflineAudioContext(2, 4096, 11025)"); | 23 shouldNotThrow("context = new OfflineAudioContext(2, 4096, 11025)"); |
| 22 shouldBeEqualToNumber("context.length", 4096); | 24 shouldBeEqualToNumber("context.length", 4096); |
| 23 shouldNotThrow("context = new OfflineAudioContext(2, 512, 22050)"); | 25 shouldNotThrow("context = new OfflineAudioContext(2, 512, 22050)"); |
| 24 shouldBeEqualToNumber("context.length", 512); | 26 shouldBeEqualToNumber("context.length", 512); |
| 25 shouldNotThrow("context = new OfflineAudioContext(2, 512, 44100)"); | 27 shouldNotThrow("context = new OfflineAudioContext(2, 512, 44100)"); |
| 26 shouldBeEqualToNumber("context.length", 512); | 28 shouldBeEqualToNumber("context.length", 512); |
| 27 shouldNotThrow("context = new OfflineAudioContext(2, 512, 48000)"); | 29 shouldNotThrow("context = new OfflineAudioContext(2, 512, 48000)"); |
| 28 shouldBeEqualToNumber("context.length", 512); | 30 shouldBeEqualToNumber("context.length", 512); |
| 29 shouldNotThrow("context = new OfflineAudioContext(2, 512, 88200)"); | 31 shouldNotThrow("context = new OfflineAudioContext(2, 512, 88200)"); |
| 30 shouldBeEqualToNumber("context.length", 512); | 32 shouldBeEqualToNumber("context.length", 512); |
| 31 // Make sure length is read-only. | 33 // Make sure length is read-only. |
| 32 shouldNotThrow("context.length = 99"); | 34 shouldNotThrow("context.length = 99"); |
| 33 shouldBeEqualToNumber("context.length", 512); | 35 shouldBeEqualToNumber("context.length", 512); |
| 34 shouldNotThrow("context = new OfflineAudioContext(2, 512, 96000)"); | 36 shouldNotThrow("context = new OfflineAudioContext(2, 512, 96000)"); |
| 35 // Make sure we throw exceptions for non-finite sample rates. | 37 // Make sure we throw exceptions for non-finite sample rates. |
| 36 shouldThrow("context = new OfflineAudioContext(1, 0, NaN)"); | 38 shouldThrow("context = new OfflineAudioContext(1, 0, NaN)"); |
| 37 shouldThrow("context = new OfflineAudioContext(1, 0, Infinity)"); | 39 shouldThrow("context = new OfflineAudioContext(1, 0, Infinity)"); |
| 38 // Verify channel counts and other destination attributes are set correctly. | 40 // Verify channel counts and other destination attributes are set correctly. |
| 39 shouldNotThrow("context = new OfflineAudioContext(7, 512, 48000)"); | 41 shouldNotThrow("context = new OfflineAudioContext(7, 512, 48000)"); |
| 40 shouldBeEqualToNumber("context.destination.channelCount", 7); | 42 shouldBeEqualToNumber("context.destination.channelCount", 7); |
| 41 shouldBeEqualToNumber("context.destination.maxChannelCount", 7); | 43 shouldBeEqualToNumber("context.destination.maxChannelCount", 7); |
| 42 shouldBeEqualToString("context.destination.channelCountMode", "explicit"); | 44 shouldBeEqualToString("context.destination.channelCountMode", "explicit"); |
| 43 shouldBeEqualToString("context.destination.channelInterpretation", "speakers"); | 45 shouldBeEqualToString("context.destination.channelInterpretation", "speakers"); |
| 44 </script> | 46 </script> |
| 45 </body> | 47 </body> |
| 46 </html> | 48 </html> |
| OLD | NEW |