| Index: device/capture/video/video_capture_device_unittest.cc
|
| diff --git a/media/capture/video/video_capture_device_unittest.cc b/device/capture/video/video_capture_device_unittest.cc
|
| similarity index 92%
|
| rename from media/capture/video/video_capture_device_unittest.cc
|
| rename to device/capture/video/video_capture_device_unittest.cc
|
| index a684a3b7e5b3e8c5bcee5af06b32e0fe8823709f..616fb35bb8107b0cf38aeb1080686b0a8fbc547e 100644
|
| --- a/media/capture/video/video_capture_device_unittest.cc
|
| +++ b/device/capture/video/video_capture_device_unittest.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "media/capture/video/video_capture_device.h"
|
| +#include "device/capture/video/video_capture_device.h"
|
|
|
| #include <stddef.h>
|
| #include <stdint.h>
|
| @@ -19,26 +19,26 @@
|
| #include "base/threading/thread.h"
|
| #include "base/threading/thread_task_runner_handle.h"
|
| #include "build/build_config.h"
|
| +#include "device/capture/video/video_capture_device_factory.h"
|
| #include "media/base/bind_to_current_loop.h"
|
| #include "media/base/video_capture_types.h"
|
| -#include "media/capture/video/video_capture_device_factory.h"
|
| #include "testing/gmock/include/gmock/gmock.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| #if defined(OS_WIN)
|
| #include "base/win/scoped_com_initializer.h"
|
| #include "base/win/windows_version.h" // For fine-grained suppression.
|
| -#include "media/capture/video/win/video_capture_device_factory_win.h"
|
| +#include "device/capture/video/win/video_capture_device_factory_win.h"
|
| #endif
|
|
|
| #if defined(OS_MACOSX)
|
| +#include "device/capture/video/mac/video_capture_device_factory_mac.h"
|
| #include "media/base/mac/avfoundation_glue.h"
|
| -#include "media/capture/video/mac/video_capture_device_factory_mac.h"
|
| #endif
|
|
|
| #if defined(OS_ANDROID)
|
| #include "base/android/jni_android.h"
|
| -#include "media/capture/video/android/video_capture_device_android.h"
|
| +#include "device/capture/video/android/video_capture_device_android.h"
|
| #endif
|
|
|
| #if defined(OS_MACOSX)
|
| @@ -78,7 +78,7 @@
|
| using ::testing::_;
|
| using ::testing::SaveArg;
|
|
|
| -namespace media {
|
| +namespace device {
|
| namespace {
|
|
|
| class MockVideoCaptureClient : public VideoCaptureDevice::Client {
|
| @@ -145,7 +145,7 @@ class MockVideoCaptureClient : public VideoCaptureDevice::Client {
|
| class MockImageCaptureClient : public base::RefCounted<MockImageCaptureClient> {
|
| public:
|
| // GMock doesn't support move-only arguments, so we use this forward method.
|
| - void DoOnPhotoTaken(mojom::BlobPtr blob) {
|
| + void DoOnPhotoTaken(media::mojom::BlobPtr blob) {
|
| EXPECT_STREQ("image/jpeg", blob->mime_type.c_str());
|
| ASSERT_GT(blob->data.size(), 4u);
|
| // Check some bytes that univocally identify |data| as a JPEG File.
|
| @@ -158,7 +158,7 @@ class MockImageCaptureClient : public base::RefCounted<MockImageCaptureClient> {
|
| }
|
| MOCK_METHOD0(OnCorrectPhotoTaken, void(void));
|
| MOCK_METHOD1(OnTakePhotoFailure,
|
| - void(const base::Callback<void(mojom::BlobPtr)>&));
|
| + void(const base::Callback<void(media::mojom::BlobPtr)>&));
|
|
|
| private:
|
| friend class base::RefCounted<MockImageCaptureClient>;
|
| @@ -260,7 +260,7 @@ class VideoCaptureDeviceTest : public testing::TestWithParam<gfx::Size> {
|
| }
|
| }
|
| }
|
| - DVLOG_IF(1, pixel_format != PIXEL_FORMAT_MAX)
|
| + DVLOG_IF(1, pixel_format != media::PIXEL_FORMAT_MAX)
|
| << "No camera can capture the"
|
| << " format: " << VideoPixelFormatToString(pixel_format);
|
| return std::unique_ptr<VideoCaptureDeviceDescriptor>();
|
| @@ -327,7 +327,7 @@ TEST_F(VideoCaptureDeviceTest, MAYBE_OpenInvalidDevice) {
|
| VideoCaptureParams capture_params;
|
| capture_params.requested_format.frame_size.SetSize(640, 480);
|
| capture_params.requested_format.frame_rate = 30;
|
| - capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420;
|
| + capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420;
|
| device->AllocateAndStart(capture_params, std::move(video_capture_client_));
|
| device->StopAndDeAllocate();
|
| #endif
|
| @@ -357,13 +357,13 @@ TEST_P(VideoCaptureDeviceTest, CaptureWithSize) {
|
| VideoCaptureParams capture_params;
|
| capture_params.requested_format.frame_size.SetSize(width, height);
|
| capture_params.requested_format.frame_rate = 30.0f;
|
| - capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420;
|
| + capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420;
|
| device->AllocateAndStart(capture_params, std::move(video_capture_client_));
|
| // Get captured video frames.
|
| WaitForCapturedFrame();
|
| EXPECT_EQ(last_format().frame_size.width(), width);
|
| EXPECT_EQ(last_format().frame_size.height(), height);
|
| - if (last_format().pixel_format != PIXEL_FORMAT_MJPEG)
|
| + if (last_format().pixel_format != media::PIXEL_FORMAT_MJPEG)
|
| EXPECT_EQ(size.GetArea(), last_format().frame_size.GetArea());
|
| device->StopAndDeAllocate();
|
| }
|
| @@ -393,13 +393,13 @@ TEST_F(VideoCaptureDeviceTest, MAYBE_AllocateBadSize) {
|
| VideoCaptureParams capture_params;
|
| capture_params.requested_format.frame_size.SetSize(637, 472);
|
| capture_params.requested_format.frame_rate = 35;
|
| - capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420;
|
| + capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420;
|
| device->AllocateAndStart(capture_params, std::move(video_capture_client_));
|
| WaitForCapturedFrame();
|
| device->StopAndDeAllocate();
|
| EXPECT_EQ(last_format().frame_size.width(), input_size.width());
|
| EXPECT_EQ(last_format().frame_size.height(), input_size.height());
|
| - if (last_format().pixel_format != PIXEL_FORMAT_MJPEG)
|
| + if (last_format().pixel_format != media::PIXEL_FORMAT_MJPEG)
|
| EXPECT_EQ(input_size.GetArea(), last_format().frame_size.GetArea());
|
| }
|
|
|
| @@ -426,7 +426,7 @@ TEST_F(VideoCaptureDeviceTest, DISABLED_ReAllocateCamera) {
|
| VideoCaptureParams capture_params;
|
| capture_params.requested_format.frame_size = resolution;
|
| capture_params.requested_format.frame_rate = 30;
|
| - capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420;
|
| + capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420;
|
| device->AllocateAndStart(capture_params, std::move(video_capture_client_));
|
| device->StopAndDeAllocate();
|
| }
|
| @@ -435,7 +435,7 @@ TEST_F(VideoCaptureDeviceTest, DISABLED_ReAllocateCamera) {
|
| VideoCaptureParams capture_params;
|
| capture_params.requested_format.frame_size.SetSize(320, 240);
|
| capture_params.requested_format.frame_rate = 30;
|
| - capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420;
|
| + capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420;
|
|
|
| ResetWithNewClient();
|
| std::unique_ptr<VideoCaptureDevice> device(
|
| @@ -466,7 +466,7 @@ TEST_F(VideoCaptureDeviceTest, DeAllocateCameraWhileRunning) {
|
| VideoCaptureParams capture_params;
|
| capture_params.requested_format.frame_size.SetSize(640, 480);
|
| capture_params.requested_format.frame_rate = 30;
|
| - capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420;
|
| + capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420;
|
| device->AllocateAndStart(capture_params, std::move(video_capture_client_));
|
| // Get captured video frames.
|
| WaitForCapturedFrame();
|
| @@ -479,7 +479,7 @@ TEST_F(VideoCaptureDeviceTest, DeAllocateCameraWhileRunning) {
|
| // Start the camera in 720p to capture MJPEG instead of a raw format.
|
| TEST_F(VideoCaptureDeviceTest, MAYBE_CaptureMjpeg) {
|
| std::unique_ptr<VideoCaptureDeviceDescriptor> device_descriptor =
|
| - GetFirstDeviceDescriptorSupportingPixelFormat(PIXEL_FORMAT_MJPEG);
|
| + GetFirstDeviceDescriptorSupportingPixelFormat(media::PIXEL_FORMAT_MJPEG);
|
| if (!device_descriptor) {
|
| VLOG(1) << "No camera supports MJPEG format. Exiting test.";
|
| return;
|
| @@ -501,25 +501,25 @@ TEST_F(VideoCaptureDeviceTest, MAYBE_CaptureMjpeg) {
|
| VideoCaptureParams capture_params;
|
| capture_params.requested_format.frame_size.SetSize(1280, 720);
|
| capture_params.requested_format.frame_rate = 30;
|
| - capture_params.requested_format.pixel_format = PIXEL_FORMAT_MJPEG;
|
| + capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_MJPEG;
|
| device->AllocateAndStart(capture_params, std::move(video_capture_client_));
|
| // Get captured video frames.
|
| WaitForCapturedFrame();
|
| // Verify we get MJPEG from the device. Not all devices can capture 1280x720
|
| // @ 30 fps, so we don't care about the exact resolution we get.
|
| - EXPECT_EQ(last_format().pixel_format, PIXEL_FORMAT_MJPEG);
|
| + EXPECT_EQ(last_format().pixel_format, media::PIXEL_FORMAT_MJPEG);
|
| EXPECT_GE(static_cast<size_t>(1280 * 720),
|
| last_format().ImageAllocationSize());
|
| device->StopAndDeAllocate();
|
| }
|
|
|
| TEST_F(VideoCaptureDeviceTest, GetDeviceSupportedFormats) {
|
| - // Use PIXEL_FORMAT_MAX to iterate all device names for testing
|
| + // Use media::PIXEL_FORMAT_MAX to iterate all device names for testing
|
| // GetDeviceSupportedFormats().
|
| std::unique_ptr<VideoCaptureDeviceDescriptor> device_descriptor =
|
| - GetFirstDeviceDescriptorSupportingPixelFormat(PIXEL_FORMAT_MAX);
|
| - // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else to test here
|
| - // since we cannot forecast the hardware capabilities.
|
| + GetFirstDeviceDescriptorSupportingPixelFormat(media::PIXEL_FORMAT_MAX);
|
| + // Verify no camera returned for media::PIXEL_FORMAT_MAX. Nothing else to test
|
| + // here since we cannot forecast the hardware capabilities.
|
| ASSERT_FALSE(device_descriptor);
|
| }
|
|
|
| @@ -540,7 +540,7 @@ TEST_F(VideoCaptureDeviceTest, MAYBE_TakePhoto) {
|
| VideoCaptureParams capture_params;
|
| capture_params.requested_format.frame_size.SetSize(640, 480);
|
| capture_params.requested_format.frame_rate = 30;
|
| - capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420;
|
| + capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420;
|
| device->AllocateAndStart(capture_params, std::move(video_capture_client_));
|
| WaitForCapturedFrame();
|
|
|
| @@ -557,4 +557,4 @@ TEST_F(VideoCaptureDeviceTest, MAYBE_TakePhoto) {
|
| device->StopAndDeAllocate();
|
| }
|
|
|
| -}; // namespace media
|
| +}; // namespace device
|
|
|