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

Unified Diff: LayoutTests/fast/mediastream/argument-types.html

Issue 173893009: MediaStream API: Update getUserMedia to match the spec (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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: LayoutTests/fast/mediastream/argument-types.html
diff --git a/LayoutTests/fast/mediastream/argument-types.html b/LayoutTests/fast/mediastream/argument-types.html
index a58f98b412a4f17c39ad46bd1a3253c2d5746d55..b9028e34d79958b069a157b23befe10014f47de0 100644
--- a/LayoutTests/fast/mediastream/argument-types.html
+++ b/LayoutTests/fast/mediastream/argument-types.html
@@ -4,6 +4,50 @@
<script src="../../resources/js-test.js"></script>
</head>
<body>
-<script src="script-tests/argument-types.js"></script>
+<script>
+description("Tests the acceptable types for arguments to navigator.getUserMedia methods.");
+
+var emptyFunction = function() {};
+
+// No arguments
+shouldThrow('navigator.webkitGetUserMedia()');
+
+// 1/2 arguments (getUserMedia requires at least 3 arguments).
+shouldThrow('navigator.webkitGetUserMedia({video: true})');
+shouldThrow('navigator.webkitGetUserMedia({video: true}, emptyFunction)');
+
+// 3 arguments (getUserMedia requires at least 3 arguments).
+shouldNotThrow('navigator.webkitGetUserMedia({video: true}, emptyFunction, emptyFunction)');
+shouldNotThrow('navigator.webkitGetUserMedia({audio: true}, emptyFunction, emptyFunction)');
+shouldNotThrow('navigator.webkitGetUserMedia({audio: true, video: true}, emptyFunction, emptyFunction)');
+shouldThrow('navigator.webkitGetUserMedia(-Infinity, emptyFunction, emptyFunction)');
+shouldThrow('navigator.webkitGetUserMedia(42, emptyFunction, emptyFunction)');
+shouldThrow('navigator.webkitGetUserMedia(Infinity, emptyFunction, emptyFunction)');
+shouldThrow('navigator.webkitGetUserMedia(emptyFunction, emptyFunction, emptyFunction)');
+shouldThrow('navigator.webkitGetUserMedia(null, emptyFunction, emptyFunction)');
+shouldThrow('navigator.webkitGetUserMedia(true, emptyFunction, emptyFunction)');
+shouldThrow('navigator.webkitGetUserMedia(undefined, emptyFunction, emptyFunction)');
+shouldThrow('navigator.webkitGetUserMedia({ }, emptyFunction, emptyFunction)');
+shouldThrow('navigator.webkitGetUserMedia({foo: true }, emptyFunction, emptyFunction)');
+shouldThrow('navigator.webkitGetUserMedia({audio:true, video:true}, emptyFunction, undefined)');
+shouldThrow('navigator.webkitGetUserMedia({video: true}, "foobar", emptyFunction)');
+shouldThrow('navigator.webkitGetUserMedia({video: true}, -Infinity, emptyFunction)');
+shouldThrow('navigator.webkitGetUserMedia({video: true}, 42, emptyFunction)');
+shouldThrow('navigator.webkitGetUserMedia({video: true}, Infinity, emptyFunction)');
+shouldThrow('navigator.webkitGetUserMedia({video: true}, emptyFunction, "video")');
+shouldThrow('navigator.webkitGetUserMedia({video: true}, emptyFunction, -Infinity)');
+shouldThrow('navigator.webkitGetUserMedia({video: true}, emptyFunction, 42)');
+shouldThrow('navigator.webkitGetUserMedia({video: true}, emptyFunction, Infinity)');
+shouldThrow('navigator.webkitGetUserMedia({video: true}, emptyFunction, null)');
+shouldThrow('navigator.webkitGetUserMedia({video: true}, emptyFunction, true)');
+shouldThrow('navigator.webkitGetUserMedia({video: true}, emptyFunction, undefined)');
+shouldThrow('navigator.webkitGetUserMedia({video: true}, emptyFunction, {})');
+shouldThrow('navigator.webkitGetUserMedia({video: true}, null, emptyFunction)');
+shouldThrow('navigator.webkitGetUserMedia({video: true}, true, emptyFunction)');
+shouldThrow('navigator.webkitGetUserMedia({video: true}, undefined, emptyFunction)');
+shouldThrow('navigator.webkitGetUserMedia({video: true}, {}, emptyFunction)');
+
+window.jsTestIsAsync = false;
+</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698