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

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

Issue 2721113002: getUserMedia: handle the device starting status report. (Closed)
Patch Set: address nits Created 3 years, 9 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
« no previous file with comments | « content/renderer/media/video_capture_impl.cc ('k') | content/renderer/media/video_capture_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..817b228ad33055b38ff9d42d4a7bf606c1aa091a 100644
--- a/content/renderer/media/video_capture_impl_manager_unittest.cc
+++ b/content/renderer/media/video_capture_impl_manager_unittest.cc
@@ -21,6 +21,7 @@
using ::testing::_;
using ::testing::DoAll;
+using ::testing::InSequence;
using ::testing::SaveArg;
using media::BindToCurrentLoop;
@@ -63,6 +64,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 +134,15 @@ 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();
+
+ InSequence s;
+ 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();
std::array<base::Closure, kNumClients> stop_callbacks;
« no previous file with comments | « content/renderer/media/video_capture_impl.cc ('k') | content/renderer/media/video_capture_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698