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

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

Issue 140633004: Reland CL to implement browser-side logging to WebRtc log. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: These are the changes that should fix crbug.com/338848 Created 6 years, 10 months 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) 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 // Unit test for VideoCaptureController. 5 // Unit test for VideoCaptureController.
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 400
401 media::VideoCaptureParams session_200 = session_100; 401 media::VideoCaptureParams session_200 = session_100;
402 402
403 const gfx::Size capture_resolution(320, 240); 403 const gfx::Size capture_resolution(320, 240);
404 404
405 const VideoCaptureControllerID route_id(0x99); 405 const VideoCaptureControllerID route_id(0x99);
406 406
407 // Start with one client. 407 // Start with one client.
408 controller_->AddClient( 408 controller_->AddClient(
409 route_id, client_a_.get(), base::kNullProcessHandle, 100, session_100); 409 route_id, client_a_.get(), base::kNullProcessHandle, 100, session_100);
410 device_->OnError(); 410 device_->OnError("Test Error");
411 EXPECT_CALL(*client_a_, DoError(route_id)).Times(1); 411 EXPECT_CALL(*client_a_, DoError(route_id)).Times(1);
412 base::RunLoop().RunUntilIdle(); 412 base::RunLoop().RunUntilIdle();
413 Mock::VerifyAndClearExpectations(client_a_.get()); 413 Mock::VerifyAndClearExpectations(client_a_.get());
414 414
415 // Second client connects after the error state. It also should get told of 415 // Second client connects after the error state. It also should get told of
416 // the error. 416 // the error.
417 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1); 417 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1);
418 controller_->AddClient( 418 controller_->AddClient(
419 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200); 419 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200);
420 base::RunLoop().RunUntilIdle(); 420 base::RunLoop().RunUntilIdle();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 // deliver the buffer. The error should be propagated to clients; the buffer 455 // deliver the buffer. The error should be propagated to clients; the buffer
456 // should not be. 456 // should not be.
457 base::RunLoop().RunUntilIdle(); 457 base::RunLoop().RunUntilIdle();
458 Mock::VerifyAndClearExpectations(client_a_.get()); 458 Mock::VerifyAndClearExpectations(client_a_.get());
459 459
460 const gfx::Size dims(320, 240); 460 const gfx::Size dims(320, 240);
461 scoped_refptr<media::VideoCaptureDevice::Client::Buffer> buffer = 461 scoped_refptr<media::VideoCaptureDevice::Client::Buffer> buffer =
462 device_->ReserveOutputBuffer(media::VideoFrame::I420, dims); 462 device_->ReserveOutputBuffer(media::VideoFrame::I420, dims);
463 ASSERT_TRUE(buffer); 463 ASSERT_TRUE(buffer);
464 464
465 device_->OnError(); 465 device_->OnError("Test error");
466 device_->OnIncomingCapturedBuffer(buffer, 466 device_->OnIncomingCapturedBuffer(buffer,
467 media::VideoFrame::I420, 467 media::VideoFrame::I420,
468 dims, 468 dims,
469 base::TimeTicks(), 469 base::TimeTicks(),
470 device_format.frame_rate); 470 device_format.frame_rate);
471 buffer = NULL; 471 buffer = NULL;
472 472
473 EXPECT_CALL(*client_a_, DoError(route_id)).Times(1); 473 EXPECT_CALL(*client_a_, DoError(route_id)).Times(1);
474 base::RunLoop().RunUntilIdle(); 474 base::RunLoop().RunUntilIdle();
475 Mock::VerifyAndClearExpectations(client_a_.get()); 475 Mock::VerifyAndClearExpectations(client_a_.get());
476 476
477 // Second client connects after the error state. It also should get told of 477 // Second client connects after the error state. It also should get told of
478 // the error. 478 // the error.
479 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1); 479 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1);
480 controller_->AddClient( 480 controller_->AddClient(
481 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200); 481 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200);
482 Mock::VerifyAndClearExpectations(client_b_.get()); 482 Mock::VerifyAndClearExpectations(client_b_.get());
483 } 483 }
484 484
485 } // namespace content 485 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698