| OLD | NEW |
| 1 library AudioContextTest; | 1 library AudioContextTest; |
| 2 import '../../pkg/unittest/lib/unittest.dart'; | 2 import '../../pkg/unittest/lib/unittest.dart'; |
| 3 import '../../pkg/unittest/lib/html_individual_config.dart'; | 3 import '../../pkg/unittest/lib/html_individual_config.dart'; |
| 4 import 'dart:html'; | 4 import 'dart:html'; |
| 5 import 'dart:typeddata'; |
| 5 import 'dart:web_audio'; | 6 import 'dart:web_audio'; |
| 6 import 'dart:async'; | 7 import 'dart:async'; |
| 7 | 8 |
| 8 main() { | 9 main() { |
| 9 | 10 |
| 10 useHtmlIndividualConfiguration(); | 11 useHtmlIndividualConfiguration(); |
| 11 | 12 |
| 12 var isAudioContext = | 13 var isAudioContext = |
| 13 predicate((x) => x is AudioContext, 'is an AudioContext'); | 14 predicate((x) => x is AudioContext, 'is an AudioContext'); |
| 14 | 15 |
| 15 group('supported', () { | 16 group('supported', () { |
| 16 test('supported', () { | 17 test('supported', () { |
| 17 expect(AudioContext.supported, true); | 18 expect(AudioContext.supported, true); |
| 18 }); | 19 }); |
| 19 }); | 20 }); |
| 20 | 21 |
| 21 group('functional', () { | 22 group('functional', () { |
| 22 test('constructorTest', () { | 23 test('constructorTest', () { |
| 23 if(AudioContext.supported) { | 24 if(AudioContext.supported) { |
| 24 var ctx = new AudioContext(); | 25 var ctx = new AudioContext(); |
| 25 expect(ctx, isNotNull); | 26 expect(ctx, isNotNull); |
| 26 expect(ctx, isAudioContext); | 27 expect(ctx, isAudioContext); |
| 27 } | 28 } |
| 28 }); | 29 }); |
| 29 | 30 |
| 30 test('createBuffer', () { | 31 test('createBuffer', () { |
| 31 if(AudioContext.supported) { | 32 if(AudioContext.supported) { |
| 32 var ctx = new AudioContext(); | 33 var ctx = new AudioContext(); |
| 33 ArrayBufferView arrayBufferView = new Float32Array.fromList([]); | 34 Float32List view = new Float32List.fromList([]); |
| 34 try { | 35 try { |
| 35 // Test that native overload is chosen correctly. Native | 36 // Test that native overload is chosen correctly. Native |
| 36 // implementation should throw 'SyntaxError' DomException because the | 37 // implementation should throw 'SyntaxError' DomException because the |
| 37 // buffer is empty. | 38 // buffer is empty. |
| 38 AudioBuffer buffer = ctx.createBuffer(arrayBufferView.buffer, false); | 39 AudioBuffer buffer = ctx.createBuffer(view.buffer, false); |
| 39 } catch (e) { | 40 } catch (e) { |
| 40 expect(e.name, DomException.SYNTAX); | 41 expect(e.name, DomException.SYNTAX); |
| 41 } | 42 } |
| 42 } | 43 } |
| 43 }); | 44 }); |
| 44 | 45 |
| 45 test('audioRenames', () { | 46 test('audioRenames', () { |
| 46 if(AudioContext.supported) { | 47 if(AudioContext.supported) { |
| 47 AudioContext context = new AudioContext(); | 48 AudioContext context = new AudioContext(); |
| 48 GainNode gainNode = context.createGain(); | 49 GainNode gainNode = context.createGain(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 70 if (!alreadyCalled) { | 71 if (!alreadyCalled) { |
| 71 completer.complete(true); | 72 completer.complete(true); |
| 72 } | 73 } |
| 73 alreadyCalled = true; | 74 alreadyCalled = true; |
| 74 }); | 75 }); |
| 75 return completer.future; | 76 return completer.future; |
| 76 } | 77 } |
| 77 }); | 78 }); |
| 78 }); | 79 }); |
| 79 } | 80 } |
| OLD | NEW |