Title: [126458] trunk/LayoutTests
- Revision
- 126458
- Author
- [email protected]
- Date
- 2012-08-23 11:43:55 -0700 (Thu, 23 Aug 2012)
Log Message
Add test for decodeAudioData
https://bugs.webkit.org/show_bug.cgi?id=92620
Patch by Li Yin <[email protected]> on 2012-08-23
Reviewed by Chris Rogers.
Spec: https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#AudioContext-section
This test checks if successCallback or errorCallback can be invoked correctly when
there is a correct or error decoding.
* webaudio/decode-audio-data-basic-expected.txt: Added.
* webaudio/decode-audio-data-basic.html: Added.
* webaudio/resources/media/invalid-audio-file.txt: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (126457 => 126458)
--- trunk/LayoutTests/ChangeLog 2012-08-23 18:41:33 UTC (rev 126457)
+++ trunk/LayoutTests/ChangeLog 2012-08-23 18:43:55 UTC (rev 126458)
@@ -1,3 +1,18 @@
+2012-08-23 Li Yin <[email protected]>
+
+ Add test for decodeAudioData
+ https://bugs.webkit.org/show_bug.cgi?id=92620
+
+ Reviewed by Chris Rogers.
+
+ Spec: https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#AudioContext-section
+ This test checks if successCallback or errorCallback can be invoked correctly when
+ there is a correct or error decoding.
+
+ * webaudio/decode-audio-data-basic-expected.txt: Added.
+ * webaudio/decode-audio-data-basic.html: Added.
+ * webaudio/resources/media/invalid-audio-file.txt: Added.
+
2012-08-23 Kenneth Russell <[email protected]>
Web Inspector: three layout tests crashing with assertion failure
Added: trunk/LayoutTests/webaudio/decode-audio-data-basic-expected.txt (0 => 126458)
--- trunk/LayoutTests/webaudio/decode-audio-data-basic-expected.txt (rev 0)
+++ trunk/LayoutTests/webaudio/decode-audio-data-basic-expected.txt 2012-08-23 18:43:55 UTC (rev 126458)
@@ -0,0 +1,12 @@
+Basic tests for decodeAudioData function.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS decodeAudioData raises exception correctly when arraybuffer parameter is null.
+PASS The resources/media/24bit-44khz.wav test: successCallback has been called correctly.
+PASS The resources/media/invalid-audio-file.txt test: errorCallback has been called correctly.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/webaudio/decode-audio-data-basic.html (0 => 126458)
--- trunk/LayoutTests/webaudio/decode-audio-data-basic.html (rev 0)
+++ trunk/LayoutTests/webaudio/decode-audio-data-basic.html 2012-08-23 18:43:55 UTC (rev 126458)
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script type="text/_javascript_" src=""
+</head>
+<body>
+<script>
+description("Basic tests for decodeAudioData function.");
+
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+window.jsTestIsAsync = true;
+
+var context = new webkitAudioContext();
+
+try {
+ context.decodeAudioData(null, function(){}, function(){});
+ testFailed("decodeAudioData should raise exception when arraybuffer parameter is null.");
+} catch(e) {
+ testPassed("decodeAudioData raises exception correctly when arraybuffer parameter is null.");
+}
+
+var decodeCaseArray = [{url: "resources/media/24bit-44khz.wav", result: true},
+ {url: "resources/media/invalid-audio-file.txt", result: false}];
+
+function runDecodeTest(index) {
+ if (index >= decodeCaseArray.length) {
+ finishJSTest();
+ return;
+ }
+
+ var request = new XMLHttpRequest();
+ request.open("GET", decodeCaseArray[index].url, true);
+ request.responseType = "arraybuffer";
+
+ request._onload_ = function() {
+ context.decodeAudioData(request.response, successCallback, errorCallback);
+
+ function successCallback() {
+ if (decodeCaseArray[index].result)
+ testPassed("The " + decodeCaseArray[index].url + " test: successCallback has been called correctly.");
+ else
+ testFailed("The " + decodeCaseArray[index].url + " test: successCallback was not called.");
+
+ runDecodeTest(++index);
+ }
+
+ function errorCallback() {
+ if (decodeCaseArray[index].result)
+ testFailed("The " + decodeCaseArray[index].url + " test: errorCallback was called incorrectly.");
+ else
+ testPassed("The " + decodeCaseArray[index].url + " test: errorCallback has been called correctly.");
+
+ runDecodeTest(++index);
+ }
+ }
+ request.send();
+}
+
+runDecodeTest(0);
+
+</script>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/webaudio/resources/media/invalid-audio-file.txt (0 => 126458)
--- trunk/LayoutTests/webaudio/resources/media/invalid-audio-file.txt (rev 0)
+++ trunk/LayoutTests/webaudio/resources/media/invalid-audio-file.txt 2012-08-23 18:43:55 UTC (rev 126458)
@@ -0,0 +1 @@
+Incorrect Audio File.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes