| Index: content/renderer/media/video_capture_impl_unittest.cc
|
| diff --git a/content/renderer/media/video_capture_impl_unittest.cc b/content/renderer/media/video_capture_impl_unittest.cc
|
| index 990c07a5ac73ecc822aa9803fba462594d64303f..08770fec601e1a4288bfba36231edc1e43b748a2 100644
|
| --- a/content/renderer/media/video_capture_impl_unittest.cc
|
| +++ b/content/renderer/media/video_capture_impl_unittest.cc
|
| @@ -9,6 +9,7 @@
|
| #include "base/message_loop/message_loop.h"
|
| #include "content/child/child_process.h"
|
| #include "content/common/media/video_capture_messages.h"
|
| +#include "content/common/video_capture.mojom.h"
|
| #include "content/renderer/media/video_capture_impl.h"
|
| #include "media/base/bind_to_current_loop.h"
|
| #include "testing/gmock/include/gmock/gmock.h"
|
| @@ -22,6 +23,21 @@ using ::testing::SaveArg;
|
|
|
| namespace content {
|
|
|
| +// Mock implementation of the Mojo service implementation.
|
| +// TODO(mcasas): In time MockVideoCaptureService will completely replace
|
| +// MockVideoCaptureMessageFilter
|
| +class MockVideoCaptureService : public mojom::VideoCaptureService {
|
| + public:
|
| + MockVideoCaptureService() = default;
|
| +
|
| + MOCK_METHOD1(Stop, void(int32_t));
|
| + MOCK_METHOD1(Pause, void(int32_t));
|
| + MOCK_METHOD1(RequestRefreshFrame, void(int32_t));
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(MockVideoCaptureService);
|
| +};
|
| +
|
| class MockVideoCaptureMessageFilter : public VideoCaptureMessageFilter {
|
| public:
|
| MockVideoCaptureMessageFilter() : VideoCaptureMessageFilter() {}
|
| @@ -48,15 +64,11 @@ class VideoCaptureImplTest : public ::testing::Test {
|
|
|
| // Override Send() to mimic device to send events.
|
| void Send(IPC::Message* message) override {
|
| - CHECK(message);
|
| -
|
| // In this method, messages are sent to the according handlers as if
|
| // we are the device.
|
| bool handled = true;
|
| IPC_BEGIN_MESSAGE_MAP(MockVideoCaptureImpl, *message)
|
| IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Start, DeviceStartCapture)
|
| - IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Pause, DevicePauseCapture)
|
| - IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Stop, DeviceStopCapture)
|
| IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_BufferReady,
|
| DeviceReceiveEmptyBuffer)
|
| IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_GetDeviceSupportedFormats,
|
| @@ -76,12 +88,6 @@ class VideoCaptureImplTest : public ::testing::Test {
|
| capture_params_ = params;
|
| }
|
|
|
| - void DevicePauseCapture(int device_id) {}
|
| -
|
| - void DeviceStopCapture(int device_id) {
|
| - OnStateChanged(VIDEO_CAPTURE_STATE_STOPPED);
|
| - }
|
| -
|
| void DeviceReceiveEmptyBuffer(int device_id,
|
| int buffer_id,
|
| const gpu::SyncToken& release_sync_token,
|
| @@ -127,9 +133,10 @@ class VideoCaptureImplTest : public ::testing::Test {
|
| params_large_.requested_format = media::VideoCaptureFormat(
|
| gfx::Size(320, 240), 30, media::PIXEL_FORMAT_I420);
|
|
|
| + video_capture_impl_->SetVideoCaptureServiceForTesting(
|
| + &mock_video_capture_service_);
|
| video_capture_impl_->device_id_ = 2;
|
| }
|
| -
|
| virtual ~VideoCaptureImplTest() {}
|
|
|
| protected:
|
| @@ -199,6 +206,7 @@ class VideoCaptureImplTest : public ::testing::Test {
|
| const scoped_refptr<MockVideoCaptureMessageFilter> message_filter_;
|
| const media::VideoCaptureSessionId session_id_;
|
| std::unique_ptr<MockVideoCaptureImpl> video_capture_impl_;
|
| + MockVideoCaptureService mock_video_capture_service_;
|
| media::VideoCaptureParams params_small_;
|
| media::VideoCaptureParams params_large_;
|
|
|
|
|