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

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

Issue 1418263006: Extend VideoCaptureDevice::Client::OnError() to have a tracked_objects::Location param. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 587
588 media::VideoCaptureParams session_200 = session_100; 588 media::VideoCaptureParams session_200 = session_100;
589 589
590 const gfx::Size capture_resolution(320, 240); 590 const gfx::Size capture_resolution(320, 240);
591 591
592 const VideoCaptureControllerID route_id(0x99); 592 const VideoCaptureControllerID route_id(0x99);
593 593
594 // Start with one client. 594 // Start with one client.
595 controller_->AddClient( 595 controller_->AddClient(
596 route_id, client_a_.get(), base::kNullProcessHandle, 100, session_100); 596 route_id, client_a_.get(), base::kNullProcessHandle, 100, session_100);
597 device_->OnError("Test Error"); 597 device_->OnError(FROM_HERE, "Test Error");
598 EXPECT_CALL(*client_a_, DoError(route_id)).Times(1); 598 EXPECT_CALL(*client_a_, DoError(route_id)).Times(1);
599 base::RunLoop().RunUntilIdle(); 599 base::RunLoop().RunUntilIdle();
600 Mock::VerifyAndClearExpectations(client_a_.get()); 600 Mock::VerifyAndClearExpectations(client_a_.get());
601 601
602 // Second client connects after the error state. It also should get told of 602 // Second client connects after the error state. It also should get told of
603 // the error. 603 // the error.
604 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1); 604 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1);
605 controller_->AddClient( 605 controller_->AddClient(
606 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200); 606 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200);
607 base::RunLoop().RunUntilIdle(); 607 base::RunLoop().RunUntilIdle();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 Mock::VerifyAndClearExpectations(client_a_.get()); 644 Mock::VerifyAndClearExpectations(client_a_.get());
645 645
646 const gfx::Size dims(320, 240); 646 const gfx::Size dims(320, 240);
647 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer( 647 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer(
648 device_->ReserveOutputBuffer(dims, media::PIXEL_FORMAT_I420, 648 device_->ReserveOutputBuffer(dims, media::PIXEL_FORMAT_I420,
649 media::PIXEL_STORAGE_CPU)); 649 media::PIXEL_STORAGE_CPU));
650 ASSERT_TRUE(buffer.get()); 650 ASSERT_TRUE(buffer.get());
651 651
652 scoped_refptr<media::VideoFrame> video_frame = 652 scoped_refptr<media::VideoFrame> video_frame =
653 WrapI420Buffer(dims, static_cast<uint8*>(buffer->data())); 653 WrapI420Buffer(dims, static_cast<uint8*>(buffer->data()));
654 device_->OnError("Test Error"); 654 device_->OnError(FROM_HERE, "Test Error");
655 device_->OnIncomingCapturedVideoFrame(buffer.Pass(), video_frame, 655 device_->OnIncomingCapturedVideoFrame(buffer.Pass(), video_frame,
656 base::TimeTicks()); 656 base::TimeTicks());
657 657
658 EXPECT_CALL(*client_a_, DoError(route_id)).Times(1); 658 EXPECT_CALL(*client_a_, DoError(route_id)).Times(1);
659 base::RunLoop().RunUntilIdle(); 659 base::RunLoop().RunUntilIdle();
660 Mock::VerifyAndClearExpectations(client_a_.get()); 660 Mock::VerifyAndClearExpectations(client_a_.get());
661 661
662 // Second client connects after the error state. It also should get told of 662 // Second client connects after the error state. It also should get told of
663 // the error. 663 // the error.
664 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1); 664 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1);
665 controller_->AddClient( 665 controller_->AddClient(
666 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200); 666 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200);
667 Mock::VerifyAndClearExpectations(client_b_.get()); 667 Mock::VerifyAndClearExpectations(client_b_.get());
668 } 668 }
669 669
670 } // namespace content 670 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698