summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authortedvessenes@gmail.com <tedvessenes@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-04 16:44:53 +0000
committertedvessenes@gmail.com <tedvessenes@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-04 16:44:53 +0000
commit5761ab9c0748737773196f3ed02616ae6c6a1b59 (patch)
tree33a2d59a92143e36fb9790822a76e6468b885f19 /net
parentd8f868a635906d720e5a717e5a81f36df211b719 (diff)
downloadchromium_src-5761ab9c0748737773196f3ed02616ae6c6a1b59.zip
chromium_src-5761ab9c0748737773196f3ed02616ae6c6a1b59.tar.gz
chromium_src-5761ab9c0748737773196f3ed02616ae6c6a1b59.tar.bz2
Fix calls in base and net unit tests to use TimeDelta.
I found another batch of unit tests that needed their Sleep() and PostDelayedTask() interfaces updated. As far as I know, this is the last batch of changes required before the deprecated integer interfaces to these functions can be removed. R=jar@chromium.org BUG=108171 TEST= Review URL: http://codereview.chromium.org/9316036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120480 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/dns/dns_config_service_unittest.cc6
-rw-r--r--net/socket/client_socket_pool_base_unittest.cc12
-rw-r--r--net/socket/transport_client_socket_pool_unittest.cc9
3 files changed, 15 insertions, 12 deletions
diff --git a/net/dns/dns_config_service_unittest.cc b/net/dns/dns_config_service_unittest.cc
index 9692f33..ee76a9a 100644
--- a/net/dns/dns_config_service_unittest.cc
+++ b/net/dns/dns_config_service_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -88,7 +88,7 @@ TEST_F(DnsConfigServiceTest, GetSystemConfig) {
scoped_ptr<DnsConfigService> service(DnsConfigService::CreateSystemService());
// Quit the loop after timeout unless cancelled
- const int64 kTimeout = TestTimeouts::action_timeout_ms();
+ const base::TimeDelta kTimeout = TestTimeouts::action_timeout();
base::WeakPtrFactory<DnsConfigServiceTest> factory_(this);
MessageLoop::current()->PostDelayedTask(
FROM_HERE,
@@ -100,7 +100,7 @@ TEST_F(DnsConfigServiceTest, GetSystemConfig) {
quit_on_config_ = true;
MessageLoop::current()->Run();
ASSERT_TRUE(last_config_.IsValid()) << "Did not receive DnsConfig in " <<
- kTimeout << "ms";
+ kTimeout.InMilliseconds() << "ms";
}
#endif // OS_POSIX || OS_WIN
diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc
index 5cde58b..3ef34c4 100644
--- a/net/socket/client_socket_pool_base_unittest.cc
+++ b/net/socket/client_socket_pool_base_unittest.cc
@@ -247,7 +247,7 @@ class TestConnectJob : public ConnectJob {
true /* successful */,
true /* async */,
false /* recoverable */),
- kPendingConnectDelay);
+ base::TimeDelta::FromMilliseconds(kPendingConnectDelay));
return ERR_IO_PENDING;
case kMockPendingFailingJob:
set_load_state(LOAD_STATE_CONNECTING);
@@ -258,7 +258,7 @@ class TestConnectJob : public ConnectJob {
false /* error */,
true /* async */,
false /* recoverable */),
- 2);
+ base::TimeDelta::FromMilliseconds(2));
return ERR_IO_PENDING;
case kMockWaitingJob:
client_socket_factory_->WaitForSignal(this);
@@ -281,7 +281,7 @@ class TestConnectJob : public ConnectJob {
false /* error */,
true /* async */,
true /* recoverable */),
- 2);
+ base::TimeDelta::FromMilliseconds(2));
return ERR_IO_PENDING;
case kMockAdditionalErrorStateJob:
store_additional_error_state_ = true;
@@ -297,7 +297,7 @@ class TestConnectJob : public ConnectJob {
false /* error */,
true /* async */,
false /* recoverable */),
- 2);
+ base::TimeDelta::FromMilliseconds(2));
return ERR_IO_PENDING;
default:
NOTREACHED();
@@ -3323,8 +3323,8 @@ TEST_F(ClientSocketPoolBaseTest, PreconnectWithoutBackupJob) {
// the backup job a pending job instead of a waiting job, so it
// *would* complete if it were created.
connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob);
- MessageLoop::current()->PostDelayedTask(FROM_HERE,
- MessageLoop::QuitClosure(), 1000);
+ MessageLoop::current()->PostDelayedTask(
+ FROM_HERE, MessageLoop::QuitClosure(), base::TimeDelta::FromSeconds(1));
MessageLoop::current()->Run();
EXPECT_FALSE(pool_->HasGroup("a"));
}
diff --git a/net/socket/transport_client_socket_pool_unittest.cc b/net/socket/transport_client_socket_pool_unittest.cc
index 858bae7..3012518 100644
--- a/net/socket/transport_client_socket_pool_unittest.cc
+++ b/net/socket/transport_client_socket_pool_unittest.cc
@@ -995,7 +995,8 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketCancel) {
if (index == CANCEL_AFTER_WAIT) {
// Wait for the backup socket timer to fire.
- base::PlatformThread::Sleep(ClientSocketPool::kMaxConnectRetryIntervalMs);
+ base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(
+ ClientSocketPool::kMaxConnectRetryIntervalMs));
}
// Let the appropriate socket connect.
@@ -1039,7 +1040,8 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketFailAfterStall) {
MessageLoop::current()->RunAllPending();
// Wait for the backup socket timer to fire.
- base::PlatformThread::Sleep(ClientSocketPool::kMaxConnectRetryIntervalMs);
+ base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(
+ ClientSocketPool::kMaxConnectRetryIntervalMs));
// Let the second connect be synchronous. Otherwise, the emulated
// host resolution takes an extra trip through the message loop.
@@ -1086,7 +1088,8 @@ TEST_F(TransportClientSocketPoolTest, BackupSocketFailAfterDelay) {
MessageLoop::current()->RunAllPending();
// Wait for the backup socket timer to fire.
- base::PlatformThread::Sleep(ClientSocketPool::kMaxConnectRetryIntervalMs);
+ base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(
+ ClientSocketPool::kMaxConnectRetryIntervalMs));
// Let the second connect be synchronous. Otherwise, the emulated
// host resolution takes an extra trip through the message loop.