Chromium Code Reviews| 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 "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 Loading... | |
| 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 #if !defined(OS_LINUX) | |
| 44 {true} | |
| 45 #else | |
| 46 {true}, | |
| 47 {false} | |
| 48 #endif | |
| 49 }; | |
|
xianglu
2016/10/28 16:33:54
Consider:
{
{true},
#if !defined(OS_LINUX)
#el
mcasas
2016/10/28 17:00:49
I'm always wondering if some compilers would not
h
| |
| 43 | 50 |
| 44 } // namespace | 51 } // namespace |
| 45 | 52 |
| 46 // This class is the content_browsertests for Image Capture API, which allows | 53 // This class is the content_browsertests for Image Capture API, which allows |
| 47 // for capturing still images out of a MediaStreamTrack. Is a | 54 // for capturing still images out of a MediaStreamTrack. Is a |
| 48 // WebRtcWebcamBrowserTest to be able to use a physical camera. | 55 // WebRtcWebcamBrowserTest to be able to use a physical camera. |
| 49 class WebRtcImageCaptureBrowserTest | 56 class WebRtcImageCaptureBrowserTest |
| 50 : public WebRtcWebcamBrowserTest, | 57 : public WebRtcWebcamBrowserTest, |
| 51 public testing::WithParamInterface<struct TargetCamera> { | 58 public testing::WithParamInterface<struct TargetCamera> { |
| 52 public: | 59 public: |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 NavigateToURL(shell(), url); | 100 NavigateToURL(shell(), url); |
| 94 | 101 |
| 95 if (!IsWebcamAvailableOnSystem(shell()->web_contents())) { | 102 if (!IsWebcamAvailableOnSystem(shell()->web_contents())) { |
| 96 DVLOG(1) << "No video device; skipping test..."; | 103 DVLOG(1) << "No video device; skipping test..."; |
| 97 return true; | 104 return true; |
| 98 } | 105 } |
| 99 | 106 |
| 100 std::string result; | 107 std::string result; |
| 101 if (!ExecuteScriptAndExtractString(shell(), command, &result)) | 108 if (!ExecuteScriptAndExtractString(shell(), command, &result)) |
| 102 return false; | 109 return false; |
| 110 DLOG_IF(ERROR, result != "OK") << result; | |
| 103 return result == "OK"; | 111 return result == "OK"; |
| 104 } | 112 } |
| 105 | 113 |
| 106 private: | 114 private: |
| 107 DISALLOW_COPY_AND_ASSIGN(WebRtcImageCaptureBrowserTest); | 115 DISALLOW_COPY_AND_ASSIGN(WebRtcImageCaptureBrowserTest); |
| 108 }; | 116 }; |
| 109 | 117 |
| 110 IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureBrowserTest, MAYBE_GetCapabilities) { | 118 IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureBrowserTest, MAYBE_GetCapabilities) { |
| 111 embedded_test_server()->StartAcceptingConnections(); | 119 embedded_test_server()->StartAcceptingConnections(); |
| 112 ASSERT_TRUE(RunImageCaptureTestCase("testCreateAndGetCapabilities()")); | 120 ASSERT_TRUE(RunImageCaptureTestCase("testCreateAndGetCapabilities()")); |
| 113 } | 121 } |
| 114 | 122 |
| 115 IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureBrowserTest, MAYBE_TakePhoto) { | 123 IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureBrowserTest, MAYBE_TakePhoto) { |
| 116 embedded_test_server()->StartAcceptingConnections(); | 124 embedded_test_server()->StartAcceptingConnections(); |
| 117 ASSERT_TRUE(RunImageCaptureTestCase("testCreateAndTakePhoto()")); | 125 ASSERT_TRUE(RunImageCaptureTestCase("testCreateAndTakePhoto()")); |
| 118 } | 126 } |
| 119 | 127 |
| 120 IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureBrowserTest, MAYBE_GrabFrame) { | 128 IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureBrowserTest, MAYBE_GrabFrame) { |
| 121 embedded_test_server()->StartAcceptingConnections(); | 129 embedded_test_server()->StartAcceptingConnections(); |
| 122 ASSERT_TRUE(RunImageCaptureTestCase("testCreateAndGrabFrame()")); | 130 ASSERT_TRUE(RunImageCaptureTestCase("testCreateAndGrabFrame()")); |
| 123 } | 131 } |
| 124 | 132 |
| 125 INSTANTIATE_TEST_CASE_P(, | 133 INSTANTIATE_TEST_CASE_P(, |
| 126 WebRtcImageCaptureBrowserTest, | 134 WebRtcImageCaptureBrowserTest, |
| 127 testing::ValuesIn(kTestParameters)); | 135 testing::ValuesIn(kTestParameters)); |
| 128 | 136 |
| 129 } // namespace content | 137 } // namespace content |
| OLD | NEW |