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

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

Issue 2456193004: Image Capture: enable content_browsertests in Linux/CrOs (Closed)
Patch Set: xianglu@ comments Created 4 years, 1 month 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/test/data/media/image_capture_test.html » ('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 "build/build_config.h" 6 #include "build/build_config.h"
7 #include "content/browser/webrtc/webrtc_webcam_browsertest.h" 7 #include "content/browser/webrtc/webrtc_webcam_browsertest.h"
8 #include "content/public/common/content_switches.h" 8 #include "content/public/common/content_switches.h"
9 #include "content/public/test/browser_test_utils.h" 9 #include "content/public/test/browser_test_utils.h"
10 #include "content/public/test/content_browser_test.h" 10 #include "content/public/test/content_browser_test.h"
(...skipping 21 matching lines...) Expand all
32 #endif 32 #endif
33 33
34 namespace { 34 namespace {
35 35
36 static const char kImageCaptureHtmlFile[] = "/media/image_capture_test.html"; 36 static const char kImageCaptureHtmlFile[] = "/media/image_capture_test.html";
37 37
38 // TODO(mcasas): enable real-camera tests by disabling the Fake Device for 38 // TODO(mcasas): enable real-camera tests by disabling the Fake Device for
39 // platforms where the ImageCaptureCode is landed, https://crbug.com/656810 39 // platforms where the ImageCaptureCode is landed, https://crbug.com/656810
40 static struct TargetCamera { 40 static struct TargetCamera {
41 bool use_fake; 41 bool use_fake;
42 } const kTestParameters[] = {{true}}; 42 } const kTestParameters[] = {
43 {true},
44 #if !defined(OS_LINUX)
45 {false}
46 #endif
47 };
43 48
44 } // namespace 49 } // namespace
45 50
46 // This class is the content_browsertests for Image Capture API, which allows 51 // This class is the content_browsertests for Image Capture API, which allows
47 // for capturing still images out of a MediaStreamTrack. Is a 52 // for capturing still images out of a MediaStreamTrack. Is a
48 // WebRtcWebcamBrowserTest to be able to use a physical camera. 53 // WebRtcWebcamBrowserTest to be able to use a physical camera.
49 class WebRtcImageCaptureBrowserTest 54 class WebRtcImageCaptureBrowserTest
50 : public WebRtcWebcamBrowserTest, 55 : public WebRtcWebcamBrowserTest,
51 public testing::WithParamInterface<struct TargetCamera> { 56 public testing::WithParamInterface<struct TargetCamera> {
52 public: 57 public:
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 NavigateToURL(shell(), url); 98 NavigateToURL(shell(), url);
94 99
95 if (!IsWebcamAvailableOnSystem(shell()->web_contents())) { 100 if (!IsWebcamAvailableOnSystem(shell()->web_contents())) {
96 DVLOG(1) << "No video device; skipping test..."; 101 DVLOG(1) << "No video device; skipping test...";
97 return true; 102 return true;
98 } 103 }
99 104
100 std::string result; 105 std::string result;
101 if (!ExecuteScriptAndExtractString(shell(), command, &result)) 106 if (!ExecuteScriptAndExtractString(shell(), command, &result))
102 return false; 107 return false;
108 DLOG_IF(ERROR, result != "OK") << result;
103 return result == "OK"; 109 return result == "OK";
104 } 110 }
105 111
106 private: 112 private:
107 DISALLOW_COPY_AND_ASSIGN(WebRtcImageCaptureBrowserTest); 113 DISALLOW_COPY_AND_ASSIGN(WebRtcImageCaptureBrowserTest);
108 }; 114 };
109 115
110 IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureBrowserTest, MAYBE_GetCapabilities) { 116 IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureBrowserTest, MAYBE_GetCapabilities) {
111 embedded_test_server()->StartAcceptingConnections(); 117 embedded_test_server()->StartAcceptingConnections();
112 ASSERT_TRUE(RunImageCaptureTestCase("testCreateAndGetCapabilities()")); 118 ASSERT_TRUE(RunImageCaptureTestCase("testCreateAndGetCapabilities()"));
113 } 119 }
114 120
115 IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureBrowserTest, MAYBE_TakePhoto) { 121 IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureBrowserTest, MAYBE_TakePhoto) {
116 embedded_test_server()->StartAcceptingConnections(); 122 embedded_test_server()->StartAcceptingConnections();
117 ASSERT_TRUE(RunImageCaptureTestCase("testCreateAndTakePhoto()")); 123 ASSERT_TRUE(RunImageCaptureTestCase("testCreateAndTakePhoto()"));
118 } 124 }
119 125
120 IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureBrowserTest, MAYBE_GrabFrame) { 126 IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureBrowserTest, MAYBE_GrabFrame) {
121 embedded_test_server()->StartAcceptingConnections(); 127 embedded_test_server()->StartAcceptingConnections();
122 ASSERT_TRUE(RunImageCaptureTestCase("testCreateAndGrabFrame()")); 128 ASSERT_TRUE(RunImageCaptureTestCase("testCreateAndGrabFrame()"));
123 } 129 }
124 130
125 INSTANTIATE_TEST_CASE_P(, 131 INSTANTIATE_TEST_CASE_P(,
126 WebRtcImageCaptureBrowserTest, 132 WebRtcImageCaptureBrowserTest,
127 testing::ValuesIn(kTestParameters)); 133 testing::ValuesIn(kTestParameters));
128 134
129 } // namespace content 135 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/test/data/media/image_capture_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698