Chromium Code Reviews| Index: media/capture/video/video_capture_device_unittest.cc |
| diff --git a/media/capture/video/video_capture_device_unittest.cc b/media/capture/video/video_capture_device_unittest.cc |
| index 4f943695a19b568afea644a29841a43a73de53a0..8fcb9b1daff2aefa8e465db441d78ad26247f760 100644 |
| --- a/media/capture/video/video_capture_device_unittest.cc |
| +++ b/media/capture/video/video_capture_device_unittest.cc |
| @@ -43,6 +43,13 @@ |
| #include "media/capture/video/android/video_capture_device_factory_android.h" |
| #endif |
| +#if defined(OS_CHROMEOS) |
| +#include "media/capture/video/chromeos/video_capture_device_arc_chromeos.h" |
| +#include "media/capture/video/chromeos/video_capture_device_factory_chromeos.h" |
| +#include "mojo/edk/embedder/embedder.h" |
| +#include "mojo/edk/embedder/scoped_ipc_support.h" |
| +#endif |
| + |
| #if defined(OS_MACOSX) |
| // Mac will always give you the size you ask for and this case will fail. |
| #define MAYBE_AllocateBadSize DISABLED_AllocateBadSize |
| @@ -60,7 +67,7 @@ |
| #define MAYBE_CaptureMjpeg CaptureMjpeg |
| #define MAYBE_TakePhoto TakePhoto |
| #define MAYBE_GetPhotoCapabilities GetPhotoCapabilities |
| -#elif defined(OS_LINUX) |
| +#elif defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| // AllocateBadSize will hang when a real camera is attached and if more than one |
| // test is trying to use the camera (even across processes). Do NOT renable |
| // this test without fixing the many bugs associated with it: |
| @@ -69,6 +76,11 @@ |
| #define MAYBE_CaptureMjpeg CaptureMjpeg |
| #define MAYBE_TakePhoto TakePhoto |
| #define MAYBE_GetPhotoCapabilities GetPhotoCapabilities |
| +#elif defined(OS_CHROMEOS) |
|
Pawel Osciak
2017/06/13 08:40:16
Doesn't this disable tests for existing V4L2 devic
jcliang
2017/06/14 04:46:08
Right. I've changed to skip the tests based on a r
|
| +#define MAYBE_AllocateBadSize DISABLED_AllocateBadSize |
| +#define MAYBE_CaptureMjpeg DISABLED_CaptureMjpeg |
| +#define MAYBE_TakePhoto DISABLED_TakePhoto |
| +#define MAYBE_GetPhotoCapabilities DISABLED_GetPhotoCapabilities |
| #else |
| #define MAYBE_AllocateBadSize AllocateBadSize |
| #define MAYBE_CaptureMjpeg CaptureMjpeg |
| @@ -206,6 +218,39 @@ class MockImageCaptureClient |
| mojom::PhotoCapabilitiesPtr capabilities_; |
| }; |
| +#if defined(OS_CHROMEOS) |
| + |
| +class MojoEnabledTestEnvironment final : public testing::Environment { |
| + public: |
| + MojoEnabledTestEnvironment() : mojo_ipc_thread_("MojoIpcThread") {} |
| + |
| + ~MojoEnabledTestEnvironment() final {} |
| + |
| + void SetUp() final { |
| + mojo::edk::Init(); |
| + mojo_ipc_thread_.StartWithOptions( |
| + base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); |
| + mojo_ipc_support_.reset(new mojo::edk::ScopedIPCSupport( |
| + mojo_ipc_thread_.task_runner(), |
| + mojo::edk::ScopedIPCSupport::ShutdownPolicy::FAST)); |
| + VLOG(1) << "Mojo initialized"; |
| + } |
| + |
| + void TearDown() final { |
| + mojo_ipc_support_.reset(); |
| + VLOG(1) << "Mojo IPC tear down"; |
| + } |
| + |
| + private: |
| + base::Thread mojo_ipc_thread_; |
| + std::unique_ptr<mojo::edk::ScopedIPCSupport> mojo_ipc_support_; |
| +}; |
| + |
| +testing::Environment* const mojo_test_env = |
| + testing::AddGlobalTestEnvironment(new MojoEnabledTestEnvironment()); |
| + |
| +#endif |
| + |
| } // namespace |
| class VideoCaptureDeviceTest : public testing::TestWithParam<gfx::Size> { |