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

Side by Side Diff: content/browser/webrtc/webrtc_depth_capture_browsertest.cc

Issue 2664673002: Media Capture Depth Stream Extensions API: videoKind settings and constraint. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/browser/webrtc/webrtc_content_browsertest_base.h" 10 #include "content/browser/webrtc/webrtc_content_browsertest_base.h"
11 #include "content/public/common/content_switches.h" 11 #include "content/public/common/content_switches.h"
12 #include "content/public/test/content_browser_test_utils.h" 12 #include "content/public/test/content_browser_test_utils.h"
13 #include "media/base/media_switches.h" 13 #include "media/base/media_switches.h"
14 #include "net/test/embedded_test_server/embedded_test_server.h" 14 #include "net/test/embedded_test_server/embedded_test_server.h"
15 15
16 namespace { 16 namespace {
17 17
18 static const char kGetDepthStreamAndCallCreateImageBitmap[] = 18 static const char kGetDepthStreamAndCallCreateImageBitmap[] =
19 "getDepthStreamAndCallCreateImageBitmap"; 19 "getDepthStreamAndCallCreateImageBitmap";
20 static const char kGetStreamsByVideoKind[] = "getStreamsByVideoKind";
21 static const char kGetStreamsByVideoKindNoDepth[] =
22 "getStreamsByVideoKindNoDepth";
20 23
21 void RemoveSwitchFromCommandLine(base::CommandLine* command_line, 24 void RemoveSwitchFromCommandLine(base::CommandLine* command_line,
22 const std::string& switch_value) { 25 const std::string& switch_value) {
23 base::CommandLine::StringVector argv = command_line->argv(); 26 base::CommandLine::StringVector argv = command_line->argv();
24 const base::CommandLine::StringType switch_string = 27 const base::CommandLine::StringType switch_string =
25 #if defined(OS_WIN) 28 #if defined(OS_WIN)
26 base::ASCIIToUTF16(switch_value); 29 base::ASCIIToUTF16(switch_value);
27 #else 30 #else
28 switch_value; 31 switch_value;
29 #endif 32 #endif
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 ASSERT_TRUE(embedded_test_server()->Start()); 70 ASSERT_TRUE(embedded_test_server()->Start());
68 71
69 GURL url( 72 GURL url(
70 embedded_test_server()->GetURL("/media/getusermedia-depth-capture.html")); 73 embedded_test_server()->GetURL("/media/getusermedia-depth-capture.html"));
71 NavigateToURL(shell(), url); 74 NavigateToURL(shell(), url);
72 75
73 ExecuteJavascriptAndWaitForOk(base::StringPrintf( 76 ExecuteJavascriptAndWaitForOk(base::StringPrintf(
74 "%s({video: true});", kGetDepthStreamAndCallCreateImageBitmap)); 77 "%s({video: true});", kGetDepthStreamAndCallCreateImageBitmap));
75 } 78 }
76 79
80 IN_PROC_BROWSER_TEST_F(WebRtcDepthCaptureBrowserTest, GetStreamsByVideoKind) {
81 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
82 command_line->AppendSwitchASCII("--enable-blink-features",
83 "MediaGetSettings,MediaCaptureDepth");
84
85 ASSERT_TRUE(embedded_test_server()->Start());
86
87 GURL url(
88 embedded_test_server()->GetURL("/media/getusermedia-depth-capture.html"));
89 NavigateToURL(shell(), url);
90
91 ExecuteJavascriptAndWaitForOk(
92 base::StringPrintf("%s({video: true});", kGetStreamsByVideoKind));
93 }
94
95 IN_PROC_BROWSER_TEST_F(WebRtcDepthCaptureBrowserTest,
96 GetStreamsByVideoKindNoDepth) {
97 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
98 // Set fake factory to have only one device, of type "color".
99 RemoveSwitchFromCommandLine(command_line,
100 switches::kUseFakeDeviceForMediaStream);
101 command_line->AppendSwitchASCII(switches::kUseFakeDeviceForMediaStream,
102 "device-count=1");
103 command_line->AppendSwitchASCII("--enable-blink-features",
104 "MediaGetSettings,MediaCaptureDepth");
105
106 ASSERT_TRUE(embedded_test_server()->Start());
107
108 GURL url(
109 embedded_test_server()->GetURL("/media/getusermedia-depth-capture.html"));
110 NavigateToURL(shell(), url);
111
112 ExecuteJavascriptAndWaitForOk(
113 base::StringPrintf("%s({video: true});", kGetStreamsByVideoKindNoDepth));
114 }
115
77 } // namespace content 116 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698