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

Unified Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/mediacapture-streams/MediaStream-MediaElement-srcObject.html

Issue 1854003004: Import web-platform-tests@5a8700479d98852455bee6117558897867eb278a (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 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
Index: third_party/WebKit/LayoutTests/imported/web-platform-tests/mediacapture-streams/MediaStream-MediaElement-srcObject.html
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/mediacapture-streams/MediaStream-MediaElement-srcObject.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/mediacapture-streams/MediaStream-MediaElement-srcObject.html
new file mode 100644
index 0000000000000000000000000000000000000000..b74c3b505d0242e6b97a6cbf76c60edebb8d9cc5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/mediacapture-streams/MediaStream-MediaElement-srcObject.html
@@ -0,0 +1,55 @@
+<!doctype html>
+<html>
+<head>
+<title>Assigning mediastream to a video element</title>
+<link rel="author" title="Dominique Hazael-Massieux" href="mailto:dom@w3.org"/>
+<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#navigatorusermedia">
+</head>
+<body>
+<p class="instructions" style="display:none">When prompted, accept to share your video stream.</p>
+<h1 class="instructions" style="display:none">Description</h1>
+<p class="instructions" style="display:none">This test checks that the MediaStream object returned by
+the success callback in getUserMedia can be properly assigned to a video element
+via the <code>srcObject</code> attribute.</p>
+
+<video id="vid"></video>
+
+<div id='log'></div>
+<script src=../../../resources/testharness.js></script>
+<script src=../../../resources/testharnessreport.js></script>
+<script src="../../../resources/vendor-prefix.js" data-prefixed-objects='[{"ancestors":["navigator"], "name":"getUserMedia"}]' data-prefixed-prototypes='[{"ancestors":["HTMLMediaElement"],"name":"srcObject"}]'></script>
+<script>
+var vid = document.getElementById("vid");
+var t = async_test("Tests that a MediaStream can be assigned to a video element with srcObject", {timeout: 10000});
+t.step(function() {
+ navigator.getUserMedia({video: true}, t.step_func(function (stream) {
+ var testOncePlaying = function() {
+ assert_equals(vid.played.length, 1, "A MediaStream's timeline always consists of a single range");
+ assert_equals(vid.played.start(0), 0, "A MediaStream's timeline always consists of a single range");
+ assert_equals(vid.played.end(0), vid.currentTime, "A MediaStream's timeline always consists of a single range");
+ assert_equals(vid.readyState, vid.HAVE_ENOUGH_DATA, "Upon selecting a media stream, the UA sets readyState to HAVE_ENOUGH_DATA");
+ var time = vid.currentTime;
+ assert_throws("INVALID_STATE_ERR", function() {
+ vid.currentTime = 0;
+ });
+ assert_equals(vid.currentTime, time, "The UA MUST ignore attempts to set the currentTime attribute");
+ // TODO add test that duration must be set to currentTime
+ // when mediastream is destroyed
+ vid.removeEventListener("timeupdate", testOncePlaying, false);
+ t.done();
+ }
+ vid.addEventListener("timeupdate", t.step_func(testOncePlaying), false);
+ vid.srcObject = stream;
+ vid.play();
+ assert_true(!vid.seeking, "A MediaStream is not seekable");
+ assert_equals(vid.seekable.length, 0, "A MediaStream is not seekable");
+ assert_equals(vid.defaultPlaybackRate, 1, "playback rate is always 1");
+ assert_equals(vid.playbackRate, 1, "playback rate is always 1");
+ assert_equals(vid.buffered.length, 0, "A MediaStream cannot be preloaded. Therefore, there is no buffered timeranges");
+ assert_equals(vid.duration, Infinity, " A MediaStream does not have a pre-defined duration. ");
+ assert_equals(vid.startDate, NaN, " A MediaStream does not specify a timeline offset");
+ }), function(error) {});
+});
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698