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 33b9935d8c5ffe4c7ad24fe5530d5f1c972f452b..dded2756c53eb1b962d86003873ef5808a1f766b 100644 |
--- a/content/renderer/media/video_capture_impl_manager_unittest.cc |
+++ b/content/renderer/media/video_capture_impl_manager_unittest.cc |
@@ -140,9 +140,32 @@ TEST_F(VideoCaptureImplManagerTest, MultipleClients) { |
handle2->StopCapture(client2.get()); |
run_loop.Run(); |
} |
- |
EXPECT_TRUE(device1 == device2); |
+ |
EXPECT_CALL(*static_cast<MockVideoCaptureImpl*>(device1), Destruct()); |
+ |
+ // We have to wait until MockVideoCaptureImpl is destroyed. Because we |
+ // use gmock to expect destruction to happen. Otherwise TSAN will |
+ // complain. This unfortunately means that we have to know the |
+ // destruction sequence of VideoCaptureImpl. |
Ami GONE FROM CHROMIUM
2014/01/13 18:26:37
If the thing you're trying to assert here is that
|
+ |
+ { |
+ // Make sure there's no more task on the main thread. |
+ // Destruction is now posted on the IO thread. |
+ base::RunLoop run_loop; |
+ handle1.reset(); |
+ handle2.reset(); |
+ run_loop.RunUntilIdle(); |
+ } |
+ { |
+ // Make sure there's no more task on the IO thread. |
+ // VideoCaptureImpl is now destroyed. |
+ base::RunLoop run_loop; |
+ child_process_->io_message_loop_proxy()->PostTask( |
+ FROM_HERE, |
+ BindToCurrentLoop(run_loop.QuitClosure())); |
+ run_loop.Run(); |
+ } |
} |
} // namespace content |