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 <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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 275 |
276 media::VideoCaptureParams params; | 276 media::VideoCaptureParams params; |
277 params.width = 352; | 277 params.width = 352; |
278 params.height = 288; | 278 params.height = 288; |
279 params.frame_per_second = 30; | 279 params.frame_per_second = 30; |
280 params.session_id = kTestFakeDeviceId; | 280 params.session_id = kTestFakeDeviceId; |
281 host_->OnStartCapture(kDeviceId, params); | 281 host_->OnStartCapture(kDeviceId, params); |
282 message_loop_->Run(); | 282 message_loop_->Run(); |
283 } | 283 } |
284 | 284 |
| 285 #ifdef DUMP_VIDEO |
285 void CaptureAndDumpVideo(int width, int heigt, int frame_rate) { | 286 void CaptureAndDumpVideo(int width, int heigt, int frame_rate) { |
286 InSequence s; | 287 InSequence s; |
287 // 1. First - get info about the new resolution | 288 // 1. First - get info about the new resolution |
288 EXPECT_CALL(*host_, OnDeviceInfo(kDeviceId)); | 289 EXPECT_CALL(*host_, OnDeviceInfo(kDeviceId)); |
289 | 290 |
290 // 2. Change state to started | 291 // 2. Change state to started |
291 EXPECT_CALL(*host_, OnStateChanged(kDeviceId, | 292 EXPECT_CALL(*host_, OnStateChanged(kDeviceId, |
292 video_capture::kStarted)); | 293 video_capture::kStarted)); |
293 | 294 |
294 // 3. First filled buffer will arrive. | 295 // 3. First filled buffer will arrive. |
295 EXPECT_CALL(*host_, OnBufferFilled(kDeviceId, _, _)) | 296 EXPECT_CALL(*host_, OnBufferFilled(kDeviceId, _, _)) |
296 .Times(AnyNumber()) | 297 .Times(AnyNumber()) |
297 .WillOnce(ExitMessageLoop(message_loop_.get())); | 298 .WillOnce(ExitMessageLoop(message_loop_.get())); |
298 | 299 |
299 media::VideoCaptureParams params; | 300 media::VideoCaptureParams params; |
300 params.width = width; | 301 params.width = width; |
301 params.height = heigt; | 302 params.height = heigt; |
302 params.frame_per_second = frame_rate; | 303 params.frame_per_second = frame_rate; |
303 params.session_id = kTestFakeDeviceId; | 304 params.session_id = kTestFakeDeviceId; |
304 host_->SetDumpVideo(true); | 305 host_->SetDumpVideo(true); |
305 host_->OnStartCapture(kDeviceId, params); | 306 host_->OnStartCapture(kDeviceId, params); |
306 message_loop_->Run(); | 307 message_loop_->Run(); |
307 } | 308 } |
| 309 #endif |
308 | 310 |
309 void StopCapture() { | 311 void StopCapture() { |
310 EXPECT_CALL(*host_, OnStateChanged(kDeviceId, | 312 EXPECT_CALL(*host_, OnStateChanged(kDeviceId, |
311 video_capture::kStopped)) | 313 video_capture::kStopped)) |
312 .WillOnce(ExitMessageLoop(message_loop_.get())); | 314 .WillOnce(ExitMessageLoop(message_loop_.get())); |
313 | 315 |
314 host_->OnStopCapture(kDeviceId); | 316 host_->OnStopCapture(kDeviceId); |
315 host_->SetReturnReceviedDibs(true); | 317 host_->SetReturnReceviedDibs(true); |
316 host_->ReturnReceivedDibs(kDeviceId); | 318 host_->ReturnReceivedDibs(kDeviceId); |
317 | 319 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 } | 387 } |
386 | 388 |
387 #ifdef DUMP_VIDEO | 389 #ifdef DUMP_VIDEO |
388 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) { | 390 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) { |
389 CaptureAndDumpVideo(640, 480, 30); | 391 CaptureAndDumpVideo(640, 480, 30); |
390 } | 392 } |
391 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) { | 393 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) { |
392 CaptureAndDumpVideo(1280, 720, 30); | 394 CaptureAndDumpVideo(1280, 720, 30); |
393 } | 395 } |
394 #endif | 396 #endif |
OLD | NEW |