Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / webaudio / decode-audio-data-basic.html
blobd97e4c74bed44782c0fc096fc0bc643155358ac0
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../resources/js-test.js"></script>
5 <script src="resources/compatibility.js"></script>
6 <script type="text/javascript" src="resources/audio-testing.js"></script>
7 </head>
8 <body>
9 <script>
10 description("Basic tests for decodeAudioData function.");
12 if (window.testRunner) {
13 testRunner.dumpAsText();
14 testRunner.waitUntilDone();
17 window.jsTestIsAsync = true;
19 var context = new AudioContext();
21 try {
22 context.decodeAudioData(null, function(){}, function(){});
23 testFailed("decodeAudioData should raise exception when arraybuffer parameter is null.");
24 } catch(e) {
25 testPassed("decodeAudioData raises exception correctly when arraybuffer parameter is null.");
28 var decodeCaseArray = [{url: "resources/media/24bit-44khz.wav", result: true},
29 {url: "resources/media/invalid-audio-file.txt", result: false}];
31 function runDecodeTest(index) {
32 if (index >= decodeCaseArray.length) {
33 finishJSTest();
34 return;
37 var request = new XMLHttpRequest();
38 request.open("GET", decodeCaseArray[index].url, true);
39 request.responseType = "arraybuffer";
41 request.onload = function() {
42 context.decodeAudioData(request.response, successCallback, errorCallback);
44 function successCallback() {
45 if (decodeCaseArray[index].result)
46 testPassed("The " + decodeCaseArray[index].url + " test: successCallback has been called correctly.");
47 else
48 testFailed("The " + decodeCaseArray[index].url + " test: successCallback was not called.");
50 runDecodeTest(++index);
53 function errorCallback() {
54 if (decodeCaseArray[index].result)
55 testFailed("The " + decodeCaseArray[index].url + " test: errorCallback was called incorrectly.");
56 else
57 testPassed("The " + decodeCaseArray[index].url + " test: errorCallback has been called correctly.");
59 runDecodeTest(++index);
62 request.send();
65 runDecodeTest(0);
67 </script>
68 </body>
69 </html>