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 "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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 void DeviceStopCapture(int device_id) { | 90 void DeviceStopCapture(int device_id) { |
91 OnStateChanged(VIDEO_CAPTURE_STATE_STOPPED); | 91 OnStateChanged(VIDEO_CAPTURE_STATE_STOPPED); |
92 } | 92 } |
93 | 93 |
94 void DeviceReceiveEmptyBuffer(int device_id, int buffer_id) {} | 94 void DeviceReceiveEmptyBuffer(int device_id, int buffer_id) {} |
95 }; | 95 }; |
96 | 96 |
97 VideoCaptureImplTest() { | 97 VideoCaptureImplTest() { |
98 params_small_.requested_format = media::VideoCaptureFormat( | 98 params_small_.requested_format = media::VideoCaptureFormat( |
99 176, 144, 30, media::ConstantResolutionVideoCaptureDevice); | 99 gfx::Size(176, 144), 30, media::PIXEL_FORMAT_I420); |
100 | 100 |
101 params_large_.requested_format = media::VideoCaptureFormat( | 101 params_large_.requested_format = media::VideoCaptureFormat( |
102 320, 240, 30, media::ConstantResolutionVideoCaptureDevice); | 102 gfx::Size(320, 240), 30, media::PIXEL_FORMAT_I420); |
103 | 103 |
104 message_loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_IO)); | 104 message_loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_IO)); |
105 message_loop_proxy_ = base::MessageLoopProxy::current().get(); | 105 message_loop_proxy_ = base::MessageLoopProxy::current().get(); |
106 child_process_.reset(new ChildProcess()); | 106 child_process_.reset(new ChildProcess()); |
107 | 107 |
108 message_filter_ = new MockVideoCaptureMessageFilter; | 108 message_filter_ = new MockVideoCaptureMessageFilter; |
109 session_id_ = 1; | 109 session_id_ = 1; |
110 | 110 |
111 video_capture_impl_ = new MockVideoCaptureImpl( | 111 video_capture_impl_ = new MockVideoCaptureImpl( |
112 session_id_, message_loop_proxy_, message_filter_.get()); | 112 session_id_, message_loop_proxy_, message_filter_.get()); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 .WillOnce(Return()); | 265 .WillOnce(Return()); |
266 EXPECT_CALL(*client2, OnRemoved(_)) | 266 EXPECT_CALL(*client2, OnRemoved(_)) |
267 .WillOnce(Return()); | 267 .WillOnce(Return()); |
268 | 268 |
269 video_capture_impl_->StopCapture(client1.get()); | 269 video_capture_impl_->StopCapture(client1.get()); |
270 video_capture_impl_->StopCapture(client2.get()); | 270 video_capture_impl_->StopCapture(client2.get()); |
271 message_loop_->RunUntilIdle(); | 271 message_loop_->RunUntilIdle(); |
272 } | 272 } |
273 | 273 |
274 } // namespace content | 274 } // namespace content |
OLD | NEW |