Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(567)

Unified Diff: tests/html/audiocontext_test.dart

Issue 11510013: Making ScriptProcessorNode not an EventTarget. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/html/audiocontext_test.dart
diff --git a/tests/html/audiocontext_test.dart b/tests/html/audiocontext_test.dart
index 33a7907181e09937bb7bcd291cbb7fd9a9700223..8fe9027585217659163c7fc4a90a9668f15200b3 100644
--- a/tests/html/audiocontext_test.dart
+++ b/tests/html/audiocontext_test.dart
@@ -1,44 +1,79 @@
library AudioContextTest;
import '../../pkg/unittest/lib/unittest.dart';
-import '../../pkg/unittest/lib/html_config.dart';
+import '../../pkg/unittest/lib/html_individual_config.dart';
import 'dart:html';
import 'dart:web_audio';
+import 'dart:async';
main() {
- useHtmlConfiguration();
+ useHtmlIndividualConfiguration();
var isAudioContext =
predicate((x) => x is AudioContext, 'is an AudioContext');
- test('constructorTest', () {
- var ctx = new AudioContext();
- expect(ctx, isNotNull);
- expect(ctx, isAudioContext);
+ group('supported', () {
+ test('supported', () {
+ expect(AudioContext.supported, true);
+ });
});
- test('createBuffer', () {
- var ctx = new AudioContext();
- ArrayBufferView arrayBufferView = new Float32Array.fromList([]);
- try {
- // Test that native overload is chosen correctly. Native implementation
- // should throw 'SyntaxError' DomException because the buffer is empty.
- AudioBuffer buffer = ctx.createBuffer(arrayBufferView.buffer, false);
- } catch (e) {
- expect(e.name, DomException.SYNTAX);
+
+ group('functional', () {
+ test('constructorTest', () {
+ if(AudioContext.supported) {
+ var ctx = new AudioContext();
+ expect(ctx, isNotNull);
+ expect(ctx, isAudioContext);
}
- });
+ });
+
+ test('createBuffer', () {
+ if(AudioContext.supported) {
+ var ctx = new AudioContext();
+ ArrayBufferView arrayBufferView = new Float32Array.fromList([]);
+ try {
+ // Test that native overload is chosen correctly. Native
+ // implementation should throw 'SyntaxError' DomException because the
+ // buffer is empty.
+ AudioBuffer buffer = ctx.createBuffer(arrayBufferView.buffer, false);
+ } catch (e) {
+ expect(e.name, DomException.SYNTAX);
+ }
+ }
+ });
- test('audioRenames', () {
- AudioContext context = new AudioContext();
- GainNode gainNode = context.createGain();
- gainNode.connect(context.destination, 0, 0);
- expect(gainNode is GainNode, isTrue);
-
- expect(context.createAnalyser() is AnalyserNode, isTrue);
- expect(context.createChannelMerger() is ChannelMergerNode, isTrue);
- expect(context.createChannelSplitter() is ChannelSplitterNode, isTrue);
- expect(context.createOscillator() is OscillatorNode, isTrue);
- expect(context.createPanner() is PannerNode, isTrue);
- expect(context.createScriptProcessor(4096) is ScriptProcessorNode, isTrue);
+ test('audioRenames', () {
+ if(AudioContext.supported) {
+ AudioContext context = new AudioContext();
+ GainNode gainNode = context.createGain();
+ gainNode.connect(context.destination, 0, 0);
+ expect(gainNode is GainNode, isTrue);
+
+ expect(context.createAnalyser() is AnalyserNode, isTrue);
+ expect(context.createChannelMerger() is ChannelMergerNode, isTrue);
+ expect(context.createChannelSplitter() is ChannelSplitterNode, isTrue);
+ expect(context.createOscillator() is OscillatorNode, isTrue);
+ expect(context.createPanner() is PannerNode, isTrue);
+ expect(context.createScriptProcessor(4096) is ScriptProcessorNode,
+ isTrue);
+ }
+ });
+
+ test('onAudioProcess', () {
+ if(AudioContext.supported) {
+ var completer = new Completer<bool>();
+ var context = new AudioContext();
+ var scriptProcessor = context.createScriptProcessor(1024, 1, 2);
+ scriptProcessor.connect(context.destination, 0, 0);
+ bool alreadyCalled = false;
+ scriptProcessor.onAudioProcess.listen((event) {
+ if (!alreadyCalled) {
+ completer.complete(true);
+ }
+ alreadyCalled = true;
+ });
+ return completer.future;
+ }
+ });
});
}

Powered by Google App Engine
This is Rietveld 408576698