summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/autofill/autofill_download_unittest.cc8
-rw-r--r--chrome/browser/cocoa/cocoa_test_helper.mm14
-rw-r--r--chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc18
-rw-r--r--chrome/browser/importer/firefox_importer_unittest_utils_mac.cc9
4 files changed, 25 insertions, 24 deletions
diff --git a/chrome/browser/autofill/autofill_download_unittest.cc b/chrome/browser/autofill/autofill_download_unittest.cc
index baecd97..572fc1c 100644
--- a/chrome/browser/autofill/autofill_download_unittest.cc
+++ b/chrome/browser/autofill/autofill_download_unittest.cc
@@ -8,6 +8,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/autofill/autofill_download.h"
#include "chrome/common/net/test_url_fetcher_factory.h"
+#include "chrome/test/test_timeouts.h"
#include "chrome/test/testing_profile.h"
#include "net/url_request/url_request_status.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -245,15 +246,12 @@ TEST(AutoFillDownloadTest, QueryAndUploadTest) {
fetcher = factory.GetFetcherByID(3);
EXPECT_EQ(NULL, fetcher);
- // Verify DOS attack back-offs.
- const int kBackOffTimeout = 10000;
-
// Request with id 3.
EXPECT_TRUE(helper.download_manager.StartQueryRequest(form_structures));
fetcher = factory.GetFetcherByID(3);
ASSERT_TRUE(fetcher);
fetcher->set_backoff_delay(
- base::TimeDelta::FromMilliseconds(kBackOffTimeout));
+ base::TimeDelta::FromMilliseconds(TestTimeouts::action_max_timeout_ms()));
fetcher->delegate()->OnURLFetchComplete(fetcher, GURL(), URLRequestStatus(),
500, ResponseCookies(),
std::string(responses[0]));
@@ -277,7 +275,7 @@ TEST(AutoFillDownloadTest, QueryAndUploadTest) {
fetcher = factory.GetFetcherByID(4);
ASSERT_TRUE(fetcher);
fetcher->set_backoff_delay(
- base::TimeDelta::FromMilliseconds(kBackOffTimeout));
+ base::TimeDelta::FromMilliseconds(TestTimeouts::action_max_timeout_ms()));
fetcher->delegate()->OnURLFetchComplete(fetcher, GURL(), URLRequestStatus(),
503, ResponseCookies(),
std::string(responses[2]));
diff --git a/chrome/browser/cocoa/cocoa_test_helper.mm b/chrome/browser/cocoa/cocoa_test_helper.mm
index ae3c7cc..25ee845 100644
--- a/chrome/browser/cocoa/cocoa_test_helper.mm
+++ b/chrome/browser/cocoa/cocoa_test_helper.mm
@@ -3,8 +3,10 @@
// found in the LICENSE file.
#import "chrome/browser/cocoa/cocoa_test_helper.h"
+
+#include "base/logging.h"
#import "chrome/browser/chrome_browser_application_mac.h"
-#import "base/logging.h"
+#include "chrome/test/test_timeouts.h"
@implementation CocoaTestHelperWindow
@@ -99,9 +101,9 @@ void CocoaTest::TearDown() {
while (windows_left.size() > 0) {
// Cover delayed actions by spinning the loop at least once after
- // this timeout. Made large to accomocate valgrind and the wall
- // clock delay of a [NSApplication endSheet:].
- const NSTimeInterval kCloseTimeout = 5.0;
+ // this timeout.
+ const NSTimeInterval kCloseTimeoutSeconds =
+ TestTimeouts::action_timeout_ms() / 1000.0;
// Cover chains of delayed actions by spinning the loop at least
// this many times.
@@ -118,7 +120,7 @@ void CocoaTest::TearDown() {
(spins < kCloseSpins || one_more_time)) {
// Check the timeout before pumping events, so that we'll spin
// the loop once after the timeout.
- one_more_time = ([start_date timeIntervalSinceNow] > -kCloseTimeout);
+ one_more_time = ([start_date timeIntervalSinceNow] > -kCloseTimeoutSeconds);
// Autorelease anything thrown up by the event loop.
{
@@ -140,7 +142,7 @@ void CocoaTest::TearDown() {
if (still_left.size() == windows_left.size()) {
// NOTE(shess): Failing this expectation means that the test
// opened windows which have not been fully released. Either
- // there is a leak, or perhaps one of |kCloseTimeout| or
+ // there is a leak, or perhaps one of |kCloseTimeoutSeconds| or
// |kCloseSpins| needs adjustment.
EXPECT_EQ(0U, windows_left.size());
for (std::set<NSWindow*>::iterator iter = windows_left.begin();
diff --git a/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc b/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc
index 2fa5212..a6c3583 100644
--- a/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc
+++ b/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc
@@ -10,6 +10,7 @@
#endif
#include "base/eintr_wrapper.h"
+#include "chrome/test/test_timeouts.h"
#include "net/base/net_util.h"
#include "testing/platform_test.h"
@@ -41,7 +42,6 @@ static const char* kTwoMessages =
static const int kMaxQueueSize = 20;
static const char* kLoopback = "127.0.0.1";
-static const int kDefaultTimeoutMs = 5000;
#if defined(OS_POSIX)
static const char* kSemaphoreName = "chromium.listen_socket";
#endif
@@ -73,7 +73,7 @@ void DevToolsRemoteListenSocketTester::SetUp() {
this, &DevToolsRemoteListenSocketTester::Listen));
// verify Listen succeeded
- ASSERT_TRUE(NextAction(kDefaultTimeoutMs));
+ ASSERT_TRUE(NextAction(TestTimeouts::action_timeout_ms()));
ASSERT_FALSE(server_ == NULL);
ASSERT_EQ(ACTION_LISTEN, last_action_.type());
@@ -90,7 +90,7 @@ void DevToolsRemoteListenSocketTester::SetUp() {
ASSERT_NE(ret, SOCKET_ERROR);
net::SetNonBlocking(test_socket_);
- ASSERT_TRUE(NextAction(kDefaultTimeoutMs));
+ ASSERT_TRUE(NextAction(TestTimeouts::action_timeout_ms()));
ASSERT_EQ(ACTION_ACCEPT, last_action_.type());
}
@@ -102,12 +102,12 @@ void DevToolsRemoteListenSocketTester::TearDown() {
int ret = HANDLE_EINTR(close(test_socket_));
ASSERT_EQ(ret, 0);
#endif
- ASSERT_TRUE(NextAction(kDefaultTimeoutMs));
+ ASSERT_TRUE(NextAction(TestTimeouts::action_timeout_ms()));
ASSERT_EQ(ACTION_CLOSE, last_action_.type());
loop_->PostTask(FROM_HERE, NewRunnableMethod(
this, &DevToolsRemoteListenSocketTester::Shutdown));
- ASSERT_TRUE(NextAction(kDefaultTimeoutMs));
+ ASSERT_TRUE(NextAction(TestTimeouts::action_timeout_ms()));
ASSERT_EQ(ACTION_SHUTDOWN, last_action_.type());
#if defined(OS_WIN)
@@ -263,7 +263,7 @@ void DevToolsRemoteListenSocketTester::TestClientSend() {
// sleep for 10ms to test message split between \r and \n
PlatformThread::Sleep(10);
ASSERT_TRUE(Send(test_socket_, kSimpleMessagePart2));
- ASSERT_TRUE(NextAction(kDefaultTimeoutMs));
+ ASSERT_TRUE(NextAction(TestTimeouts::action_timeout_ms()));
ASSERT_EQ(ACTION_READ_MESSAGE, last_action_.type());
const DevToolsRemoteMessage& message = last_action_.message();
ASSERT_STREQ("V8Debugger", message.GetHeaderWithEmptyDefault(
@@ -276,7 +276,7 @@ void DevToolsRemoteListenSocketTester::TestClientSend() {
}
ASSERT_TRUE(Send(test_socket_, kTwoMessages));
{
- ASSERT_TRUE(NextAction(kDefaultTimeoutMs));
+ ASSERT_TRUE(NextAction(TestTimeouts::action_timeout_ms()));
ASSERT_EQ(ACTION_READ_MESSAGE, last_action_.type());
const DevToolsRemoteMessage& message = last_action_.message();
ASSERT_STREQ("DevToolsService", message.tool().c_str());
@@ -289,7 +289,7 @@ void DevToolsRemoteListenSocketTester::TestClientSend() {
}
}
{
- ASSERT_TRUE(NextAction(kDefaultTimeoutMs));
+ ASSERT_TRUE(NextAction(TestTimeouts::action_timeout_ms()));
ASSERT_EQ(ACTION_READ_MESSAGE, last_action_.type());
const DevToolsRemoteMessage& message = last_action_.message();
ASSERT_STREQ("V8Debugger", message.GetHeaderWithEmptyDefault(
@@ -306,7 +306,7 @@ void DevToolsRemoteListenSocketTester::TestClientSend() {
void DevToolsRemoteListenSocketTester::TestServerSend() {
loop_->PostTask(FROM_HERE, NewRunnableMethod(
this, &DevToolsRemoteListenSocketTester::SendFromTester));
- ASSERT_TRUE(NextAction(kDefaultTimeoutMs));
+ ASSERT_TRUE(NextAction(TestTimeouts::action_timeout_ms()));
ASSERT_EQ(ACTION_SEND, last_action_.type());
// TODO(erikkay): Without this sleep, the recv seems to fail a small amount
// of the time. I could fix this by making the socket blocking, but then
diff --git a/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc b/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc
index f9958fb..cf93d9e 100644
--- a/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc
+++ b/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc
@@ -10,6 +10,7 @@
#include "base/file_path.h"
#include "base/message_loop.h"
#include "chrome/browser/importer/firefox_importer_utils.h"
+#include "chrome/test/test_timeouts.h"
#include "ipc/ipc_channel.h"
#include "ipc/ipc_descriptors.h"
#include "ipc/ipc_message.h"
@@ -170,8 +171,6 @@ class CancellableQuitMsgLoop : public base::RefCounted<CancellableQuitMsgLoop> {
// Spin until either a client response arrives or a timeout occurs.
bool FFUnitTestDecryptorProxy::WaitForClientResponse() {
- const int64 kLoopTimeoutMS = 10 * 1000; // 10 seconds.
-
// What we're trying to do here is to wait for an RPC message to go over the
// wire and the client to reply. If the client does not replyy by a given
// timeout we kill the message loop.
@@ -181,8 +180,10 @@ bool FFUnitTestDecryptorProxy::WaitForClientResponse() {
// a message comes in.
scoped_refptr<CancellableQuitMsgLoop> quit_task =
new CancellableQuitMsgLoop();
- MessageLoop::current()->PostDelayedTask(FROM_HERE, NewRunnableMethod(
- quit_task.get(), &CancellableQuitMsgLoop::QuitNow), kLoopTimeoutMS);
+ MessageLoop::current()->PostDelayedTask(
+ FROM_HERE,
+ NewRunnableMethod(quit_task.get(), &CancellableQuitMsgLoop::QuitNow),
+ TestTimeouts::action_max_timeout_ms());
message_loop_->Run();
bool ret = !quit_task->cancelled_;