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> | 10 <div id="log"></div> |
11 <script> | 11 <script> |
12 async_test(function(t) | 12 async_test(function(t) |
13 { | 13 { |
14 var e = document.createElement("audio"); | 14 var e = document.createElement("audio"); |
15 // add to body to prevent GC pending http://crbug.com/400659 | |
16 document.body.appendChild(e); | |
17 e.src = findMediaFile("audio", "../content/test"); | 15 e.src = findMediaFile("audio", "../content/test"); |
18 | 16 |
19 e.onloadedmetadata = t.step_func(function() | 17 e.onloadedmetadata = t.step_func(function() |
20 { | 18 { |
21 assert_equals(e.audioTracks.length, 1, "audioTracks.length")
; | 19 assert_equals(e.audioTracks.length, 1, "audioTracks.length")
; |
22 assert_true(e.audioTracks[0].enabled, "audioTrack.enabled (i
nitial)"); | 20 assert_true(e.audioTracks[0].enabled, "audioTrack.enabled (i
nitial)"); |
23 e.audioTracks[0].enabled = false; | 21 e.audioTracks[0].enabled = false; |
24 assert_false(e.audioTracks[0].enabled, "audioTrack.enabled (
first setter)"); | 22 assert_false(e.audioTracks[0].enabled, "audioTrack.enabled (
first setter)"); |
25 | 23 |
26 e.audioTracks.onchange = t.step_func(function() | 24 e.audioTracks.onchange = t.step_func(function() |
27 { | 25 { |
28 assert_false(e.audioTracks[0].enabled, "audioTrack.enabl
ed (first change event)"); | 26 assert_false(e.audioTracks[0].enabled, "audioTrack.enabl
ed (first change event)"); |
29 e.audioTracks[0].enabled = true; | 27 e.audioTracks[0].enabled = true; |
30 assert_true(e.audioTracks[0].enabled, "audioTrack.enable
d (second setter)"); | 28 assert_true(e.audioTracks[0].enabled, "audioTrack.enable
d (second setter)"); |
31 | 29 |
32 e.audioTracks.onchange = t.step_func(function() | 30 e.audioTracks.onchange = t.step_func(function() |
33 { | 31 { |
34 assert_true(e.audioTracks[0].enabled, "audioTrack.en
abled (second change event)"); | 32 assert_true(e.audioTracks[0].enabled, "audioTrack.en
abled (second change event)"); |
35 t.done(); | 33 t.done(); |
36 }); | 34 }); |
37 }); | 35 }); |
38 }); | 36 }); |
39 }, "AudioTrack.enabled = false"); | 37 }, "AudioTrack.enabled = false"); |
40 </script> | 38 </script> |
41 </body> | 39 </body> |
42 </html> | 40 </html> |
OLD | NEW |