diff options
author | tedvessenes@gmail.com <tedvessenes@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-11 15:41:43 +0000 |
---|---|---|
committer | tedvessenes@gmail.com <tedvessenes@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-11 15:41:43 +0000 |
commit | 0f2e45ec2650ebd32037ca109f1876ed85ce1fd5 (patch) | |
tree | 0e289579bccf4d39273e60010eeed8699fa00bd8 /ipc/ipc_channel_posix_unittest.cc | |
parent | b80ffe2725c3d5ca17d21e3743c06689bca46935 (diff) | |
download | chromium_src-0f2e45ec2650ebd32037ca109f1876ed85ce1fd5.zip chromium_src-0f2e45ec2650ebd32037ca109f1876ed85ce1fd5.tar.gz chromium_src-0f2e45ec2650ebd32037ca109f1876ed85ce1fd5.tar.bz2 |
Switch to TimeDelta interfaces for process waiting functions in net and ipc.
R=agl@chromium.org
BUG=108171
Review URL: https://chromiumcodereview.appspot.com/10692155
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146124 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_channel_posix_unittest.cc')
-rw-r--r-- | ipc/ipc_channel_posix_unittest.cc | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/ipc/ipc_channel_posix_unittest.cc b/ipc/ipc_channel_posix_unittest.cc index 834f0ea..f8842c3 100644 --- a/ipc/ipc_channel_posix_unittest.cc +++ b/ipc/ipc_channel_posix_unittest.cc @@ -98,7 +98,7 @@ class IPCChannelPosixTest : public base::MultiProcessTest { public: static void SetUpSocket(IPC::ChannelHandle *handle, IPC::Channel::Mode mode); - static void SpinRunLoop(int milliseconds); + static void SpinRunLoop(base::TimeDelta delay); static const std::string GetConnectionSocketName(); static const std::string GetChannelDirName(); @@ -180,7 +180,7 @@ void IPCChannelPosixTest::SetUpSocket(IPC::ChannelHandle *handle, handle->socket.fd = socket_fd; } -void IPCChannelPosixTest::SpinRunLoop(int milliseconds) { +void IPCChannelPosixTest::SpinRunLoop(base::TimeDelta delay) { MessageLoopForIO *loop = MessageLoopForIO::current(); // Post a quit task so that this loop eventually ends and we don't hang // in the case of a bad test. Usually, the run loop will quit sooner than @@ -189,7 +189,7 @@ void IPCChannelPosixTest::SpinRunLoop(int milliseconds) { loop->PostDelayedTask( FROM_HERE, MessageLoop::QuitClosure(), - base::TimeDelta::FromMilliseconds(milliseconds)); + delay); loop->Run(); } @@ -244,14 +244,14 @@ TEST_F(IPCChannelPosixTest, AdvancedConnected) { base::ProcessHandle handle = SpawnChild("IPCChannelPosixTestConnectionProc", false); ASSERT_TRUE(handle); - SpinRunLoop(TestTimeouts::action_max_timeout_ms()); + SpinRunLoop(TestTimeouts::action_max_timeout()); ASSERT_EQ(IPCChannelPosixTestListener::CONNECTED, listener.status()); ASSERT_TRUE(channel.HasAcceptedConnection()); IPC::Message* message = new IPC::Message(0, // routing_id kQuitMessage, // message type IPC::Message::PRIORITY_NORMAL); channel.Send(message); - SpinRunLoop(TestTimeouts::action_timeout_ms()); + SpinRunLoop(TestTimeouts::action_timeout()); int exit_code = 0; EXPECT_TRUE(base::WaitForExitCode(handle, &exit_code)); EXPECT_EQ(0, exit_code); @@ -274,7 +274,7 @@ TEST_F(IPCChannelPosixTest, ResetState) { base::ProcessHandle handle = SpawnChild("IPCChannelPosixTestConnectionProc", false); ASSERT_TRUE(handle); - SpinRunLoop(TestTimeouts::action_max_timeout_ms()); + SpinRunLoop(TestTimeouts::action_max_timeout()); ASSERT_EQ(IPCChannelPosixTestListener::CONNECTED, listener.status()); ASSERT_TRUE(channel.HasAcceptedConnection()); channel.ResetToAcceptingConnectionState(); @@ -283,14 +283,14 @@ TEST_F(IPCChannelPosixTest, ResetState) { base::ProcessHandle handle2 = SpawnChild("IPCChannelPosixTestConnectionProc", false); ASSERT_TRUE(handle2); - SpinRunLoop(TestTimeouts::action_max_timeout_ms()); + SpinRunLoop(TestTimeouts::action_max_timeout()); ASSERT_EQ(IPCChannelPosixTestListener::CONNECTED, listener.status()); ASSERT_TRUE(channel.HasAcceptedConnection()); IPC::Message* message = new IPC::Message(0, // routing_id kQuitMessage, // message type IPC::Message::PRIORITY_NORMAL); channel.Send(message); - SpinRunLoop(TestTimeouts::action_timeout_ms()); + SpinRunLoop(TestTimeouts::action_timeout()); EXPECT_TRUE(base::KillProcess(handle, 0, false)); int exit_code = 0; EXPECT_TRUE(base::WaitForExitCode(handle2, &exit_code)); @@ -333,13 +333,13 @@ TEST_F(IPCChannelPosixTest, MultiConnection) { base::ProcessHandle handle = SpawnChild("IPCChannelPosixTestConnectionProc", false); ASSERT_TRUE(handle); - SpinRunLoop(TestTimeouts::action_max_timeout_ms()); + SpinRunLoop(TestTimeouts::action_max_timeout()); ASSERT_EQ(IPCChannelPosixTestListener::CONNECTED, listener.status()); ASSERT_TRUE(channel.HasAcceptedConnection()); base::ProcessHandle handle2 = SpawnChild("IPCChannelPosixFailConnectionProc", false); ASSERT_TRUE(handle2); - SpinRunLoop(TestTimeouts::action_max_timeout_ms()); + SpinRunLoop(TestTimeouts::action_max_timeout()); int exit_code = 0; EXPECT_TRUE(base::WaitForExitCode(handle2, &exit_code)); EXPECT_EQ(exit_code, 0); @@ -349,7 +349,7 @@ TEST_F(IPCChannelPosixTest, MultiConnection) { kQuitMessage, // message type IPC::Message::PRIORITY_NORMAL); channel.Send(message); - SpinRunLoop(TestTimeouts::action_timeout_ms()); + SpinRunLoop(TestTimeouts::action_timeout()); EXPECT_TRUE(base::WaitForExitCode(handle, &exit_code)); EXPECT_EQ(exit_code, 0); ASSERT_EQ(IPCChannelPosixTestListener::CHANNEL_ERROR, listener.status()); @@ -398,7 +398,7 @@ MULTIPROCESS_TEST_MAIN(IPCChannelPosixTestConnectionProc) { IPCChannelPosixTest::SetUpSocket(&handle, IPC::Channel::MODE_NAMED_CLIENT); IPC::Channel channel(handle, IPC::Channel::MODE_NAMED_CLIENT, &listener); EXPECT_TRUE(channel.Connect()); - IPCChannelPosixTest::SpinRunLoop(TestTimeouts::action_max_timeout_ms()); + IPCChannelPosixTest::SpinRunLoop(TestTimeouts::action_max_timeout()); EXPECT_EQ(IPCChannelPosixTestListener::MESSAGE_RECEIVED, listener.status()); return 0; } @@ -418,7 +418,7 @@ MULTIPROCESS_TEST_MAIN(IPCChannelPosixFailConnectionProc) { // it. bool connected = channel.Connect(); if (connected) { - IPCChannelPosixTest::SpinRunLoop(TestTimeouts::action_max_timeout_ms()); + IPCChannelPosixTest::SpinRunLoop(TestTimeouts::action_max_timeout()); EXPECT_EQ(IPCChannelPosixTestListener::CHANNEL_ERROR, listener.status()); } else { EXPECT_EQ(IPCChannelPosixTestListener::DISCONNECTED, listener.status()); |