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

Unified Diff: LayoutTests/fast/mediastream/getusermedia-promise.html

Issue 1202553002: Implement navigator.mediaDevices.getUserMedia() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review comments Created 5 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 | Source/modules/mediastream/MediaDevices.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/mediastream/getusermedia-promise.html
diff --git a/LayoutTests/fast/mediastream/getusermedia-promise.html b/LayoutTests/fast/mediastream/getusermedia-promise.html
new file mode 100644
index 0000000000000000000000000000000000000000..44584425294a7290de2d58106aa358474f6c053a
--- /dev/null
+++ b/LayoutTests/fast/mediastream/getusermedia-promise.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
Peter Beverloo 2015/06/26 12:36:55 micro nit: could use the modern doctype: <!DOCTYP
hta - Chromium 2015/06/26 13:28:55 Done.
+<html>
+<head>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+</head>
+<body>
+<p id="description"></p>
Peter Beverloo 2015/06/26 12:36:55 micro nit: description/console aren't necessary fo
hta - Chromium 2015/06/26 13:28:55 Done.
+<div id="console"></div>
+<script>
+
+promise_test(function() {
+ assert_idl_attribute(navigator, 'mediaDevices');
+ assert_idl_attribute(navigator.mediaDevices, 'getUserMedia');
+
+ return navigator.mediaDevices.getUserMedia({audio: true}).then(function(s) {
+ assert_equals(s.getTracks().length, 1);
+ });
+}, 'getUserMedia() audio track');
+
+promise_test(function() {
+ assert_idl_attribute(navigator, 'mediaDevices');
+ assert_idl_attribute(navigator.mediaDevices, 'getUserMedia');
+
+ return navigator.mediaDevices.getUserMedia({audio: true, video:true})
+ .then(function(s) {
+ assert_equals(s.getTracks().length, 2);
+ assert_equals(s.getAudioTracks().length, 1);
+ assert_equals(s.getVideoTracks().length, 1);
+ });
+}, 'getUserMedia() audio and video tracks');
+
+promise_test(function() {
+ return navigator.mediaDevices.getUserMedia(
+ {audio: {'mandatory': { 'valid_but_unsupported_1': 0}}})
+ .then(function(s) {
+ fail('getUserMedia should have failed');
+ }).catch(function(e) {
+ assert_equals(e.name, 'ConstraintNotSatisfiedError');
+ });
+}, 'getUserMedia() with unsupported mandatory constraint');
+
+
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | Source/modules/mediastream/MediaDevices.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698