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