Title: [123662] trunk
Revision
123662
Author
commit-qu...@webkit.org
Date
2012-07-25 14:33:53 -0700 (Wed, 25 Jul 2012)

Log Message

It is invalid when both numberOfInputChannels and numberOfOutputChannels to be zero in _javascript_AudioNode.
https://bugs.webkit.org/show_bug.cgi?id=91364

Patch by Li Yin <li....@intel.com> on 2012-07-25
Reviewed by Kenneth Russell.

Source/WebCore:

Spec: http://www.w3.org/TR/webaudio/#_javascript_AudioNode-section
It is invalid for both numberOfInputChannels and numberOfOutputChannels to be zero.

Test: webaudio/_javascript_audionode.html

* Modules/webaudio/_javascript_AudioNode.cpp:
(WebCore::_javascript_AudioNode::create):

LayoutTests:

Add tests for (numberOfInputChannels, numberOfOutputChannels) to be (0, 0),(0, 1),(0, 2),(1, 0) and (2, 0).

* webaudio/_javascript_audionode-expected.txt:
* webaudio/_javascript_audionode.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (123661 => 123662)


--- trunk/LayoutTests/ChangeLog	2012-07-25 21:28:42 UTC (rev 123661)
+++ trunk/LayoutTests/ChangeLog	2012-07-25 21:33:53 UTC (rev 123662)
@@ -1,3 +1,15 @@
+2012-07-25  Li Yin  <li....@intel.com>
+
+        It is invalid when both numberOfInputChannels and numberOfOutputChannels to be zero in _javascript_AudioNode.
+        https://bugs.webkit.org/show_bug.cgi?id=91364
+
+        Reviewed by Kenneth Russell.
+
+        Add tests for (numberOfInputChannels, numberOfOutputChannels) to be (0, 0),(0, 1),(0, 2),(1, 0) and (2, 0).
+
+        * webaudio/_javascript_audionode-expected.txt:
+        * webaudio/_javascript_audionode.html:
+
 2012-07-25  Andrew Wilson  <atwil...@chromium.org>
 
         Unreviewed chromium expectations change.

Modified: trunk/LayoutTests/webaudio/_javascript_audionode-expected.txt (123661 => 123662)


--- trunk/LayoutTests/webaudio/_javascript_audionode-expected.txt	2012-07-25 21:28:42 UTC (rev 123661)
+++ trunk/LayoutTests/webaudio/_javascript_audionode-expected.txt	2012-07-25 21:33:53 UTC (rev 123662)
@@ -2,7 +2,11 @@
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
-PASS Exception was thrown for illegal numberOfOutputChannels.
+PASS Exception was thrown when both numberOfInputChannels and numberOfOutputChannels are zero.
+PASS Successfully created _javascript_AudioNode with numberOfInputChannels = 1 and numberOfOutputChannels = 0.
+PASS Successfully created _javascript_AudioNode with numberOfInputChannels = 2 and numberOfOutputChannels = 0.
+PASS Successfully created _javascript_AudioNode with numberOfInputChannels = 0 and numberOfOutputChannels = 1.
+PASS Successfully created _javascript_AudioNode with numberOfInputChannels = 0 and numberOfOutputChannels = 2.
 PASS Exception was thrown for illegal bufferSize.
 PASS Successfully created _javascript_AudioNode with bufferSize = 256.
 PASS Successfully created _javascript_AudioNode with bufferSize = 512.

Modified: trunk/LayoutTests/webaudio/_javascript_audionode.html (123661 => 123662)


--- trunk/LayoutTests/webaudio/_javascript_audionode.html	2012-07-25 21:28:42 UTC (rev 123661)
+++ trunk/LayoutTests/webaudio/_javascript_audionode.html	2012-07-25 21:33:53 UTC (rev 123662)
@@ -1,5 +1,4 @@
 <!DOCTYPE html>
-
 <html>
 <head>
 <script src=""
@@ -88,13 +87,41 @@
     context = new webkitAudioContext(2, renderLengthInFrames, sampleRate);
 
     try {
+        var jsnode = context.createJavaScriptNode(512, 0, 0);
+        testFailed("Exception should be thrown when both numberOfInputChannels and numberOfOutputChannels are zero.");
+    } catch(e) {
+        testPassed("Exception was thrown when both numberOfInputChannels and numberOfOutputChannels are zero.");
+    }
+    
+    try {
         var jsnode = context.createJavaScriptNode(512, 1, 0);
-        testFailed("Exception should be thrown for illegal numberOfOutputChannels.");
+        testPassed("Successfully created _javascript_AudioNode with numberOfInputChannels = 1 and numberOfOutputChannels = 0.");
     } catch(e) {
-        testPassed("Exception was thrown for illegal numberOfOutputChannels.");
+        testFailed("Exception should not be thrown when numberOfInputChannels = 1 and numberOfOutputChannels = 0.");
     }
-
+    
     try {
+        var jsnode = context.createJavaScriptNode(512, 2, 0);
+        testPassed("Successfully created _javascript_AudioNode with numberOfInputChannels = 2 and numberOfOutputChannels = 0.");
+    } catch(e) {
+        testFailed("Exception should not be thrown when numberOfInputChannels = 2 and numberOfOutputChannels = 0.");
+    }
+    
+    try {
+        var jsnode = context.createJavaScriptNode(512, 0, 1);
+        testPassed("Successfully created _javascript_AudioNode with numberOfInputChannels = 0 and numberOfOutputChannels = 1.");
+    } catch(e) {
+        testFailed("Exception should not be thrown when numberOfInputChannels = 0 and numberOfOutputChannels = 1.");
+    }
+    
+    try {
+        var jsnode = context.createJavaScriptNode(512, 0, 2);
+        testPassed("Successfully created _javascript_AudioNode with numberOfInputChannels = 0 and numberOfOutputChannels = 2.");
+    } catch(e) {
+        testFailed("Exception should not be thrown when numberOfInputChannels = 0 and numberOfOutputChannels = 2.");
+    }
+    
+    try {
         var jsnode = context.createJavaScriptNode(511, 1, 1);
         testFailed("Exception should be thrown for illegal bufferSize.");
     } catch(e) {

Modified: trunk/Source/WebCore/ChangeLog (123661 => 123662)


--- trunk/Source/WebCore/ChangeLog	2012-07-25 21:28:42 UTC (rev 123661)
+++ trunk/Source/WebCore/ChangeLog	2012-07-25 21:33:53 UTC (rev 123662)
@@ -1,3 +1,18 @@
+2012-07-25  Li Yin  <li....@intel.com>
+
+        It is invalid when both numberOfInputChannels and numberOfOutputChannels to be zero in _javascript_AudioNode.
+        https://bugs.webkit.org/show_bug.cgi?id=91364
+
+        Reviewed by Kenneth Russell.
+
+        Spec: http://www.w3.org/TR/webaudio/#_javascript_AudioNode-section
+        It is invalid for both numberOfInputChannels and numberOfOutputChannels to be zero.
+
+        Test: webaudio/_javascript_audionode.html
+
+        * Modules/webaudio/_javascript_AudioNode.cpp:
+        (WebCore::_javascript_AudioNode::create):
+
 2012-07-24  Shawn Singh  <shawnsi...@chromium.org>
 
         [chromium] Refactor CCLayerTreeHostCommon: move root layer special case initialization into internal code.

Modified: trunk/Source/WebCore/Modules/webaudio/_javascript_AudioNode.cpp (123661 => 123662)


--- trunk/Source/WebCore/Modules/webaudio/_javascript_AudioNode.cpp	2012-07-25 21:28:42 UTC (rev 123661)
+++ trunk/Source/WebCore/Modules/webaudio/_javascript_AudioNode.cpp	2012-07-25 21:33:53 UTC (rev 123662)
@@ -58,10 +58,13 @@
         return 0;
     }
 
+    if (!numberOfInputChannels && !numberOfOutputChannels)
+        return 0;
+
     if (numberOfInputChannels > AudioContext::maxNumberOfChannels())
         return 0;
 
-    if (!numberOfOutputChannels || numberOfOutputChannels > AudioContext::maxNumberOfChannels())
+    if (numberOfOutputChannels > AudioContext::maxNumberOfChannels())
         return 0;
 
     return adoptRef(new _javascript_AudioNode(context, sampleRate, bufferSize, numberOfInputChannels, numberOfOutputChannels));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to