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..610a204470ae3f445321d6fe16cedb0c4200c41a 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) |
| +#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 MojoTestEnvironment final : public testing::Environment { |
|
chfremer
2017/05/24 23:36:43
Despite the name, this class does not seem to have
jcliang
2017/05/25 14:23:48
Sounds good. Could you point me an appropriate pla
chfremer
2017/05/25 17:13:07
I am not sure either, but keeping it here will lea
|
| + public: |
| + MojoTestEnvironment() : mojo_ipc_thread_("MojoIpcThread") {} |
| + |
| + ~MojoTestEnvironment() 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 MojoTestEnvironment()); |
| + |
| +#endif |
| + |
| } // namespace |
| class VideoCaptureDeviceTest : public testing::TestWithParam<gfx::Size> { |