From 4ff446fabe4688ee1845f9c8cd711a047dbf3fe3 Mon Sep 17 00:00:00 2001 From: "tejasshah@google.com" Date: Fri, 10 Jul 2009 18:29:39 +0000 Subject: Review URL: http://codereview.chromium.org/155360 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20391 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/test/in_process_browser_test.cc | 14 ++++++++++---- chrome/test/in_process_browser_test.h | 6 ++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/chrome/test/in_process_browser_test.cc b/chrome/test/in_process_browser_test.cc index 8aaf586..863c26e 100644 --- a/chrome/test/in_process_browser_test.cc +++ b/chrome/test/in_process_browser_test.cc @@ -33,8 +33,8 @@ extern int BrowserMain(const MainFunctionParams&); const wchar_t kUnitTestShowWindows[] = L"show-windows"; -// Delay for the time-out at which we stop the inner-message loop the first -// time. +// Default delay for the time-out at which we stop the +// inner-message loop the first time. const int kInitialTimeoutInMS = 30000; // Delay for sub-sequent time-outs once the initial time-out happened. @@ -62,7 +62,8 @@ InProcessBrowserTest::InProcessBrowserTest() show_window_(false), dom_automation_enabled_(false), single_process_(false), - original_single_process_(false) { + original_single_process_(false), + initial_timeout_(kInitialTimeoutInMS) { } void InProcessBrowserTest::SetUp() { @@ -223,7 +224,7 @@ void InProcessBrowserTest::RunTestOnMainThreadLoop() { // Start the timeout timer to prevent hangs. MessageLoopForUI::current()->PostDelayedTask(FROM_HERE, NewRunnableMethod(this, &InProcessBrowserTest::TimedOut), - kInitialTimeoutInMS); + initial_timeout_); RunTestOnMainThread(); CleanUpOnMainThread(); @@ -258,3 +259,8 @@ void InProcessBrowserTest::TimedOut() { MessageLoopForUI::current()->Quit(); } + +void InProcessBrowserTest::SetInitialTimeoutInMS(int timeout_value) { + DCHECK_GT(timeout_value, 0); + initial_timeout_ = timeout_value; +} diff --git a/chrome/test/in_process_browser_test.h b/chrome/test/in_process_browser_test.h index 64bf1ea..bec71d9 100644 --- a/chrome/test/in_process_browser_test.h +++ b/chrome/test/in_process_browser_test.h @@ -74,6 +74,9 @@ class InProcessBrowserTest : public testing::Test { // Invoked when a test is not finishing in a timely manner. void TimedOut(); + // Sets Initial Timeout value. + void SetInitialTimeoutInMS(int initial_timeout); + // Starts an HTTP server. HTTPTestServer* StartHTTPServer(); @@ -118,6 +121,9 @@ class InProcessBrowserTest : public testing::Test { // Saved to restore the value of RenderProcessHost::run_renderer_in_process. bool original_single_process_; + // Initial timeout value in ms. + int initial_timeout_; + DISALLOW_COPY_AND_ASSIGN(InProcessBrowserTest); }; -- cgit v1.1