4 <title>VideoTrack.selected change
</title>
5 <script src=
"../../resources/testharness.js"></script>
6 <script src=
"../../resources/testharnessreport.js"></script>
7 <script src=
"../media-file.js"></script>
12 async_test(function(t
)
14 var e
= document
.createElement("video");
15 e
.src
= findMediaFile("video", "../content/test");
17 e
.onloadedmetadata
= t
.step_func(function()
19 assert_equals(e
.videoTracks
.length
, 1, "videoTracks.length");
20 assert_equals(e
.videoTracks
.selectedIndex
, 0, "videoTracks.selectedIndex (initial)");
21 assert_true(e
.videoTracks
[0].selected
, "videoTrack.selected (initial)");
22 e
.videoTracks
[0].selected
= false;
23 assert_equals(e
.videoTracks
.selectedIndex
, -1, "videoTracks.selectedIndex (first setter)");
24 assert_false(e
.videoTracks
[0].selected
, "videoTrack.selected (first setter)");
26 e
.videoTracks
.onchange
= t
.unreached_func("setting selected to false fired change event");
27 setTimeout(t
.step_func(function()
29 e
.videoTracks
[0].selected
= true;
30 assert_equals(e
.videoTracks
.selectedIndex
, 0, "videoTracks.selectedIndex (second setter)");
31 assert_true(e
.videoTracks
[0].selected
, "videoTrack.selected (second setter)");
33 e
.videoTracks
.onchange
= t
.step_func(function()
35 assert_equals(e
.videoTracks
.selectedIndex
, 0, "videoTracks.selectedIndex (change event)");
36 assert_true(e
.videoTracks
[0].selected
, "videoTrack.selected (change event)");
41 }, "VideoTrackList track change");