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

Unified Diff: content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc

Issue 2535043003: Fix MediaDevices* tests dependency on BrowserThread globals after ~BrowserThreadImpl(). (Closed)
Patch Set: +comment Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/media/media_devices_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8e1c47943d42b54a6dd0b1efbb061609c93f70c0..d4149cd4e4c5b6b7a7990b011e65085c787e920e 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
@@ -251,9 +251,14 @@ class MediaDevicesDispatcherHostTest : public testing::Test {
}
}
- std::unique_ptr<MediaDevicesDispatcherHost> host_;
+ // The order of these members is important on teardown:
+ // MediaDevicesDispatcherHost expects to be destroyed on the IO thread while
+ // MediaStreamManager expects to be destroyed after the IO thread has been
+ // uninitialized.
std::unique_ptr<MediaStreamManager> media_stream_manager_;
content::TestBrowserThreadBundle thread_bundle_;
+ std::unique_ptr<MediaDevicesDispatcherHost> host_;
+
std::unique_ptr<media::AudioManager, media::AudioManagerDeleter>
audio_manager_;
content::TestBrowserContext browser_context_;
@@ -326,6 +331,13 @@ TEST_F(MediaDevicesDispatcherHostTest, EnumerateAllDevicesUniqueOrigin) {
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
}
}; // namespace content
« no previous file with comments | « no previous file | content/browser/renderer_host/media/media_devices_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698