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

Unified Diff: content/renderer/media/video_capture_impl_manager_unittest.cc

Issue 2721113002: getUserMedia: handle the device starting status report. (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/video_capture_impl_manager_unittest.cc
diff --git a/content/renderer/media/video_capture_impl_manager_unittest.cc b/content/renderer/media/video_capture_impl_manager_unittest.cc
index a68a26b063433642d243c921673969c4c2c05d8c..ea3478f5214c942747c0773b3fd6f2c1751943aa 100644
--- a/content/renderer/media/video_capture_impl_manager_unittest.cc
+++ b/content/renderer/media/video_capture_impl_manager_unittest.cc
@@ -63,6 +63,8 @@ class MockVideoCaptureImpl : public VideoCaptureImpl,
mojom::VideoCaptureObserverPtr observer) override {
// For every Start(), expect a corresponding Stop() call.
EXPECT_CALL(*this, Stop(_));
+ // Simulate device started.
+ OnStateChanged(mojom::VideoCaptureState::STARTED);
}
MOCK_METHOD1(Stop, void(int32_t));
@@ -131,8 +133,13 @@ class VideoCaptureImplManagerTest : public ::testing::Test,
bool same_session_id) {
base::RunLoop run_loop;
base::Closure quit_closure = BindToCurrentLoop(run_loop.QuitClosure());
- EXPECT_CALL(*this, OnStarted(_)).Times(kNumClients - 1)
- .RetiresOnSaturation();
+ if (!same_session_id) {
+ // |OnStarted| will only be received once from each device if there are
+ // multiple request to the same device.
+ EXPECT_CALL(*this, OnStarted(_))
+ .Times(kNumClients - 1)
+ .RetiresOnSaturation();
+ }
EXPECT_CALL(*this, OnStarted(_)).WillOnce(RunClosure(quit_closure))
.RetiresOnSaturation();
chfremer 2017/03/02 17:56:10 If this worked before, it will probably still work
braveyao 2017/03/03 17:53:12 Done.
std::array<base::Closure, kNumClients> stop_callbacks;

Powered by Google App Engine
This is Rietveld 408576698