summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authortedvessenes@gmail.com <tedvessenes@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-11 15:41:43 +0000
committertedvessenes@gmail.com <tedvessenes@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-11 15:41:43 +0000
commit0f2e45ec2650ebd32037ca109f1876ed85ce1fd5 (patch)
tree0e289579bccf4d39273e60010eeed8699fa00bd8 /ipc
parentb80ffe2725c3d5ca17d21e3743c06689bca46935 (diff)
downloadchromium_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')
-rw-r--r--ipc/ipc_channel_posix_unittest.cc26
-rw-r--r--ipc/ipc_fuzzing_tests.cc9
-rw-r--r--ipc/ipc_send_fds_test.cc3
-rw-r--r--ipc/ipc_tests.cc12
-rw-r--r--ipc/sync_socket_unittest.cc3
5 files changed, 31 insertions, 22 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());
diff --git a/ipc/ipc_fuzzing_tests.cc b/ipc/ipc_fuzzing_tests.cc
index 34394bf..4c3e9c9 100644
--- a/ipc/ipc_fuzzing_tests.cc
+++ b/ipc/ipc_fuzzing_tests.cc
@@ -282,7 +282,8 @@ TEST_F(IPCFuzzingTest, SanityTest) {
chan.Send(msg);
EXPECT_TRUE(listener.ExpectMessage(value, MsgClassSI::ID));
- EXPECT_TRUE(base::WaitForSingleProcess(server_process, 5000));
+ EXPECT_TRUE(base::WaitForSingleProcess(
+ server_process, base::TimeDelta::FromSeconds(5)));
base::CloseProcessHandle(server_process);
}
@@ -312,7 +313,8 @@ TEST_F(IPCFuzzingTest, MsgBadPayloadShort) {
chan.Send(msg);
EXPECT_TRUE(listener.ExpectMessage(1, MsgClassSI::ID));
- EXPECT_TRUE(base::WaitForSingleProcess(server_process, 5000));
+ EXPECT_TRUE(base::WaitForSingleProcess(
+ server_process, base::TimeDelta::FromSeconds(5)));
base::CloseProcessHandle(server_process);
}
#endif
@@ -347,7 +349,8 @@ TEST_F(IPCFuzzingTest, MsgBadPayloadArgs) {
chan.Send(msg);
EXPECT_TRUE(listener.ExpectMessage(3, MsgClassIS::ID));
- EXPECT_TRUE(base::WaitForSingleProcess(server_process, 5000));
+ EXPECT_TRUE(base::WaitForSingleProcess(
+ server_process, base::TimeDelta::FromSeconds(5)));
base::CloseProcessHandle(server_process);
}
diff --git a/ipc/ipc_send_fds_test.cc b/ipc/ipc_send_fds_test.cc
index 05d9ae4..47c6dd1 100644
--- a/ipc/ipc_send_fds_test.cc
+++ b/ipc/ipc_send_fds_test.cc
@@ -106,7 +106,8 @@ void TestDescriptorServer(IPC::Channel &chan,
chan.Close();
// Cleanup child process.
- EXPECT_TRUE(base::WaitForSingleProcess(process_handle, 5000));
+ EXPECT_TRUE(base::WaitForSingleProcess(
+ process_handle, base::TimeDelta::FromSeconds(5)));
}
int TestDescriptorClient(ino_t expected_inode_num) {
diff --git a/ipc/ipc_tests.cc b/ipc/ipc_tests.cc
index 5b23fa6..cecbf45 100644
--- a/ipc/ipc_tests.cc
+++ b/ipc/ipc_tests.cc
@@ -238,7 +238,8 @@ TEST_F(IPCChannelTest, ChannelTest) {
chan.Close();
// Cleanup child process.
- EXPECT_TRUE(base::WaitForSingleProcess(process_handle, 5000));
+ EXPECT_TRUE(base::WaitForSingleProcess(
+ process_handle, base::TimeDelta::FromSeconds(5)));
base::CloseProcessHandle(process_handle);
}
@@ -278,7 +279,8 @@ TEST_F(IPCChannelTest, ChannelTestExistingPipe) {
chan.Close();
// Cleanup child process.
- EXPECT_TRUE(base::WaitForSingleProcess(process_handle, 5000));
+ EXPECT_TRUE(base::WaitForSingleProcess(
+ process_handle, base::TimeDelta::FromSeconds(5)));
base::CloseProcessHandle(process_handle);
}
#endif // defined (OS_WIN)
@@ -323,7 +325,8 @@ TEST_F(IPCChannelTest, ChannelProxyTest) {
MessageLoop::current()->Run();
// cleanup child process
- EXPECT_TRUE(base::WaitForSingleProcess(process_handle, 5000));
+ EXPECT_TRUE(base::WaitForSingleProcess(
+ process_handle, base::TimeDelta::FromSeconds(5)));
base::CloseProcessHandle(process_handle);
}
thread.Stop();
@@ -399,7 +402,8 @@ TEST_F(IPCChannelTest, MAYBE_SendMessageInChannelConnected) {
channel.Close();
// Cleanup child process.
- EXPECT_TRUE(base::WaitForSingleProcess(process_handle, 5000));
+ EXPECT_TRUE(base::WaitForSingleProcess(
+ process_handle, base::TimeDelta::FromSeconds(5)));
base::CloseProcessHandle(process_handle);
}
diff --git a/ipc/sync_socket_unittest.cc b/ipc/sync_socket_unittest.cc
index 40367cf..69a2dca 100644
--- a/ipc/sync_socket_unittest.cc
+++ b/ipc/sync_socket_unittest.cc
@@ -203,7 +203,8 @@ TEST_F(SyncSocketTest, SanityTest) {
// Shut down.
pair[0].Close();
pair[1].Close();
- EXPECT_TRUE(base::WaitForSingleProcess(server_process, 5000));
+ EXPECT_TRUE(base::WaitForSingleProcess(
+ server_process, base::TimeDelta::FromSeconds(5)));
base::CloseProcessHandle(server_process);
}