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

Unified Diff: content/test/data/media/getusermedia-depth-capture.html

Issue 2664673002: Media Capture Depth Stream Extensions API: videoKind settings and constraint. (Closed)
Patch Set: videoKind string constants removed from header. Created 3 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: content/test/data/media/getusermedia-depth-capture.html
diff --git a/content/test/data/media/getusermedia-depth-capture.html b/content/test/data/media/getusermedia-depth-capture.html
index 72c01e52ddbd7c355bdfb77e3f730caa5c1a2b4e..e65c90d19468354fe468b855808d98550bc02739 100644
--- a/content/test/data/media/getusermedia-depth-capture.html
+++ b/content/test/data/media/getusermedia-depth-capture.html
@@ -116,6 +116,60 @@
failedCallback);
}
+ function testGetStreamByVideoKindConstraint(constraint, kind) {
+ return new Promise(function(resolve, reject) {
+ getStreamOfVideoKind(constraint).then(function(stream) {
+ if (stream.getVideoTracks().length != 1) {
+ return reject("Expected one " + kind + " track, got " +
+ stream.getVideoTracks().length +
+ " when using constraint " + JSON.stringify(constraint));
+ }
+ var track = stream.getVideoTracks()[0];
+ if (track.getSettings().videoKind != kind) {
+ return reject("Expected " + kind + " track, got " +
+ track.getSettings().videoKind +
+ " when using constraint " + JSON.stringify(constraint));
+ }
+ return resolve();
+ },
+ failedCallback);
+ });
+ }
+
+ function getStreamsByVideoKind() {
+ console.log('Calling getStreamsByVideoKind');
+ var cases = [{constraint: {exact: "depth"}, kind: "depth"},
+ {constraint: {exact: "color"}, kind: "color"}];
+ var tests = [];
+ for (var i in cases) {
+ var test_case = cases[i];
+ tests.push(testGetStreamByVideoKindConstraint(test_case.constraint,
+ test_case.kind));
+ }
+ Promise.all(tests).then(reportTestSuccess, reason => {
+ failedCallback({name: reason});
+ });
+ }
+
+ function getStreamsByVideoKindNoDepth() {
+ console.log('Calling getStreamsByVideoKindNoDepth');
+ testGetStreamByVideoKindConstraint({exact: "color"}, "color")
+ .then(function() {
+ // Getting a depth stream should fail.
+ getStreamOfVideoKind({exact: "depth"}).then(function(stream) {
+ return failedCallback({name: "Expected to fail, got depth instead."});
+ }, function() {
+ // Getting a random stream should fail.
+ getStreamOfVideoKind({exact: "fisheye"}).then(function(stream) {
+ return failedCallback(
+ {name: "Expected to fail, got fisheye instead."});
+ }, reportTestSuccess);
+ });
+ }, reason => {
+ failedCallback({name: reason});
+ });
+ }
+
function depthStreamToRGBAUint8Texture() {
console.log('Calling depthStreamToRGBAUint8Texture');
getFake16bitStream().then(function(stream) {

Powered by Google App Engine
This is Rietveld 408576698