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

Side by Side Diff: ipc/ipc_sync_channel_unittest.cc

Issue 11420048: ipc: Update calls from RunAllPending() to RunUntilIdle(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Unit test for SyncChannel. 5 // Unit test for SyncChannel.
6 6
7 #include "ipc/ipc_sync_channel.h" 7 #include "ipc/ipc_sync_channel.h"
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 channel_.reset(CreateChannel()); 179 channel_.reset(CreateChannel());
180 channel_created_->Signal(); 180 channel_created_->Signal();
181 Run(); 181 Run();
182 } 182 }
183 183
184 void OnListenerThreadShutdown1(WaitableEvent* listener_event, 184 void OnListenerThreadShutdown1(WaitableEvent* listener_event,
185 WaitableEvent* ipc_event) { 185 WaitableEvent* ipc_event) {
186 // SyncChannel needs to be destructed on the thread that it was created on. 186 // SyncChannel needs to be destructed on the thread that it was created on.
187 channel_.reset(); 187 channel_.reset();
188 188
189 MessageLoop::current()->RunAllPending(); 189 MessageLoop::current()->RunUntilIdle();
190 190
191 ipc_thread_.message_loop()->PostTask( 191 ipc_thread_.message_loop()->PostTask(
192 FROM_HERE, base::Bind(&Worker::OnIPCThreadShutdown, this, 192 FROM_HERE, base::Bind(&Worker::OnIPCThreadShutdown, this,
193 listener_event, ipc_event)); 193 listener_event, ipc_event));
194 } 194 }
195 195
196 void OnIPCThreadShutdown(WaitableEvent* listener_event, 196 void OnIPCThreadShutdown(WaitableEvent* listener_event,
197 WaitableEvent* ipc_event) { 197 WaitableEvent* ipc_event) {
198 MessageLoop::current()->RunAllPending(); 198 MessageLoop::current()->RunUntilIdle();
199 ipc_event->Signal(); 199 ipc_event->Signal();
200 200
201 listener_thread_.message_loop()->PostTask( 201 listener_thread_.message_loop()->PostTask(
202 FROM_HERE, base::Bind(&Worker::OnListenerThreadShutdown2, this, 202 FROM_HERE, base::Bind(&Worker::OnListenerThreadShutdown2, this,
203 listener_event)); 203 listener_event));
204 } 204 }
205 205
206 void OnListenerThreadShutdown2(WaitableEvent* listener_event) { 206 void OnListenerThreadShutdown2(WaitableEvent* listener_event) {
207 MessageLoop::current()->RunAllPending(); 207 MessageLoop::current()->RunUntilIdle();
208 listener_event->Signal(); 208 listener_event->Signal();
209 } 209 }
210 210
211 bool OnMessageReceived(const Message& message) { 211 bool OnMessageReceived(const Message& message) {
212 IPC_BEGIN_MESSAGE_MAP(Worker, message) 212 IPC_BEGIN_MESSAGE_MAP(Worker, message)
213 IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncChannelTestMsg_Double, OnDoubleDelay) 213 IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncChannelTestMsg_Double, OnDoubleDelay)
214 IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncChannelTestMsg_AnswerToLife, 214 IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncChannelTestMsg_AnswerToLife,
215 OnAnswerDelay) 215 OnAnswerDelay)
216 IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncChannelNestedTestMsg_String, 216 IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncChannelNestedTestMsg_String,
217 OnNestedTestMsg) 217 OnNestedTestMsg)
(...skipping 1738 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 1956
1957 } // namespace 1957 } // namespace
1958 1958
1959 // Windows needs to send an out-of-band secret to verify the client end of the 1959 // Windows needs to send an out-of-band secret to verify the client end of the
1960 // channel. Test that we still connect correctly in that case. 1960 // channel. Test that we still connect correctly in that case.
1961 TEST_F(IPCSyncChannelTest, Verified) { 1961 TEST_F(IPCSyncChannelTest, Verified) {
1962 Verified(); 1962 Verified();
1963 } 1963 }
1964 1964
1965 } // namespace IPC 1965 } // namespace IPC
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698