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.h" | 5 #include "base/message_loop.h" |
6 #include "content/common/child_process.h" | 6 #include "content/common/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 "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 class MockVideoCaptureImpl : public VideoCaptureImpl { | 61 class MockVideoCaptureImpl : public VideoCaptureImpl { |
62 public: | 62 public: |
63 MockVideoCaptureImpl(const media::VideoCaptureSessionId id, | 63 MockVideoCaptureImpl(const media::VideoCaptureSessionId id, |
64 scoped_refptr<base::MessageLoopProxy> ml_proxy, | 64 scoped_refptr<base::MessageLoopProxy> ml_proxy, |
65 VideoCaptureMessageFilter* filter) | 65 VideoCaptureMessageFilter* filter) |
66 : VideoCaptureImpl(id, ml_proxy, filter) { | 66 : VideoCaptureImpl(id, ml_proxy, filter) { |
67 } | 67 } |
68 virtual ~MockVideoCaptureImpl() {} | 68 virtual ~MockVideoCaptureImpl() {} |
69 | 69 |
70 // Override Send() to mimic device to send events. | 70 // Override Send() to mimic device to send events. |
71 void Send(IPC::Message* message) { | 71 virtual void Send(IPC::Message* message) OVERRIDE { |
72 CHECK(message); | 72 CHECK(message); |
73 | 73 |
74 // In this method, messages are sent to the according handlers as if | 74 // In this method, messages are sent to the according handlers as if |
75 // we are the device. | 75 // we are the device. |
76 bool handled = true; | 76 bool handled = true; |
77 IPC_BEGIN_MESSAGE_MAP(MockVideoCaptureImpl, *message) | 77 IPC_BEGIN_MESSAGE_MAP(MockVideoCaptureImpl, *message) |
78 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Start, DeviceStartCapture) | 78 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Start, DeviceStartCapture) |
79 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Pause, DevicePauseCapture) | 79 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Pause, DevicePauseCapture) |
80 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Stop, DeviceStopCapture) | 80 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Stop, DeviceStopCapture) |
81 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_BufferReady, | 81 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_BufferReady, |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 .WillOnce(Return()); | 293 .WillOnce(Return()); |
294 EXPECT_CALL(*client2, OnRemoved(_)) | 294 EXPECT_CALL(*client2, OnRemoved(_)) |
295 .WillOnce(Return()); | 295 .WillOnce(Return()); |
296 | 296 |
297 video_capture_impl_->StopCapture(client1.get()); | 297 video_capture_impl_->StopCapture(client1.get()); |
298 video_capture_impl_->StopCapture(client2.get()); | 298 video_capture_impl_->StopCapture(client2.get()); |
299 message_loop_->RunUntilIdle(); | 299 message_loop_->RunUntilIdle(); |
300 } | 300 } |
301 | 301 |
302 } // namespace content | 302 } // namespace content |
OLD | NEW |