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

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

Issue 2341643006: ImageCapture browser tests: use IsWebcamAvailableOnSystem() (Closed)
Patch Set: Rebase to https://crrev.com/2334223012 Created 4 years, 3 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
« no previous file with comments | « no previous file | content/browser/webrtc/webrtc_webcam_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "content/browser/webrtc/webrtc_webcam_browsertest.h" 6 #include "content/browser/webrtc/webrtc_webcam_browsertest.h"
7 #include "content/public/common/content_switches.h" 7 #include "content/public/common/content_switches.h"
8 #include "content/public/test/browser_test_utils.h" 8 #include "content/public/test/browser_test_utils.h"
9 #include "content/public/test/content_browser_test.h" 9 #include "content/public/test/content_browser_test.h"
10 #include "content/public/test/content_browser_test_utils.h" 10 #include "content/public/test/content_browser_test_utils.h"
11 #include "content/public/test/test_utils.h" 11 #include "content/public/test/test_utils.h"
12 #include "content/shell/browser/shell.h"
12 #include "media/base/media_switches.h" 13 #include "media/base/media_switches.h"
13 #include "net/test/embedded_test_server/embedded_test_server.h" 14 #include "net/test/embedded_test_server/embedded_test_server.h"
14 15
15 namespace { 16 namespace {
16 17
17 static const char kImageCaptureHtmlFile[] = "/media/image_capture_test.html"; 18 static const char kImageCaptureHtmlFile[] = "/media/image_capture_test.html";
18 19
19 // TODO(mcasas): enable real-camera tests by disabling the Fake Device for 20 // TODO(mcasas): enable real-camera tests by disabling the Fake Device for
20 // platforms where the ImageCaptureCode is landed, https://crbug.com/518807. 21 // platforms where the ImageCaptureCode is landed, https://crbug.com/518807.
21 // TODO(mcasas): enable in Android when takePhoto() can be specified a (small) 22 // TODO(mcasas): enable in Android when takePhoto() can be specified a (small)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 #define MAYBE_CreateAndGetCapabilities DISABLED_CreateAndGetCapabilities 72 #define MAYBE_CreateAndGetCapabilities DISABLED_CreateAndGetCapabilities
72 #else 73 #else
73 #define MAYBE_CreateAndGetCapabilities CreateAndGetCapabilities 74 #define MAYBE_CreateAndGetCapabilities CreateAndGetCapabilities
74 #endif 75 #endif
75 IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureBrowserTest, 76 IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureBrowserTest,
76 MAYBE_CreateAndGetCapabilities) { 77 MAYBE_CreateAndGetCapabilities) {
77 ASSERT_TRUE(embedded_test_server()->Start()); 78 ASSERT_TRUE(embedded_test_server()->Start());
78 GURL url(embedded_test_server()->GetURL(kImageCaptureHtmlFile)); 79 GURL url(embedded_test_server()->GetURL(kImageCaptureHtmlFile));
79 NavigateToURL(shell(), url); 80 NavigateToURL(shell(), url);
80 81
82 if (!IsWebcamAvailableOnSystem(shell()->web_contents())) {
83 DVLOG(0) << "No video device; skipping test...";
84 return;
85 }
86
81 std::string result; 87 std::string result;
82 ASSERT_TRUE(ExecuteScriptAndExtractString( 88 ASSERT_TRUE(ExecuteScriptAndExtractString(
83 shell(), "testCreateAndGetCapabilities()", &result)); 89 shell(), "testCreateAndGetCapabilities()", &result));
84 if (result == "OK") 90 if (result == "OK")
85 return; 91 return;
86 FAIL(); 92 FAIL();
87 } 93 }
88 94
89 #if defined(OS_WIN) 95 #if defined(OS_WIN)
90 // This test is flaky on WebRTC Windows bots: https://crbug.com/633242. 96 // This test is flaky on WebRTC Windows bots: https://crbug.com/633242.
91 #define MAYBE_CreateAndTakePhoto DISABLED_CreateAndTakePhoto 97 #define MAYBE_CreateAndTakePhoto DISABLED_CreateAndTakePhoto
92 #else 98 #else
93 #define MAYBE_CreateAndTakePhoto CreateAndTakePhoto 99 #define MAYBE_CreateAndTakePhoto CreateAndTakePhoto
94 #endif 100 #endif
95 IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureBrowserTest, 101 IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureBrowserTest,
96 MAYBE_CreateAndTakePhoto) { 102 MAYBE_CreateAndTakePhoto) {
97 ASSERT_TRUE(embedded_test_server()->Start()); 103 ASSERT_TRUE(embedded_test_server()->Start());
98 GURL url(embedded_test_server()->GetURL(kImageCaptureHtmlFile)); 104 GURL url(embedded_test_server()->GetURL(kImageCaptureHtmlFile));
99 NavigateToURL(shell(), url); 105 NavigateToURL(shell(), url);
100 106
107 if (!IsWebcamAvailableOnSystem(shell()->web_contents())) {
108 DVLOG(0) << "No video device; skipping test...";
109 return;
110 }
111
101 std::string result; 112 std::string result;
102 ASSERT_TRUE(ExecuteScriptAndExtractString(shell(), "testCreateAndTakePhoto()", 113 ASSERT_TRUE(ExecuteScriptAndExtractString(shell(), "testCreateAndTakePhoto()",
103 &result)); 114 &result));
104 if (result == "OK") 115 if (result == "OK")
105 return; 116 return;
106 FAIL(); 117 FAIL();
107 } 118 }
108 119
109 INSTANTIATE_TEST_CASE_P(, 120 INSTANTIATE_TEST_CASE_P(,
110 WebRtcImageCaptureBrowserTest, 121 WebRtcImageCaptureBrowserTest,
111 testing::ValuesIn(kTestParameters)); 122 testing::ValuesIn(kTestParameters));
112 123
113 } // namespace content 124 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/webrtc/webrtc_webcam_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698