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

Unified Diff: LayoutTests/media/avtrack/addtrack.html

Issue 284513003: Implement AudioTrack, AudioTrackList, VideoTrack, and VideoTrackList (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: nits Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/media/avtrack/audio-track-enabled.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/media/avtrack/addtrack.html
diff --git a/LayoutTests/media/avtrack/addtrack.html b/LayoutTests/media/avtrack/addtrack.html
new file mode 100644
index 0000000000000000000000000000000000000000..18c9097a42aeaffe411185562585840e8ac8ff5c
--- /dev/null
+++ b/LayoutTests/media/avtrack/addtrack.html
@@ -0,0 +1,66 @@
+<!doctype html>
+<html>
+ <head>
+ <title>AudioTrackList &amp; VideoTrackList addtrack event</title>
+ <script src="../../resources/testharness.js"></script>
+ <script src="../../resources/testharnessreport.js"></script>
+ <script src="../media-file.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ function addtrack_test(tagName, src, label)
+ {
+ function onTrackListEvent(actualEventList, e)
+ {
+ actualEventList.push(e.type);
+
+ if (e.type == "addtrack") {
+ assert_equals(e.track, e.target[0], "Track property matches first track in list.");
+ }
+ }
+
+ function setupTrackListHandlers(t, trackList, actualEventList)
+ {
+ trackList.addEventListener("addtrack", t.step_func(onTrackListEvent.bind(this, actualEventList)));
+ trackList.addEventListener("change", t.step_func(onTrackListEvent.bind(this, actualEventList)));
+ trackList.addEventListener("removetrack", t.step_func(onTrackListEvent.bind(this, actualEventList)));
+ }
+
+ async_test(function(t)
+ {
+ var e = document.createElement(tagName);
+ e.src = src;
+
+ var expectedEvents = ["addtrack"];
+ var actualAudioEvents = [];
+ var actualVideoEvents = [];
+ setupTrackListHandlers(t, e.audioTracks, actualAudioEvents, "audioTracks events");
+ setupTrackListHandlers(t, e.videoTracks, actualVideoEvents, "videoTracks events");
+
+ e.load();
+
+ e.addEventListener("loadedmetadata", t.step_func(function()
+ {
+ assert_array_equals(actualAudioEvents, expectedEvents);
+
+ if (e.videoTracks.length > 0) {
+ assert_equals(label, "audio-video");
+ assert_array_equals(actualVideoEvents, expectedEvents);
+ } else {
+ assert_equals(label, "audio-only");
+ assert_equals(actualVideoEvents.length, 0);
+ }
+
+ t.done();
+ }));
+ }, tagName + " : " + label);
+ }
+
+ addtrack_test("audio", findMediaFile("audio", "../content/test"), "audio-only");
+ addtrack_test("audio", findMediaFile("video", "../content/test"), "audio-video");
+ addtrack_test("video", findMediaFile("audio", "../content/test"), "audio-only");
+ addtrack_test("video", findMediaFile("video", "../content/test"), "audio-video");
+ </script>
+ </body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/media/avtrack/audio-track-enabled.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698