Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: third_party/WebKit/LayoutTests/media/avtrack/video-track-selected.html

Issue 2268373002: clean up media tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>VideoTrack.selected change</title> 4 <title>VideoTrack.selected 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("video"); 13 var video = document.createElement("video");
15 e.src = findMediaFile("video", "../content/test"); 14 video.src = findMediaFile("video", "../content/test");
16 15
17 e.onloadedmetadata = t.step_func(function() 16 video.onloadedmetadata = t.step_func(function()
18 { 17 {
19 assert_equals(e.videoTracks.length, 1, "videoTracks.length") ; 18 assert_equals(video.videoTracks.length, 1, "videoTracks.leng th");
20 assert_equals(e.videoTracks.selectedIndex, 0, "videoTracks.s electedIndex (initial)"); 19 assert_equals(video.videoTracks.selectedIndex, 0, "videoTrac ks.selectedIndex (initial)");
21 assert_true(e.videoTracks[0].selected, "videoTrack.selected (initial)"); 20 assert_true(video.videoTracks[0].selected, "videoTrack.selec ted (initial)");
22 e.videoTracks[0].selected = false; 21 video.videoTracks[0].selected = false;
23 assert_equals(e.videoTracks.selectedIndex, -1, "videoTracks. selectedIndex (first setter)"); 22 assert_equals(video.videoTracks.selectedIndex, -1, "videoTra cks.selectedIndex (first setter)");
24 assert_false(e.videoTracks[0].selected, "videoTrack.selected (first setter)"); 23 assert_false(video.videoTracks[0].selected, "videoTrack.sele cted (first setter)");
25 24
26 e.videoTracks.onchange = t.unreached_func("setting selected to false fired change event"); 25 video.videoTracks.onchange = t.unreached_func("setting selec ted to false fired change event");
27 setTimeout(t.step_func(function() 26 setTimeout(t.step_func(function()
28 { 27 {
29 e.videoTracks[0].selected = true; 28 video.videoTracks[0].selected = true;
30 assert_equals(e.videoTracks.selectedIndex, 0, "videoTrac ks.selectedIndex (second setter)"); 29 assert_equals(video.videoTracks.selectedIndex, 0, "video Tracks.selectedIndex (second setter)");
31 assert_true(e.videoTracks[0].selected, "videoTrack.selec ted (second setter)"); 30 assert_true(video.videoTracks[0].selected, "videoTrack.s elected (second setter)");
32 31
33 e.videoTracks.onchange = t.step_func(function() 32 video.videoTracks.onchange = t.step_func_done(function()
34 { 33 {
35 assert_equals(e.videoTracks.selectedIndex, 0, "video Tracks.selectedIndex (change event)"); 34 assert_equals(video.videoTracks.selectedIndex, 0, "v ideoTracks.selectedIndex (change event)");
36 assert_true(e.videoTracks[0].selected, "videoTrack.s elected (change event)"); 35 assert_true(video.videoTracks[0].selected, "videoTra ck.selected (change event)");
37 t.done();
38 }); 36 });
39 }), 0); 37 }), 0);
40 }); 38 });
41 }, "VideoTrackList track change"); 39 }, "VideoTrackList track change");
42 </script> 40 </script>
43 </body> 41 </body>
44 </html> 42 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698