Changeset 123662 in webkit


Ignore:
Timestamp:
Jul 25, 2012, 2:33:53 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

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

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

Source/WebCore:

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

Test: webaudio/javascriptaudionode.html

  • Modules/webaudio/JavaScriptAudioNode.cpp:

(WebCore::JavaScriptAudioNode::create):

LayoutTests:

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

  • webaudio/javascriptaudionode-expected.txt:
  • webaudio/javascriptaudionode.html:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r123659 r123662  
     12012-07-25  Li Yin  <li.yin@intel.com>
     2
     3        It is invalid when both numberOfInputChannels and numberOfOutputChannels to be zero in JavaScriptAudioNode.
     4        https://bugs.webkit.org/show_bug.cgi?id=91364
     5
     6        Reviewed by Kenneth Russell.
     7
     8        Add tests for (numberOfInputChannels, numberOfOutputChannels) to be (0, 0),(0, 1),(0, 2),(1, 0) and (2, 0).
     9
     10        * webaudio/javascriptaudionode-expected.txt:
     11        * webaudio/javascriptaudionode.html:
     12
    1132012-07-25  Andrew Wilson  <atwilson@chromium.org>
    214
  • trunk/LayoutTests/webaudio/javascriptaudionode-expected.txt

    r114196 r123662  
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    44
    5 PASS Exception was thrown for illegal numberOfOutputChannels.
     5PASS Exception was thrown when both numberOfInputChannels and numberOfOutputChannels are zero.
     6PASS Successfully created JavaScriptAudioNode with numberOfInputChannels = 1 and numberOfOutputChannels = 0.
     7PASS Successfully created JavaScriptAudioNode with numberOfInputChannels = 2 and numberOfOutputChannels = 0.
     8PASS Successfully created JavaScriptAudioNode with numberOfInputChannels = 0 and numberOfOutputChannels = 1.
     9PASS Successfully created JavaScriptAudioNode with numberOfInputChannels = 0 and numberOfOutputChannels = 2.
    610PASS Exception was thrown for illegal bufferSize.
    711PASS Successfully created JavaScriptAudioNode with bufferSize = 256.
  • trunk/LayoutTests/webaudio/javascriptaudionode.html

    r120521 r123662  
    11<!DOCTYPE html>
    2 
    32<html>
    43<head>
     
    8988
    9089    try {
     90        var jsnode = context.createJavaScriptNode(512, 0, 0);
     91        testFailed("Exception should be thrown when both numberOfInputChannels and numberOfOutputChannels are zero.");
     92    } catch(e) {
     93        testPassed("Exception was thrown when both numberOfInputChannels and numberOfOutputChannels are zero.");
     94    }
     95   
     96    try {
    9197        var jsnode = context.createJavaScriptNode(512, 1, 0);
    92         testFailed("Exception should be thrown for illegal numberOfOutputChannels.");
     98        testPassed("Successfully created JavaScriptAudioNode with numberOfInputChannels = 1 and numberOfOutputChannels = 0.");
    9399    } catch(e) {
    94         testPassed("Exception was thrown for illegal numberOfOutputChannels.");
     100        testFailed("Exception should not be thrown when numberOfInputChannels = 1 and numberOfOutputChannels = 0.");
    95101    }
    96 
     102   
     103    try {
     104        var jsnode = context.createJavaScriptNode(512, 2, 0);
     105        testPassed("Successfully created JavaScriptAudioNode with numberOfInputChannels = 2 and numberOfOutputChannels = 0.");
     106    } catch(e) {
     107        testFailed("Exception should not be thrown when numberOfInputChannels = 2 and numberOfOutputChannels = 0.");
     108    }
     109   
     110    try {
     111        var jsnode = context.createJavaScriptNode(512, 0, 1);
     112        testPassed("Successfully created JavaScriptAudioNode with numberOfInputChannels = 0 and numberOfOutputChannels = 1.");
     113    } catch(e) {
     114        testFailed("Exception should not be thrown when numberOfInputChannels = 0 and numberOfOutputChannels = 1.");
     115    }
     116   
     117    try {
     118        var jsnode = context.createJavaScriptNode(512, 0, 2);
     119        testPassed("Successfully created JavaScriptAudioNode with numberOfInputChannels = 0 and numberOfOutputChannels = 2.");
     120    } catch(e) {
     121        testFailed("Exception should not be thrown when numberOfInputChannels = 0 and numberOfOutputChannels = 2.");
     122    }
     123   
    97124    try {
    98125        var jsnode = context.createJavaScriptNode(511, 1, 1);
  • trunk/Source/WebCore/ChangeLog

    r123654 r123662  
     12012-07-25  Li Yin  <li.yin@intel.com>
     2
     3        It is invalid when both numberOfInputChannels and numberOfOutputChannels to be zero in JavaScriptAudioNode.
     4        https://bugs.webkit.org/show_bug.cgi?id=91364
     5
     6        Reviewed by Kenneth Russell.
     7
     8        Spec: http://www.w3.org/TR/webaudio/#JavaScriptAudioNode-section
     9        It is invalid for both numberOfInputChannels and numberOfOutputChannels to be zero.
     10
     11        Test: webaudio/javascriptaudionode.html
     12
     13        * Modules/webaudio/JavaScriptAudioNode.cpp:
     14        (WebCore::JavaScriptAudioNode::create):
     15
    1162012-07-24  Shawn Singh  <shawnsingh@chromium.org>
    217
  • trunk/Source/WebCore/Modules/webaudio/JavaScriptAudioNode.cpp

    r116465 r123662  
    5959    }
    6060
     61    if (!numberOfInputChannels && !numberOfOutputChannels)
     62        return 0;
     63
    6164    if (numberOfInputChannels > AudioContext::maxNumberOfChannels())
    6265        return 0;
    6366
    64     if (!numberOfOutputChannels || numberOfOutputChannels > AudioContext::maxNumberOfChannels())
     67    if (numberOfOutputChannels > AudioContext::maxNumberOfChannels())
    6568        return 0;
    6669
Note: See TracChangeset for help on using the changeset viewer.