Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: content/browser/renderer_host/media/video_capture_host_unittest.cc

Issue 8417046: refactor video capture in browser process to support device sharing across multiple renderer proc... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: code review Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 message_loop_->PostTask( 266 message_loop_->PostTask(
267 FROM_HERE, 267 FROM_HERE,
268 base::Bind(&PostQuitOnVideoCaptureManagerThread, 268 base::Bind(&PostQuitOnVideoCaptureManagerThread,
269 message_loop_.get(), 269 message_loop_.get(),
270 content::MockResourceContext::GetInstance())); 270 content::MockResourceContext::GetInstance()));
271 message_loop_->Run(); 271 message_loop_->Run();
272 } 272 }
273 273
274 void StartCapture() { 274 void StartCapture() {
275 InSequence s; 275 InSequence s;
276 // 1. Newly created buffers will arrive. 276 // 1. First - get info about the new resolution
277 EXPECT_CALL(*host_, OnDeviceInfo(kDeviceId));
278
279 // 2. Change state to started
280 EXPECT_CALL(*host_, OnStateChanged(kDeviceId,
281 media::VideoCapture::kStarted));
282
283 // 3. Newly created buffers will arrive.
277 EXPECT_CALL(*host_, OnNewBufferCreated(kDeviceId, _, _, _)) 284 EXPECT_CALL(*host_, OnNewBufferCreated(kDeviceId, _, _, _))
278 .Times(AnyNumber()) 285 .Times(AnyNumber())
279 .WillRepeatedly(Return()); 286 .WillRepeatedly(Return());
280 287
281 // 2. First - get info about the new resolution
282 EXPECT_CALL(*host_, OnDeviceInfo(kDeviceId));
283
284 // 3. Change state to started
285 EXPECT_CALL(*host_, OnStateChanged(kDeviceId,
286 media::VideoCapture::kStarted));
287
288 // 4. First filled buffer will arrive. 288 // 4. First filled buffer will arrive.
289 EXPECT_CALL(*host_, OnBufferFilled(kDeviceId, _, _)) 289 EXPECT_CALL(*host_, OnBufferFilled(kDeviceId, _, _))
290 .Times(AnyNumber()) 290 .Times(AnyNumber())
291 .WillOnce(ExitMessageLoop(message_loop_.get())); 291 .WillOnce(ExitMessageLoop(message_loop_.get()));
292 292
293 media::VideoCaptureParams params; 293 media::VideoCaptureParams params;
294 params.width = 352; 294 params.width = 352;
295 params.height = 288; 295 params.height = 288;
296 params.frame_per_second = 30; 296 params.frame_per_second = 30;
297 params.session_id = kTestFakeDeviceId; 297 params.session_id = kTestFakeDeviceId;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 } 400 }
401 401
402 #ifdef DUMP_VIDEO 402 #ifdef DUMP_VIDEO
403 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) { 403 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) {
404 CaptureAndDumpVideo(640, 480, 30); 404 CaptureAndDumpVideo(640, 480, 30);
405 } 405 }
406 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) { 406 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) {
407 CaptureAndDumpVideo(1280, 720, 30); 407 CaptureAndDumpVideo(1280, 720, 30);
408 } 408 }
409 #endif 409 #endif
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/video_capture_host.cc ('k') | content/browser/renderer_host/media/video_capture_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698