OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 message_loop_->PostTask( | 264 message_loop_->PostTask( |
265 FROM_HERE, | 265 FROM_HERE, |
266 base::Bind(&PostQuitOnVideoCaptureManagerThread, | 266 base::Bind(&PostQuitOnVideoCaptureManagerThread, |
267 message_loop_.get(), | 267 message_loop_.get(), |
268 content::MockResourceContext::GetInstance())); | 268 content::MockResourceContext::GetInstance())); |
269 message_loop_->Run(); | 269 message_loop_->Run(); |
270 } | 270 } |
271 | 271 |
272 void StartCapture() { | 272 void StartCapture() { |
273 InSequence s; | 273 InSequence s; |
274 // 1. Newly created buffers will arrive. | 274 // 1. First - get info about the new resolution |
| 275 EXPECT_CALL(*host_, OnDeviceInfo(kDeviceId)); |
| 276 |
| 277 // 2. Change state to started |
| 278 EXPECT_CALL(*host_, OnStateChanged(kDeviceId, |
| 279 media::VideoCapture::kStarted)); |
| 280 |
| 281 // 3. Newly created buffers will arrive. |
275 EXPECT_CALL(*host_, OnNewBufferCreated(kDeviceId, _, _, _)) | 282 EXPECT_CALL(*host_, OnNewBufferCreated(kDeviceId, _, _, _)) |
276 .Times(AnyNumber()) | 283 .Times(AnyNumber()) |
277 .WillRepeatedly(Return()); | 284 .WillRepeatedly(Return()); |
278 | 285 |
279 // 2. First - get info about the new resolution | |
280 EXPECT_CALL(*host_, OnDeviceInfo(kDeviceId)); | |
281 | |
282 // 3. Change state to started | |
283 EXPECT_CALL(*host_, OnStateChanged(kDeviceId, | |
284 media::VideoCapture::kStarted)); | |
285 | |
286 // 4. First filled buffer will arrive. | 286 // 4. First filled buffer will arrive. |
287 EXPECT_CALL(*host_, OnBufferFilled(kDeviceId, _, _)) | 287 EXPECT_CALL(*host_, OnBufferFilled(kDeviceId, _, _)) |
288 .Times(AnyNumber()) | 288 .Times(AnyNumber()) |
289 .WillOnce(ExitMessageLoop(message_loop_.get())); | 289 .WillOnce(ExitMessageLoop(message_loop_.get())); |
290 | 290 |
291 media::VideoCaptureParams params; | 291 media::VideoCaptureParams params; |
292 params.width = 352; | 292 params.width = 352; |
293 params.height = 288; | 293 params.height = 288; |
294 params.frame_per_second = 30; | 294 params.frame_per_second = 30; |
295 params.session_id = kTestFakeDeviceId; | 295 params.session_id = kTestFakeDeviceId; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 } | 398 } |
399 | 399 |
400 #ifdef DUMP_VIDEO | 400 #ifdef DUMP_VIDEO |
401 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) { | 401 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) { |
402 CaptureAndDumpVideo(640, 480, 30); | 402 CaptureAndDumpVideo(640, 480, 30); |
403 } | 403 } |
404 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) { | 404 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) { |
405 CaptureAndDumpVideo(1280, 720, 30); | 405 CaptureAndDumpVideo(1280, 720, 30); |
406 } | 406 } |
407 #endif | 407 #endif |
OLD | NEW |