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

Side by Side Diff: LayoutTests/webaudio/dom-exceptions.html

Issue 24877002: Add more informative messages for DOM exceptions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <link rel="stylesheet" href="../fast/js/resources/js-test-style.css"/>
5 <script src="resources/audio-testing.js"></script>
6 <script src="../fast/js/resources/js-test-pre.js"></script>
7 <script src="resources/biquad-testing.js"></script>
8 </head>
9
10 <body>
11
12 <div id="description"></div>
13 <div id="console"></div>
14 <script>
15 description("Tests DOM exception messages");
16
17 var context;
18 var otherContext;
19 var node;
20 var node2;
21 var mode;
22
23 function runTest() {
24 if (window.testRunner) {
25 testRunner.dumpAsText();
26 }
27
28 context = new webkitAudioContext();
29 otherContext = new webkitAudioContext();
30
31 // Test createion of various objects
32
33 // Invalid number of channels
34 shouldThrow("context.createBuffer(99, 1, context.sampleRate)");
35 // Invalid sample rate
36 shouldThrow("context.createBuffer(1, 1, 1)");
37 // Invalid ArrayBuffer
38 shouldThrow("context.createBuffer(new ArrayBuffer(100), true)");
39 // Invalid ArrayBuffer
40 shouldThrow("context.decodeAudioData(null, function() {}, function () {})");
41 // Invalid sources
42 shouldThrow("context.createMediaElementSource(null)");
43 shouldThrow("context.createMediaElementAudioSource(null)");
44 // Invalid buffer size
45 shouldThrow("context.createScriptProcessor(1, 1, 1)");
46 // Invalid number of inputs and outputs
47 shouldThrow("context.createScriptProcessor(4096, 100, 100)");
48 // Invalid number of channels
49 shouldThrow("context.createChannelSplitter(0)");
50 shouldThrow("context.createChannelSplitter(99)");
51 shouldThrow("context.createChannelMerger(0)");
52 shouldThrow("context.createChannelMerger(99)");
53 // Invalid real/imag arrays
54 shouldThrow("context.createPeriodicWave(null, null)");
55 // Real and imaginary arrays must have the same size
56 shouldThrow("context.createPeriodicWave(new ArrayBuffer(10), new ArrayBuffer (7))");
57
58 // Analysers
59 node = context.createAnalyser();
60 // Invalid fftSize
61 shouldThrow("node.fftSize = 42");
62
63 // AudioBuffers
64 node = context.createBuffer(1,1, context.sampleRate);
65 // Invalid channel index
66 shouldThrow("node.getChannelData(2)");
67
68 // AudioNode connections
69 node = context.createGain();
70 node2 = context.createGain();
71 // Invalid destination node
72 shouldThrow("node.connect(null, 0, 0)");
73 // Invalid input or output index
74 shouldThrow("node.connect(context.destination, 100, 0)");
75 shouldThrow("node.connect(context.destination, 0, 100)");
76 shouldThrow("node.connect(node2.gain, 100)");
77 shouldThrow("node.disconnect(99)");
78 // Can't connect to a different context
79 shouldThrow("node.connect(otherContext.destination)");
80
81 // Invalid channel count
82 shouldThrow("node.channelCount = 99");
83 // Invalid mode or interpretation
84 mode = "fancy";
85 shouldThrow("node.channelCountMode = mode");
86 shouldThrow("node.channelInterpretation = mode");
87
88 // Destination
89 shouldThrow("context.destination.channelCount = 99");
90
91 // Delay
92 shouldThrow("context.createDelay(-1)");
93 shouldThrow("context.createDelay(1000000)");
94
95 shouldThrow("new webkitOfflineAudioContext(99, 100, context.sampleRate)");
96 shouldThrow("new webkitOfflineAudioContext(1, 100, 1)");
97
98 }
99
100 runTest();
101 successfullyParsed = true;
102
103 </script>
104 <script src="../fast/js/resources/js-test-post.js"></script>
105 </body>
106 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698