Index: content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc |
diff --git a/content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc b/content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc |
index c907d5ff8cd3dc476b673b56cd928e285299fd28..5c964576d363986a2e69634f8e3197b6f3fb156b 100644 |
--- a/content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc |
+++ b/content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc |
@@ -36,6 +36,7 @@ |
using testing::_; |
using testing::SaveArg; |
+using testing::InvokeWithoutArgs; |
namespace content { |
@@ -354,38 +355,26 @@ TEST_F(MediaDevicesDispatcherHostTest, EnumerateAllDevicesUniqueOrigin) { |
base::RunLoop().RunUntilIdle(); |
// Verify that the callback for a valid origin does get called. |
- EXPECT_CALL(*this, ValidOriginCallback(testing::_)); |
+ base::RunLoop run_loop; |
+ EXPECT_CALL(*this, ValidOriginCallback(testing::_)) |
+ .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); |
gab
2017/04/06 17:09:09
Bind run_loop.QuitClosure() instead of this lambda
chfremer
2017/04/06 17:19:11
I prefer the lambda, because it works with the gmo
gab
2017/04/06 17:20:24
Hmmm that's unfortunate, but yeah okay.
|
host_->EnumerateDevices( |
true, true, true, url::Origin(GURL("http://localhost")), |
base::Bind(&MediaDevicesDispatcherHostTest::ValidOriginCallback, |
base::Unretained(this))); |
- base::RunLoop().RunUntilIdle(); |
-#if defined(OS_WIN) |
- // On Windows, the underlying MediaStreamManager uses a separate thread for |
- // video capture which must be flushed to guarantee that the callback bound to |
- // EnumerateDevices above is invoked before the end of this test's body. |
- media_stream_manager_->FlushVideoCaptureThreadForTesting(); |
- base::RunLoop().RunUntilIdle(); |
-#endif |
+ run_loop.Run(); |
} |
TEST_F(MediaDevicesDispatcherHostTest, GetVideoInputCapabilities) { |
- EXPECT_CALL(*this, MockVideoInputCapabilitiesCallback()); |
+ base::RunLoop run_loop; |
+ EXPECT_CALL(*this, MockVideoInputCapabilitiesCallback()) |
+ .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); |
host_->GetVideoInputCapabilities( |
origin_, |
base::Bind( |
&MediaDevicesDispatcherHostTest::VideoInputCapabilitiesCallback, |
base::Unretained(this))); |
- base::RunLoop().RunUntilIdle(); |
- |
-#if defined(OS_WIN) |
- // On Windows, the underlying MediaStreamManager uses a separate thread for |
- // video capture which must be flushed to guarantee that the callback bound to |
- // GetVIdeoInputCapabilities above is invoked before the end of this test's |
- // body. |
- media_stream_manager_->FlushVideoCaptureThreadForTesting(); |
- base::RunLoop().RunUntilIdle(); |
-#endif |
+ run_loop.Run(); |
} |
}; // namespace content |