| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
| 6 #include "content/child/child_process.h" | 6 #include "content/child/child_process.h" |
| 7 #include "content/common/media/video_capture_messages.h" | 7 #include "content/common/media/video_capture_messages.h" |
| 8 #include "content/renderer/media/video_capture_impl.h" | 8 #include "content/renderer/media/video_capture_impl.h" |
| 9 #include "media/base/bind_to_current_loop.h" | 9 #include "media/base/bind_to_current_loop.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 public: | 36 public: |
| 37 class MockVideoCaptureImpl : public VideoCaptureImpl { | 37 class MockVideoCaptureImpl : public VideoCaptureImpl { |
| 38 public: | 38 public: |
| 39 MockVideoCaptureImpl(const media::VideoCaptureSessionId id, | 39 MockVideoCaptureImpl(const media::VideoCaptureSessionId id, |
| 40 VideoCaptureMessageFilter* filter) | 40 VideoCaptureMessageFilter* filter) |
| 41 : VideoCaptureImpl(id, filter) { | 41 : VideoCaptureImpl(id, filter) { |
| 42 } | 42 } |
| 43 virtual ~MockVideoCaptureImpl() {} | 43 virtual ~MockVideoCaptureImpl() {} |
| 44 | 44 |
| 45 // Override Send() to mimic device to send events. | 45 // Override Send() to mimic device to send events. |
| 46 virtual void Send(IPC::Message* message) OVERRIDE { | 46 virtual void Send(IPC::Message* message) override { |
| 47 CHECK(message); | 47 CHECK(message); |
| 48 | 48 |
| 49 // In this method, messages are sent to the according handlers as if | 49 // In this method, messages are sent to the according handlers as if |
| 50 // we are the device. | 50 // we are the device. |
| 51 bool handled = true; | 51 bool handled = true; |
| 52 IPC_BEGIN_MESSAGE_MAP(MockVideoCaptureImpl, *message) | 52 IPC_BEGIN_MESSAGE_MAP(MockVideoCaptureImpl, *message) |
| 53 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Start, DeviceStartCapture) | 53 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Start, DeviceStartCapture) |
| 54 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Pause, DevicePauseCapture) | 54 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Pause, DevicePauseCapture) |
| 55 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Stop, DeviceStopCapture) | 55 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Stop, DeviceStopCapture) |
| 56 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_BufferReady, | 56 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_BufferReady, |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 StartCapture(0, params_small_); | 304 StartCapture(0, params_small_); |
| 305 | 305 |
| 306 // Receive state change message from browser. | 306 // Receive state change message from browser. |
| 307 video_capture_impl_->ReceiveStateChangeMessage(VIDEO_CAPTURE_STATE_ERROR); | 307 video_capture_impl_->ReceiveStateChangeMessage(VIDEO_CAPTURE_STATE_ERROR); |
| 308 | 308 |
| 309 StopCapture(0); | 309 StopCapture(0); |
| 310 DeInit(); | 310 DeInit(); |
| 311 } | 311 } |
| 312 | 312 |
| 313 } // namespace content | 313 } // namespace content |
| OLD | NEW |