Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / media / audio-concurrent-supported.html
blobe0f0e0e8d824f752499dd66938f1fee85a250ba6
1 <html>
2 <title>Test of concurrent HTML5 audio</title>
3 <body>
5 <p>Test that multiple audio elements can play concurrently.</p>
7 <script src=video-test.js></script>
8 <script src=media-file.js></script>
9 <script>
10 var maxPlayers = 2; // Number of concurrent audio elements to test. For larger values a longer media file is needed.
11 var audioElementCount = 0;
13 function errorListener(event)
15 logResult(false, "Element " + audioElementCount + " caught 'error' event, audio.error.code = " + this.error.code);
16 endTest();
19 function canplaythroughListener(event)
21 consoleWrite("EVENT(" + audioElementCount + ", canplaythrough)");
22 testElement = this;
23 testExpected(audioElementCount + ", testElement.currentTime", 0);
24 this.play();
27 function playingListener(event)
29 consoleWrite("EVENT(" + audioElementCount + ", playing)");
32 function timeupdateListener(event)
34 testElement = this;
35 testExpected(audioElementCount + ", testElement.currentTime", 0, '>');
36 this.removeEventListener('timeupdate', timeupdateListener);
37 if (++audioElementCount >= maxPlayers) {
38 // All audio elements have been started playing. Make sure
39 // all of them are still playing.
40 consoleWrite("Making sure all " + maxPlayers + " audio elements are in playing state:");
41 for (var i = 0; i < maxPlayers; i++) {
42 testElement = document.getElementsByTagName('audio')[i];
43 testExpected(i + ", testElement.paused", false);
45 endTest();
46 } else {
47 // Start the next audio element
48 testAudioElement(audioElementCount);
52 function testAudioElement(count)
54 var audioElement = document.getElementsByTagName('audio')[count];
55 audioElement.addEventListener('error', errorListener);
56 audioElement.addEventListener('canplaythrough', canplaythroughListener);
57 audioElement.addEventListener('timeupdate', timeupdateListener);
58 audioElement.addEventListener('playing', playingListener);
59 audioElement.src = findMediaFile("audio", "content/silence");
62 consoleWrite("Starting a total of " + maxPlayers + " concurrent audio elements.");
63 for (var i = 0; i < maxPlayers; i++)
64 document.write("<audio controls></audio>");
66 testAudioElement(0);
67 </script>
69 </body>
70 </html>