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

Side by Side Diff: tests/html/audiocontext_test.dart

Issue 28973003: Test for OscillatorNode.type=. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.h ('k') | tests/html/html.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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:typed_data'; 5 import 'dart:typed_data';
6 import 'dart:web_audio'; 6 import 'dart:web_audio';
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 main() { 9 main() {
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 expect(context.createAnalyser() is AnalyserNode, isTrue); 53 expect(context.createAnalyser() is AnalyserNode, isTrue);
54 expect(context.createChannelMerger() is AudioNode, isTrue); 54 expect(context.createChannelMerger() is AudioNode, isTrue);
55 expect(context.createChannelSplitter() is AudioNode, isTrue); 55 expect(context.createChannelSplitter() is AudioNode, isTrue);
56 expect(context.createOscillator() is OscillatorNode, isTrue); 56 expect(context.createOscillator() is OscillatorNode, isTrue);
57 expect(context.createPanner() is PannerNode, isTrue); 57 expect(context.createPanner() is PannerNode, isTrue);
58 expect(context.createScriptProcessor(4096) is ScriptProcessorNode, 58 expect(context.createScriptProcessor(4096) is ScriptProcessorNode,
59 isTrue); 59 isTrue);
60 } 60 }
61 }); 61 });
62 62
63 // TODO(9322): This test times out.
64 /*
63 test('onAudioProcess', () { 65 test('onAudioProcess', () {
64 if(AudioContext.supported) { 66 if(AudioContext.supported) {
65 var completer = new Completer<bool>(); 67 var completer = new Completer<bool>();
66 var context = new AudioContext(); 68 var context = new AudioContext();
67 var scriptProcessor = context.createScriptProcessor(1024, 1, 2); 69 var scriptProcessor = context.createScriptProcessor(1024, 1, 2);
68 scriptProcessor.connectNode(context.destination); 70 scriptProcessor.connectNode(context.destination);
69 bool alreadyCalled = false; 71 bool alreadyCalled = false;
70 scriptProcessor.onAudioProcess.listen((event) { 72 scriptProcessor.onAudioProcess.listen((event) {
71 if (!alreadyCalled) { 73 if (!alreadyCalled) {
72 completer.complete(true); 74 completer.complete(true);
73 } 75 }
74 alreadyCalled = true; 76 alreadyCalled = true;
75 }); 77 });
76 return completer.future; 78 return completer.future;
77 } 79 }
78 }); 80 });
81 */
82
83 test('oscillatorTypes', () {
84 if(AudioContext.supported) {
85 AudioContext context = new AudioContext();
86 OscillatorNode oscillator = context.createOscillator();
87 oscillator.connectNode(context.destination);
88
89 oscillator.type = 'sawtooth';
90 expect(oscillator.type, equals('sawtooth'));
91
92 oscillator.type = 'sine';
93 expect(oscillator.type, equals('sine'));
94
95 oscillator.type = 'square';
96 expect(oscillator.type, equals('square'));
97
98 oscillator.type = 'triangle';
99 expect(oscillator.type, equals('triangle'));
100
101 expect(() => oscillator.type = 'somethingUnsupported', throws);
102 expect(oscillator.type, equals('triangle'));
103
104 expect(() => oscillator.type = 7, throws);
105 expect(oscillator.type, equals('triangle'));
106
107 expect(() => oscillator.type = ['heap object not a string'], throws);
108 expect(oscillator.type, equals('triangle'));
109 }
110 });
79 }); 111 });
80 } 112 }
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | tests/html/html.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698