Index: content/browser/webrtc/webrtc_depth_capture_browsertest.cc |
diff --git a/content/browser/webrtc/webrtc_depth_capture_browsertest.cc b/content/browser/webrtc/webrtc_depth_capture_browsertest.cc |
index 5f41ae543268ae6b1a44c9866cc1be499e2befc0..753bd467a1e5688e77c2db3bc280611dd5b6913b 100644 |
--- a/content/browser/webrtc/webrtc_depth_capture_browsertest.cc |
+++ b/content/browser/webrtc/webrtc_depth_capture_browsertest.cc |
@@ -47,6 +47,7 @@ void RemoveSwitchFromCommandLine(base::CommandLine* command_line, |
namespace content { |
+template <int device_count> |
class WebRtcDepthCaptureBrowserTest : public WebRtcContentBrowserTestBase { |
public: |
WebRtcDepthCaptureBrowserTest() { |
@@ -56,7 +57,6 @@ class WebRtcDepthCaptureBrowserTest : public WebRtcContentBrowserTestBase { |
~WebRtcDepthCaptureBrowserTest() override {} |
void SetUpCommandLine(base::CommandLine* command_line) override { |
- // Test using two video capture devices - a color and a 16-bit depth device. |
// By default, command line argument is present with no value. We need to |
// remove it and then add the value defining two video capture devices. |
const std::string fake_device_switch = |
@@ -64,12 +64,20 @@ class WebRtcDepthCaptureBrowserTest : public WebRtcContentBrowserTestBase { |
ASSERT_TRUE(command_line->HasSwitch(fake_device_switch) && |
command_line->GetSwitchValueASCII(fake_device_switch).empty()); |
RemoveSwitchFromCommandLine(command_line, fake_device_switch); |
- command_line->AppendSwitchASCII(fake_device_switch, "device-count=2"); |
+ command_line->AppendSwitchASCII( |
+ fake_device_switch, |
+ base::StringPrintf("device-count=%d", device_count)); |
WebRtcContentBrowserTestBase::SetUpCommandLine(command_line); |
} |
}; |
-IN_PROC_BROWSER_TEST_F(WebRtcDepthCaptureBrowserTest, |
+// Test using two video capture devices - a color and a 16-bit depth device. |
+using WebRtcTwoDeviceDepthCaptureBrowserTest = WebRtcDepthCaptureBrowserTest<2>; |
+ |
+// Test using only a color device. |
+using WebRtcOneDeviceDepthCaptureBrowserTest = WebRtcDepthCaptureBrowserTest<1>; |
+ |
+IN_PROC_BROWSER_TEST_F(WebRtcTwoDeviceDepthCaptureBrowserTest, |
GetDepthStreamAndCallCreateImageBitmap) { |
ASSERT_TRUE(embedded_test_server()->Start()); |
@@ -81,7 +89,7 @@ IN_PROC_BROWSER_TEST_F(WebRtcDepthCaptureBrowserTest, |
"%s({video: true});", kGetDepthStreamAndCallCreateImageBitmap)); |
} |
-IN_PROC_BROWSER_TEST_F(WebRtcDepthCaptureBrowserTest, |
+IN_PROC_BROWSER_TEST_F(WebRtcTwoDeviceDepthCaptureBrowserTest, |
GetDepthStreamAndCameraCalibration) { |
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
command_line->AppendSwitchASCII("--enable-blink-features", |
@@ -97,7 +105,7 @@ IN_PROC_BROWSER_TEST_F(WebRtcDepthCaptureBrowserTest, |
"%s({video: true});", kGetDepthStreamAndCameraCalibration)); |
} |
-IN_PROC_BROWSER_TEST_F(WebRtcDepthCaptureBrowserTest, |
+IN_PROC_BROWSER_TEST_F(WebRtcTwoDeviceDepthCaptureBrowserTest, |
GetBothStreamsAndCheckForFeaturesPresence) { |
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
command_line->AppendSwitchASCII("--enable-blink-features", |
@@ -113,7 +121,8 @@ IN_PROC_BROWSER_TEST_F(WebRtcDepthCaptureBrowserTest, |
"%s({video: true});", kGetBothStreamsAndCheckForFeaturesPresence)); |
} |
-IN_PROC_BROWSER_TEST_F(WebRtcDepthCaptureBrowserTest, GetStreamsByVideoKind) { |
+IN_PROC_BROWSER_TEST_F(WebRtcTwoDeviceDepthCaptureBrowserTest, |
+ GetStreamsByVideoKind) { |
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
command_line->AppendSwitchASCII("--enable-blink-features", |
"MediaGetSettings,MediaCaptureDepth"); |
@@ -128,14 +137,9 @@ IN_PROC_BROWSER_TEST_F(WebRtcDepthCaptureBrowserTest, GetStreamsByVideoKind) { |
base::StringPrintf("%s({video: true});", kGetStreamsByVideoKind)); |
} |
-IN_PROC_BROWSER_TEST_F(WebRtcDepthCaptureBrowserTest, |
+IN_PROC_BROWSER_TEST_F(WebRtcOneDeviceDepthCaptureBrowserTest, |
GetStreamsByVideoKindNoDepth) { |
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
- // Set fake factory to have only one device, of type "color". |
- RemoveSwitchFromCommandLine(command_line, |
- switches::kUseFakeDeviceForMediaStream); |
- command_line->AppendSwitchASCII(switches::kUseFakeDeviceForMediaStream, |
- "device-count=1"); |
command_line->AppendSwitchASCII("--enable-blink-features", |
"MediaGetSettings,MediaCaptureDepth"); |