OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>AudioTrack.enabled change</title> | 4 <title>AudioTrack.enabled change</title> |
5 <script src="../../resources/testharness.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
6 <script src="../../resources/testharnessreport.js"></script> | 6 <script src="../../resources/testharnessreport.js"></script> |
7 <script src="../media-file.js"></script> | 7 <script src="../media-file.js"></script> |
8 </head> | 8 </head> |
9 <body> | 9 <body> |
10 <div id="log"></div> | |
11 <script> | 10 <script> |
12 async_test(function(t) | 11 async_test(function(t) |
13 { | 12 { |
14 var e = document.createElement("audio"); | 13 var audio = document.createElement("audio"); |
15 e.src = findMediaFile("audio", "../content/test"); | 14 audio.src = findMediaFile("audio", "../content/test"); |
16 | 15 |
17 e.onloadedmetadata = t.step_func(function() | 16 audio.onloadedmetadata = t.step_func(function() |
18 { | 17 { |
19 assert_equals(e.audioTracks.length, 1, "audioTracks.length")
; | 18 assert_equals(audio.audioTracks.length, 1, "audioTracks.leng
th"); |
20 assert_true(e.audioTracks[0].enabled, "audioTrack.enabled (i
nitial)"); | 19 assert_true(audio.audioTracks[0].enabled, "audioTrack.enable
d (initial)"); |
21 e.audioTracks[0].enabled = false; | 20 audio.audioTracks[0].enabled = false; |
22 assert_false(e.audioTracks[0].enabled, "audioTrack.enabled (
first setter)"); | 21 assert_false(audio.audioTracks[0].enabled, "audioTrack.enabl
ed (first setter)"); |
23 | 22 |
24 e.audioTracks.onchange = t.step_func(function() | 23 audio.audioTracks.onchange = t.step_func(function() |
25 { | 24 { |
26 assert_false(e.audioTracks[0].enabled, "audioTrack.enabl
ed (first change event)"); | 25 assert_false(audio.audioTracks[0].enabled, "audioTrack.e
nabled (first change event)"); |
27 e.audioTracks[0].enabled = true; | 26 audio.audioTracks[0].enabled = true; |
28 assert_true(e.audioTracks[0].enabled, "audioTrack.enable
d (second setter)"); | 27 assert_true(audio.audioTracks[0].enabled, "audioTrack.en
abled (second setter)"); |
29 | 28 |
30 e.audioTracks.onchange = t.step_func(function() | 29 audio.audioTracks.onchange = t.step_func_done(function() |
31 { | 30 { |
32 assert_true(e.audioTracks[0].enabled, "audioTrack.en
abled (second change event)"); | 31 assert_true(audio.audioTracks[0].enabled, "audioTrac
k.enabled (second change event)"); |
33 t.done(); | |
34 }); | 32 }); |
35 }); | 33 }); |
36 }); | 34 }); |
37 }, "AudioTrack.enabled = false"); | 35 }, "AudioTrack.enabled = false"); |
38 </script> | 36 </script> |
39 </body> | 37 </body> |
40 </html> | 38 </html> |
OLD | NEW |