OLD | NEW |
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 kGetDepthStreamAndCameraCalibration[] = | 20 static const char kGetDepthStreamAndCameraCalibration[] = |
21 "getDepthStreamAndCameraCalibration"; | 21 "getDepthStreamAndCameraCalibration"; |
22 static const char kGetBothStreamsAndCheckForFeaturesPresence[] = | 22 static const char kGetBothStreamsAndCheckForFeaturesPresence[] = |
23 "getBothStreamsAndCheckForFeaturesPresence"; | 23 "getBothStreamsAndCheckForFeaturesPresence"; |
| 24 static const char kGetStreamsByVideoKind[] = "getStreamsByVideoKind"; |
| 25 static const char kGetStreamsByVideoKindNoDepth[] = |
| 26 "getStreamsByVideoKindNoDepth"; |
24 | 27 |
25 void RemoveSwitchFromCommandLine(base::CommandLine* command_line, | 28 void RemoveSwitchFromCommandLine(base::CommandLine* command_line, |
26 const std::string& switch_value) { | 29 const std::string& switch_value) { |
27 base::CommandLine::StringVector argv = command_line->argv(); | 30 base::CommandLine::StringVector argv = command_line->argv(); |
28 const base::CommandLine::StringType switch_string = | 31 const base::CommandLine::StringType switch_string = |
29 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
30 base::ASCIIToUTF16(switch_value); | 33 base::ASCIIToUTF16(switch_value); |
31 #else | 34 #else |
32 switch_value; | 35 switch_value; |
33 #endif | 36 #endif |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 ASSERT_TRUE(embedded_test_server()->Start()); | 106 ASSERT_TRUE(embedded_test_server()->Start()); |
104 | 107 |
105 GURL url( | 108 GURL url( |
106 embedded_test_server()->GetURL("/media/getusermedia-depth-capture.html")); | 109 embedded_test_server()->GetURL("/media/getusermedia-depth-capture.html")); |
107 NavigateToURL(shell(), url); | 110 NavigateToURL(shell(), url); |
108 | 111 |
109 ExecuteJavascriptAndWaitForOk(base::StringPrintf( | 112 ExecuteJavascriptAndWaitForOk(base::StringPrintf( |
110 "%s({video: true});", kGetBothStreamsAndCheckForFeaturesPresence)); | 113 "%s({video: true});", kGetBothStreamsAndCheckForFeaturesPresence)); |
111 } | 114 } |
112 | 115 |
| 116 IN_PROC_BROWSER_TEST_F(WebRtcDepthCaptureBrowserTest, GetStreamsByVideoKind) { |
| 117 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 118 command_line->AppendSwitchASCII("--enable-blink-features", |
| 119 "MediaGetSettings,MediaCaptureDepth"); |
| 120 |
| 121 ASSERT_TRUE(embedded_test_server()->Start()); |
| 122 |
| 123 GURL url( |
| 124 embedded_test_server()->GetURL("/media/getusermedia-depth-capture.html")); |
| 125 NavigateToURL(shell(), url); |
| 126 |
| 127 ExecuteJavascriptAndWaitForOk( |
| 128 base::StringPrintf("%s({video: true});", kGetStreamsByVideoKind)); |
| 129 } |
| 130 |
| 131 IN_PROC_BROWSER_TEST_F(WebRtcDepthCaptureBrowserTest, |
| 132 GetStreamsByVideoKindNoDepth) { |
| 133 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 134 // Set fake factory to have only one device, of type "color". |
| 135 RemoveSwitchFromCommandLine(command_line, |
| 136 switches::kUseFakeDeviceForMediaStream); |
| 137 command_line->AppendSwitchASCII(switches::kUseFakeDeviceForMediaStream, |
| 138 "device-count=1"); |
| 139 command_line->AppendSwitchASCII("--enable-blink-features", |
| 140 "MediaGetSettings,MediaCaptureDepth"); |
| 141 |
| 142 ASSERT_TRUE(embedded_test_server()->Start()); |
| 143 |
| 144 GURL url( |
| 145 embedded_test_server()->GetURL("/media/getusermedia-depth-capture.html")); |
| 146 NavigateToURL(shell(), url); |
| 147 |
| 148 ExecuteJavascriptAndWaitForOk( |
| 149 base::StringPrintf("%s({video: true});", kGetStreamsByVideoKindNoDepth)); |
| 150 } |
| 151 |
113 } // namespace content | 152 } // namespace content |
OLD | NEW |