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