Chromium Code Reviews| 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:web_audio'; | 5 import 'dart:web_audio'; |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 | 7 |
| 8 main() { | 8 main() { |
| 9 | 9 |
| 10 useHtmlIndividualConfiguration(); | 10 useHtmlIndividualConfiguration(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 }); | 43 }); |
| 44 | 44 |
| 45 test('audioRenames', () { | 45 test('audioRenames', () { |
| 46 if(AudioContext.supported) { | 46 if(AudioContext.supported) { |
| 47 AudioContext context = new AudioContext(); | 47 AudioContext context = new AudioContext(); |
| 48 GainNode gainNode = context.createGain(); | 48 GainNode gainNode = context.createGain(); |
| 49 gainNode.connect(context.destination, 0, 0); | 49 gainNode.connect(context.destination, 0, 0); |
| 50 expect(gainNode is GainNode, isTrue); | 50 expect(gainNode is GainNode, isTrue); |
| 51 | 51 |
| 52 expect(context.createAnalyser() is AnalyserNode, isTrue); | 52 expect(context.createAnalyser() is AnalyserNode, isTrue); |
| 53 expect(context.createChannelMerger() is ChannelMergerNode, isTrue); | 53 expect(context.createChannelMerger() is AudioNode, isTrue); |
|
Emily Fortuna
2013/03/18 23:44:26
this is for Safari. my guess is we're checking the
| |
| 54 expect(context.createChannelSplitter() is ChannelSplitterNode, isTrue); | 54 expect(context.createChannelSplitter() is AudioNode, isTrue); |
| 55 expect(context.createOscillator() is OscillatorNode, isTrue); | 55 expect(context.createOscillator() is OscillatorNode, isTrue); |
| 56 expect(context.createPanner() is PannerNode, isTrue); | 56 expect(context.createPanner() is PannerNode, isTrue); |
| 57 expect(context.createScriptProcessor(4096) is ScriptProcessorNode, | 57 expect(context.createScriptProcessor(4096) is ScriptProcessorNode, |
| 58 isTrue); | 58 isTrue); |
| 59 } | 59 } |
| 60 }); | 60 }); |
| 61 | 61 |
| 62 test('onAudioProcess', () { | 62 test('onAudioProcess', () { |
| 63 if(AudioContext.supported) { | 63 if(AudioContext.supported) { |
| 64 var completer = new Completer<bool>(); | 64 var completer = new Completer<bool>(); |
| 65 var context = new AudioContext(); | 65 var context = new AudioContext(); |
| 66 var scriptProcessor = context.createScriptProcessor(1024, 1, 2); | 66 var scriptProcessor = context.createScriptProcessor(1024, 1, 2); |
| 67 scriptProcessor.connect(context.destination, 0, 0); | 67 scriptProcessor.connect(context.destination, 0, 0); |
| 68 bool alreadyCalled = false; | 68 bool alreadyCalled = false; |
| 69 scriptProcessor.onAudioProcess.listen((event) { | 69 scriptProcessor.onAudioProcess.listen((event) { |
| 70 if (!alreadyCalled) { | 70 if (!alreadyCalled) { |
| 71 completer.complete(true); | 71 completer.complete(true); |
| 72 } | 72 } |
| 73 alreadyCalled = true; | 73 alreadyCalled = true; |
| 74 }); | 74 }); |
| 75 return completer.future; | 75 return completer.future; |
| 76 } | 76 } |
| 77 }); | 77 }); |
| 78 }); | 78 }); |
| 79 } | 79 } |
| OLD | NEW |