| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../resources/testharness.js"></script> | 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> | 5 <script src="../../resources/testharnessreport.js"></script> |
| 6 <script src="../resources/audit.js"></script> | 6 <script src="../resources/audit.js"></script> |
| 7 </head> | 7 </head> |
| 8 <body> | 8 <body> |
| 9 <script> | 9 <script> |
| 10 let audit = Audit.createTaskRunner(); | 10 let audit = Audit.createTaskRunner(); |
| 11 | 11 |
| 12 audit.define({ | 12 audit.define({ |
| 13 label: 'test', | 13 label: 'test', |
| 14 description: 'OfflineAudioContext constructor' | 14 description: 'OfflineAudioContext constructor' |
| 15 }, (task, should) => { | 15 }, (task, should) => { |
| 16 let context; | 16 let context; |
| 17 // Make sure we don't crash when giving 0 as number of frames. | 17 // Make sure we don't crash when giving 0 as number of frames. |
| 18 should( | 18 should( |
| 19 () => new OfflineAudioContext(1, 0, 44100), | 19 () => new OfflineAudioContext(1, 0, 44100), |
| 20 'new OfflineAudioContext(1, 0, 44100)') | 20 'new OfflineAudioContext(1, 0, 44100)') |
| 21 .throw(); | 21 .throw(); |
| 22 // Make sure we don't throw exceptions for supported ranges of sample rates | 22 // Make sure we don't throw exceptions for supported ranges of sample rates |
| 23 // for an OfflineAudioContext. | 23 // for an OfflineAudioContext. |
| 24 should( | 24 should( |
| 25 () => context = new OfflineAudioContext(2, 512, 2999), | 25 () => context = new OfflineAudioContext(2, 512, 2999), |
| 26 'context = new OfflineAudioContext(2, 512, 2999)') | 26 'context0 = new OfflineAudioContext(2, 512, 2999)') |
| 27 .throw(); | 27 .throw(); |
| 28 should( | 28 should( |
| 29 () => context = new OfflineAudioContext(2, 512, 3000), | 29 () => context = new OfflineAudioContext(2, 512, 3000), |
| 30 'context = new OfflineAudioContext(2, 512, 3000)') | 30 'context1 = new OfflineAudioContext(2, 512, 3000)') |
| 31 .notThrow(); | 31 .notThrow(); |
| 32 should(context.length, 'context.length').beEqualTo(512); | 32 should(context.length, 'context1.length').beEqualTo(512); |
| 33 should( | 33 should( |
| 34 () => context = new OfflineAudioContext(2, 1024, 384000), | 34 () => context = new OfflineAudioContext(2, 1024, 384000), |
| 35 'context = new OfflineAudioContext(2, 1024, 384000)') | 35 'context2 = new OfflineAudioContext(2, 1024, 384000)') |
| 36 .notThrow(); | 36 .notThrow(); |
| 37 should(context.length, 'context.length').beEqualTo(1024); | 37 should(context.length, 'context2.length').beEqualTo(1024); |
| 38 should( | 38 should( |
| 39 () => context = new OfflineAudioContext(2, 1024, 384001), | 39 () => context = new OfflineAudioContext(2, 1024, 384001), |
| 40 'context = new OfflineAudioContext(2, 1024, 384001)') | 40 'context3 = new OfflineAudioContext(2, 1024, 384001)') |
| 41 .throw(); | 41 .throw(); |
| 42 should( | 42 should( |
| 43 () => context = new OfflineAudioContext(2, 2048, 8000), | 43 () => context = new OfflineAudioContext(2, 2048, 8000), |
| 44 'context = new OfflineAudioContext(2, 2048, 8000)') | 44 'context4 = new OfflineAudioContext(2, 2048, 8000)') |
| 45 .notThrow(); | 45 .notThrow(); |
| 46 should(context.length, 'context.length').beEqualTo(2048); | 46 should(context.length, 'context4.length').beEqualTo(2048); |
| 47 should( | 47 should( |
| 48 () => context = new OfflineAudioContext(2, 4096, 11025), | 48 () => context = new OfflineAudioContext(2, 4096, 11025), |
| 49 'context = new OfflineAudioContext(2, 4096, 11025)') | 49 'context5 = new OfflineAudioContext(2, 4096, 11025)') |
| 50 .notThrow(); | 50 .notThrow(); |
| 51 should(context.length, 'context.length').beEqualTo(4096); | 51 should(context.length, 'context5.length').beEqualTo(4096); |
| 52 should( | 52 should( |
| 53 () => context = new OfflineAudioContext(2, 512, 22050), | 53 () => context = new OfflineAudioContext(2, 512, 22050), |
| 54 'context = new OfflineAudioContext(2, 512, 22050)') | 54 'context6 = new OfflineAudioContext(2, 512, 22050)') |
| 55 .notThrow(); | 55 .notThrow(); |
| 56 should(context.length, 'context.length').beEqualTo(512); | 56 should(context.length, 'context6.length').beEqualTo(512); |
| 57 should( | 57 should( |
| 58 () => context = new OfflineAudioContext(2, 512, 44100), | 58 () => context = new OfflineAudioContext(2, 512, 44100), |
| 59 'context = new OfflineAudioContext(2, 512, 44100)') | 59 'context7 = new OfflineAudioContext(2, 512, 44100)') |
| 60 .notThrow(); | 60 .notThrow(); |
| 61 should(context.length, 'context.length').beEqualTo(512); | 61 should(context.length, 'context7.length').beEqualTo(512); |
| 62 should( | 62 should( |
| 63 () => context = new OfflineAudioContext(2, 512, 48000), | 63 () => context = new OfflineAudioContext(2, 512, 48000), |
| 64 'context = new OfflineAudioContext(2, 512, 48000)') | 64 'context8 = new OfflineAudioContext(2, 512, 48000)') |
| 65 .notThrow(); | 65 .notThrow(); |
| 66 should(context.length, 'context.length').beEqualTo(512); | 66 should(context.length, 'context8.length').beEqualTo(512); |
| 67 | 67 |
| 68 should( | 68 should( |
| 69 () => context = new OfflineAudioContext(2, 512, 88200), | 69 () => context = new OfflineAudioContext(2, 512, 88200), |
| 70 'context = new OfflineAudioContext(2, 512, 88200)') | 70 'context9 = new OfflineAudioContext(2, 512, 88200)') |
| 71 .notThrow(); | 71 .notThrow(); |
| 72 should(context.length, 'context.length').beEqualTo(512); | 72 should(context.length, 'context9.length').beEqualTo(512); |
| 73 | 73 |
| 74 // Make sure length is read-only. | 74 // Make sure length is read-only. |
| 75 should(() => context.length = 99, 'context.length = 99').notThrow(); | 75 should(() => context.length = 99, 'context9.length = 99').notThrow(); |
| 76 should(context.length, 'context.length').beEqualTo(512); | 76 should(context.length, 'context9.length after illegal setter value').beEqualTo
(512); |
| 77 should( | 77 should( |
| 78 () => context = new OfflineAudioContext(2, 512, 96000), | 78 () => context = new OfflineAudioContext(2, 512, 96000), |
| 79 'context = new OfflineAudioContext(2, 512, 96000)') | 79 'context10 = new OfflineAudioContext(2, 512, 96000)') |
| 80 .notThrow(); | 80 .notThrow(); |
| 81 // Make sure we throw exceptions for non-finite sample rates. | 81 // Make sure we throw exceptions for non-finite sample rates. |
| 82 should( | 82 should( |
| 83 () => context = new OfflineAudioContext(1, 0, NaN), | 83 () => context = new OfflineAudioContext(1, 0, NaN), |
| 84 'context = new OfflineAudioContext(1, 0, NaN)') | 84 'context11 = new OfflineAudioContext(1, 0, NaN)') |
| 85 .throw(); | 85 .throw(); |
| 86 should( | 86 should( |
| 87 () => context = new OfflineAudioContext(1, 0, Infinity), | 87 () => context = new OfflineAudioContext(1, 0, Infinity), |
| 88 'context = new OfflineAudioContext(1, 0, Infinity)') | 88 'context12 = new OfflineAudioContext(1, 0, Infinity)') |
| 89 .throw(); | 89 .throw(); |
| 90 // Verify channel counts and other destination attributes are set correctly. | 90 // Verify channel counts and other destination attributes are set correctly. |
| 91 should( | 91 should( |
| 92 () => context = new OfflineAudioContext(7, 512, 48000), | 92 () => context = new OfflineAudioContext(7, 512, 48000), |
| 93 'context = new OfflineAudioContext(7, 512, 48000)') | 93 'context13 = new OfflineAudioContext(7, 512, 48000)') |
| 94 .notThrow(); | 94 .notThrow(); |
| 95 should(context.destination.channelCount, 'context.destination.channelCount') | 95 should(context.destination.channelCount, 'context13.destination.channelCount') |
| 96 .beEqualTo(7); | 96 .beEqualTo(7); |
| 97 should( | 97 should( |
| 98 context.destination.maxChannelCount, | 98 context.destination.maxChannelCount, |
| 99 'context.destination.maxChannelCount') | 99 'context13.destination.maxChannelCount') |
| 100 .beEqualTo(7); | 100 .beEqualTo(7); |
| 101 should( | 101 should( |
| 102 context.destination.channelCountMode, | 102 context.destination.channelCountMode, |
| 103 'context.destination.channelCountMode') | 103 'context13.destination.channelCountMode') |
| 104 .beEqualTo('explicit'); | 104 .beEqualTo('explicit'); |
| 105 should( | 105 should( |
| 106 context.destination.channelInterpretation, | 106 context.destination.channelInterpretation, |
| 107 'context.destination.channelInterpretation') | 107 'context13.destination.channelInterpretation') |
| 108 .beEqualTo('speakers'); | 108 .beEqualTo('speakers'); |
| 109 | 109 |
| 110 task.done(); | 110 task.done(); |
| 111 }); | 111 }); |
| 112 | 112 |
| 113 audit.run(); | 113 audit.run(); |
| 114 </script> | 114 </script> |
| 115 </body> | 115 </body> |
| 116 </html> | 116 </html> |
| OLD | NEW |