Bug 92620 - Add test for decodeAudioData
Summary: Add test for decodeAudioData
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Audio (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Li Yin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-30 01:52 PDT by Li Yin
Modified: 2012-08-23 11:43 PDT (History)
5 users (show)

See Also:


Attachments
Patch (4.76 KB, patch)
2012-08-01 01:25 PDT, Li Yin
no flags Details | Formatted Diff | Diff
Patch (5.16 KB, patch)
2012-08-01 01:49 PDT, Li Yin
no flags Details | Formatted Diff | Diff
Patch (4.53 KB, patch)
2012-08-01 06:06 PDT, Li Yin
no flags Details | Formatted Diff | Diff
Patch (4.41 KB, patch)
2012-08-01 18:41 PDT, Li Yin
no flags Details | Formatted Diff | Diff
Patch (4.55 KB, patch)
2012-08-01 19:32 PDT, Li Yin
no flags Details | Formatted Diff | Diff
Patch (4.55 KB, patch)
2012-08-02 17:57 PDT, Li Yin
no flags Details | Formatted Diff | Diff
Patch (4.59 KB, patch)
2012-08-02 19:19 PDT, Li Yin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 Li Yin 2012-08-01 01:25:20 PDT
Created attachment 155749 [details]
Patch
Comment 2 Li Yin 2012-08-01 01:44:10 PDT
The purpose of designing this test is to check if callback function can be invoked correctly.
For the successCallback scenario, I can't find an audio file which can be decoded successfully in all platforms.

The test can work correctly in chromium-linux platform, but I don't verify the result in chromium-win.
In addition, the test is time out for chromium on MAC, I think the root cause is that it doesn't support ogg decoding.(If I am wrong, please feel free to correct me.)

Hi Raymond,
   You designed codec tests, could you please give some advices? Thanks in advance.
Comment 3 Li Yin 2012-08-01 01:49:10 PDT
Created attachment 155753 [details]
Patch
Comment 4 Li Yin 2012-08-01 06:06:48 PDT
Created attachment 155792 [details]
Patch
Comment 5 Li Yin 2012-08-01 06:07:59 PDT
(In reply to comment #2)
> The purpose of designing this test is to check if callback function can be invoked correctly.
> For the successCallback scenario, I can't find an audio file which can be decoded successfully in all platforms.

Sorry for the incorrect information, ogg format file should be decoded correctly for chromium on Linux, MAC and Windows.

> 
> The test can work correctly in chromium-linux platform, but I don't verify the result in chromium-win.
> In addition, the test is time out for chromium on MAC, I think the root cause is that it doesn't support ogg decoding.(If I am wrong, please feel free to correct me.)

Sorry, the test can work correctly for chromium on MAC.
Comment 6 Raymond Toy 2012-08-01 09:21:56 PDT
Comment on attachment 155792 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=155792&action=review

Just a few minor comments on implementation.  Otherwise, the test looks good.

> LayoutTests/ChangeLog:14
> +        * webaudio/resources/media/error-format.txt: Added.

Perhaps a more obvious name would be good.  Something like invalid-audio-file.txt.  

Might also be useful to have a real ogg (or mp3 or aac) file that we've manually corrupted in some way.  There are also some Microsoft ADPCM wav files that we cannot decode because it's not supported by chromium.

> LayoutTests/webaudio/decode-audio-data-basic.html:36
> +    debug("The " + index + " test: " + decodeCaseArray[index][0]);

Is this debug needed?  I think it should be removed.  You can add this information in the testPassed/testFailed messages.

> LayoutTests/webaudio/decode-audio-data-basic.html:47
> +                testPassed("successCallback has been called correctly.");

As mentioned above, the message can include information about the test.  I think that's better than the debug call above.

> LayoutTests/webaudio/decode-audio-data-basic.html:48
> +                runDecodeTest(++index);

Do you need to call runDecodeTest here?  Can you just call runDecodeTest(1) at the end of the file?

> LayoutTests/webaudio/decode-audio-data-basic.html:51
> +                finishedJSTest();

Can finishedJSTest() be called at the end of the file, after calling runDecodeTest(1)?

> LayoutTests/webaudio/decode-audio-data-basic.html:58
> +                finishJSTest();

Same comment as for line 51.

> LayoutTests/webaudio/decode-audio-data-basic.html:61
> +                runDecodeTest(++index);

Same comment as for line 48.

> LayoutTests/webaudio/decode-audio-data-basic.html:68
> +runDecodeTest(0);

Can we just do

runDecodeTest(0);
runDecodeTest(1);
finishJSTest();

I think this makes it clearer which tests are being run.  It looks like with the current code, if runDecodeTest(0) fails, the remaining (one) test isn't run.  I think it's beneficial to see all the test run, independent of whether a previous tests fails or not.
Comment 7 Li Yin 2012-08-01 18:41:24 PDT
Created attachment 155944 [details]
Patch
Comment 8 Li Yin 2012-08-01 19:01:13 PDT
(In reply to comment #6)
> (From update of attachment 155792 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=155792&action=review
> 
> Just a few minor comments on implementation.  Otherwise, the test looks good.
> 
> > LayoutTests/ChangeLog:14
> > +        * webaudio/resources/media/error-format.txt: Added.
> 
> Perhaps a more obvious name would be good.  Something like invalid-audio-file.txt. 

Fixed.

> 
> Might also be useful to have a real ogg (or mp3 or aac) file that we've manually corrupted in some way.  There are also some Microsoft ADPCM wav files that we cannot decode because it's not supported by chromium.
> 
> > LayoutTests/webaudio/decode-audio-data-basic.html:36
> > +    debug("The " + index + " test: " + decodeCaseArray[index][0]);
> 
> Is this debug needed?  I think it should be removed.  You can add this information in the testPassed/testFailed messages.
> 
> > LayoutTests/webaudio/decode-audio-data-basic.html:47
> > +                testPassed("successCallback has been called correctly.");
> 
> As mentioned above, the message can include information about the test.  I think that's better than the debug call above.
> 

Fixed.

> > LayoutTests/webaudio/decode-audio-data-basic.html:48
> > +                runDecodeTest(++index);
> 
> Do you need to call runDecodeTest here?  Can you just call runDecodeTest(1) at the end of the file?
> 
> > LayoutTests/webaudio/decode-audio-data-basic.html:51
> > +                finishedJSTest();
> 
> Can finishedJSTest() be called at the end of the file, after calling runDecodeTest(1)?
> 
> > LayoutTests/webaudio/decode-audio-data-basic.html:58
> > +                finishJSTest();
> 
> Same comment as for line 51.
> 
> > LayoutTests/webaudio/decode-audio-data-basic.html:61
> > +                runDecodeTest(++index);
> 
> Same comment as for line 48.
> 
> > LayoutTests/webaudio/decode-audio-data-basic.html:68
> > +runDecodeTest(0);
> 
> Can we just do
> 
> runDecodeTest(0);
> runDecodeTest(1);
> finishJSTest();
> 
> I think this makes it clearer which tests are being run.  It looks like with the current code, if runDecodeTest(0) fails, the remaining (one) test isn't run.  I think it's beneficial to see all the test run, independent of whether a previous tests fails or not.

Fixed, I agree with you that it is better to run all the test no matter what is failed. In addition, I want to let the tests run one by one, and another test can be run after the callback is invoked.
So I will keep it unchanged. And I think it is better for the expandablity.
And in some other module such as WebSocket, this style is often used.
Comment 9 Chris Rogers 2012-08-01 19:07:57 PDT
Li, great test!  I haven't looked fully at the patch yet, but would highly recommend using a .wav file instead of .ogg as the success case.  Not all ports (like the mac port) support .ogg, but most would support .wav
Comment 10 Li Yin 2012-08-01 19:32:54 PDT
Created attachment 155953 [details]
Patch
Comment 11 Li Yin 2012-08-01 19:34:30 PDT
(In reply to comment #9)
> Li, great test!  I haven't looked fully at the patch yet, but would highly recommend using a .wav file instead of .ogg as the success case.  Not all ports (like the mac port) support .ogg, but most would support .wav

Fixed. Thanks for your comments.
Comment 12 Raymond Toy 2012-08-02 12:41:36 PDT
Comment on attachment 155953 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=155953&action=review

Looks good to me, except for a couple of really minor nits.  Don't have to fix them if you don't want to.

> LayoutTests/webaudio/decode-audio-data-basic.html:47
> +                testFailed("The " + decodeCaseArray[index][0] + " test: successCallback should be called.");

Maybe be more forceful and say 

successCallback was not called.

> LayoutTests/webaudio/decode-audio-data-basic.html:54
> +                testFailed("The " + decodeCaseArray[index][0] + " test: errorCallback should not be called.");

Maybe be more forceful:

errorCallback was incorrectly called.
Comment 13 Li Yin 2012-08-02 17:57:30 PDT
Created attachment 156221 [details]
Patch
Comment 14 Li Yin 2012-08-02 17:58:53 PDT
(In reply to comment #12)
> (From update of attachment 155953 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=155953&action=review
> 
> Looks good to me, except for a couple of really minor nits.  Don't have to fix them if you don't want to.
> 
> > LayoutTests/webaudio/decode-audio-data-basic.html:47
> > +                testFailed("The " + decodeCaseArray[index][0] + " test: successCallback should be called.");
> 
> Maybe be more forceful and say 
> 
> successCallback was not called.
> 
> > LayoutTests/webaudio/decode-audio-data-basic.html:54
> > +                testFailed("The " + decodeCaseArray[index][0] + " test: errorCallback should not be called.");
> 
> Maybe be more forceful:
> 
> errorCallback was incorrectly called.

Fixed. Thanks for your comments.
Comment 15 Chris Rogers 2012-08-02 18:54:14 PDT
Comment on attachment 156221 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=156221&action=review

Looks good overall:

> LayoutTests/webaudio/decode-audio-data-basic.html:28
> +                       ["resources/media/invalid-audio-file.txt", false]];

I think a JSON format might be better, something like:

[[url:"resources/media/24bit-44khz.wav", result:true], ...

Because it will make the test code below easier to read
Comment 16 Li Yin 2012-08-02 19:19:55 PDT
Created attachment 156240 [details]
Patch
Comment 17 Li Yin 2012-08-02 19:21:25 PDT
(In reply to comment #15)
> (From update of attachment 156221 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=156221&action=review
> 
> Looks good overall:
> 
> > LayoutTests/webaudio/decode-audio-data-basic.html:28
> > +                       ["resources/media/invalid-audio-file.txt", false]];
> 
> I think a JSON format might be better, something like:
> 
> [[url:"resources/media/24bit-44khz.wav", result:true], ...
> 
> Because it will make the test code below easier to read

Fixed. They indeed make test be easier to read. Thanks.
Comment 18 Li Yin 2012-08-23 00:27:21 PDT
Hi Chris,
   Could you please give an official r+ and c+ if there are no issues? Please feel free to let me know if something is still needed to improved. Thanks in advance.
Comment 19 Chris Rogers 2012-08-23 11:07:13 PDT
Comment on attachment 156240 [details]
Patch

Thanks Li!
Comment 20 WebKit Review Bot 2012-08-23 11:43:33 PDT
Comment on attachment 156240 [details]
Patch

Clearing flags on attachment: 156240

Committed r126458: <http://trac.webkit.org/changeset/126458>
Comment 21 WebKit Review Bot 2012-08-23 11:43:37 PDT
All reviewed patches have been landed.  Closing bug.