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

Side by Side Diff: content/renderer/media/video_capture_impl_manager_unittest.cc

Issue 120893002: Eliminate video capture thread in renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test-fix Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/memory/ref_counted.h" 6 #include "base/memory/ref_counted.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "content/child/child_process.h" 9 #include "content/child/child_process.h"
10 #include "content/renderer/media/video_capture_impl.h" 10 #include "content/renderer/media/video_capture_impl.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 EXPECT_CALL(*client1, OnStopped(_)); 134 EXPECT_CALL(*client1, OnStopped(_));
135 EXPECT_CALL(*client1, OnRemoved(_)); 135 EXPECT_CALL(*client1, OnRemoved(_));
136 EXPECT_CALL(*client2, OnStopped(_)); 136 EXPECT_CALL(*client2, OnStopped(_));
137 EXPECT_CALL(*client2, OnRemoved(_)).WillOnce( 137 EXPECT_CALL(*client2, OnRemoved(_)).WillOnce(
138 RunClosure(quit_closure)); 138 RunClosure(quit_closure));
139 handle1->StopCapture(client1.get()); 139 handle1->StopCapture(client1.get());
140 handle2->StopCapture(client2.get()); 140 handle2->StopCapture(client2.get());
141 run_loop.Run(); 141 run_loop.Run();
142 } 142 }
143 EXPECT_TRUE(device1 == device2);
143 144
144 EXPECT_TRUE(device1 == device2);
145 EXPECT_CALL(*static_cast<MockVideoCaptureImpl*>(device1), Destruct()); 145 EXPECT_CALL(*static_cast<MockVideoCaptureImpl*>(device1), Destruct());
146
147 // We have to wait until MockVideoCaptureImpl is destroyed. Because we
148 // use gmock to expect destruction to happen. Otherwise TSAN will
149 // complain. This unfortunately means that we have to know the
150 // 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
151
152 {
153 // Make sure there's no more task on the main thread.
154 // Destruction is now posted on the IO thread.
155 base::RunLoop run_loop;
156 handle1.reset();
157 handle2.reset();
158 run_loop.RunUntilIdle();
159 }
160 {
161 // Make sure there's no more task on the IO thread.
162 // VideoCaptureImpl is now destroyed.
163 base::RunLoop run_loop;
164 child_process_->io_message_loop_proxy()->PostTask(
165 FROM_HERE,
166 BindToCurrentLoop(run_loop.QuitClosure()));
167 run_loop.Run();
168 }
146 } 169 }
147 170
148 } // namespace content 171 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698