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

Side by Side Diff: ipc/ipc_channel_posix_unittest.cc

Issue 8885020: Removing MessageLoop::QuitTask() from ipc/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // These tests are POSIX only. 5 // These tests are POSIX only.
6 6
7 #include "ipc/ipc_channel_posix.h" 7 #include "ipc/ipc_channel_posix.h"
8 8
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <sys/socket.h> 10 #include <sys/socket.h>
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 170 }
171 handle->socket.fd = socket_fd; 171 handle->socket.fd = socket_fd;
172 } 172 }
173 173
174 void IPCChannelPosixTest::SpinRunLoop(int milliseconds) { 174 void IPCChannelPosixTest::SpinRunLoop(int milliseconds) {
175 MessageLoopForIO *loop = MessageLoopForIO::current(); 175 MessageLoopForIO *loop = MessageLoopForIO::current();
176 // Post a quit task so that this loop eventually ends and we don't hang 176 // Post a quit task so that this loop eventually ends and we don't hang
177 // in the case of a bad test. Usually, the run loop will quit sooner than 177 // in the case of a bad test. Usually, the run loop will quit sooner than
178 // that because all tests use a IPCChannelPosixTestListener which quits the 178 // that because all tests use a IPCChannelPosixTestListener which quits the
179 // current run loop on any channel activity. 179 // current run loop on any channel activity.
180 loop->PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask(), milliseconds); 180 loop->PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), milliseconds);
181 loop->Run(); 181 loop->Run();
182 } 182 }
183 183
184 TEST_F(IPCChannelPosixTest, BasicListen) { 184 TEST_F(IPCChannelPosixTest, BasicListen) {
185 185
186 #if defined(OS_ANDROID) 186 #if defined(OS_ANDROID)
187 const char* kChannelName = "/data/local/IPCChannelPosixTest_BasicListen"; 187 const char* kChannelName = "/data/local/IPCChannelPosixTest_BasicListen";
188 #else 188 #else
189 const char* kChannelName = "/var/tmp/IPCChannelPosixTest_BasicListen"; 189 const char* kChannelName = "/var/tmp/IPCChannelPosixTest_BasicListen";
190 #endif 190 #endif
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 // it. 408 // it.
409 bool connected = channel.Connect(); 409 bool connected = channel.Connect();
410 if (connected) { 410 if (connected) {
411 IPCChannelPosixTest::SpinRunLoop(TestTimeouts::action_max_timeout_ms()); 411 IPCChannelPosixTest::SpinRunLoop(TestTimeouts::action_max_timeout_ms());
412 EXPECT_EQ(IPCChannelPosixTestListener::CHANNEL_ERROR, listener.status()); 412 EXPECT_EQ(IPCChannelPosixTestListener::CHANNEL_ERROR, listener.status());
413 } else { 413 } else {
414 EXPECT_EQ(IPCChannelPosixTestListener::DISCONNECTED, listener.status()); 414 EXPECT_EQ(IPCChannelPosixTestListener::DISCONNECTED, listener.status());
415 } 415 }
416 return 0; 416 return 0;
417 } 417 }
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