diff options
author | tedvessenes@gmail.com <tedvessenes@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-09 19:59:21 +0000 |
---|---|---|
committer | tedvessenes@gmail.com <tedvessenes@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-09 19:59:21 +0000 |
commit | 8270c6fe5fcd162c2ecfa95ee3af0b0fef5fa1f5 (patch) | |
tree | 794196eb3c539dec50e51bc06586d77326ba5c31 /chrome/browser | |
parent | 9a39267ab814cfb146c1f6a4186e577239e32740 (diff) | |
download | chromium_src-8270c6fe5fcd162c2ecfa95ee3af0b0fef5fa1f5.zip chromium_src-8270c6fe5fcd162c2ecfa95ee3af0b0fef5fa1f5.tar.gz chromium_src-8270c6fe5fcd162c2ecfa95ee3af0b0fef5fa1f5.tar.bz2 |
Switch to TimeDelta interfaces of TestTimeouts in chrome and ui code reviewable by ben.
R=ben@chromium.org
BUG=108171
Review URL: https://chromiumcodereview.appspot.com/10704115
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145729 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/process_singleton_browsertest.cc | 10 | ||||
-rw-r--r-- | chrome/browser/process_singleton_linux_unittest.cc | 22 | ||||
-rw-r--r-- | chrome/browser/service/service_process_control_browsertest.cc | 2 |
3 files changed, 17 insertions, 17 deletions
diff --git a/chrome/browser/process_singleton_browsertest.cc b/chrome/browser/process_singleton_browsertest.cc index b818e26..332b212 100644 --- a/chrome/browser/process_singleton_browsertest.cc +++ b/chrome/browser/process_singleton_browsertest.cc @@ -35,12 +35,12 @@ namespace { // base::Bind to run the StartChrome methods in many threads. class ChromeStarter : public base::RefCountedThreadSafe<ChromeStarter> { public: - ChromeStarter(int timeout_ms, const FilePath& user_data_dir) + ChromeStarter(base::TimeDelta timeout, const FilePath& user_data_dir) : ready_event_(false /* manual */, false /* signaled */), done_event_(false /* manual */, false /* signaled */), process_handle_(base::kNullProcessHandle), process_terminated_(false), - timeout_ms_(timeout_ms), + timeout_(timeout), user_data_dir_(user_data_dir) { } @@ -101,7 +101,7 @@ class ChromeStarter : public base::RefCountedThreadSafe<ChromeStarter> { // one process. The test below will take care of killing that process // to unstuck us once it confirms there is only one. process_terminated_ = base::WaitForSingleProcess(process_handle_, - timeout_ms_); + timeout_); // Let the test know we are done. done_event_.Signal(); } @@ -120,7 +120,7 @@ class ChromeStarter : public base::RefCountedThreadSafe<ChromeStarter> { base::CloseProcessHandle(process_handle_); } - int timeout_ms_; + base::TimeDelta timeout_; FilePath user_data_dir_; DISALLOW_COPY_AND_ASSIGN(ChromeStarter); @@ -144,7 +144,7 @@ class ProcessSingletonTest : public InProcessBrowserTest { chrome_starter_threads_[i].reset(new base::Thread("ChromeStarter")); ASSERT_TRUE(chrome_starter_threads_[i]->Start()); chrome_starters_[i] = new ChromeStarter( - TestTimeouts::action_max_timeout_ms(), temp_profile_dir_.path()); + TestTimeouts::action_max_timeout(), temp_profile_dir_.path()); } } diff --git a/chrome/browser/process_singleton_linux_unittest.cc b/chrome/browser/process_singleton_linux_unittest.cc index a654004..84ccc74 100644 --- a/chrome/browser/process_singleton_linux_unittest.cc +++ b/chrome/browser/process_singleton_linux_unittest.cc @@ -104,7 +104,7 @@ class ProcessSingletonLinuxTest : public testing::Test { ProcessSingleton::NotifyResult NotifyOtherProcess( bool override_kill, - int timeout_ms) { + base::TimeDelta timeout) { scoped_ptr<ProcessSingleton> process_singleton(CreateProcessSingleton()); CommandLine command_line(CommandLine::ForCurrentProcess()->GetProgram()); command_line.AppendArg("about:blank"); @@ -116,18 +116,18 @@ class ProcessSingletonLinuxTest : public testing::Test { } return process_singleton->NotifyOtherProcessWithTimeout( - command_line, timeout_ms / 1000, true); + command_line, timeout.InSeconds(), true); } // A helper method to call ProcessSingleton::NotifyOtherProcessOrCreate(). ProcessSingleton::NotifyResult NotifyOtherProcessOrCreate( const std::string& url, - int timeout_ms) { + base::TimeDelta timeout) { scoped_ptr<ProcessSingleton> process_singleton(CreateProcessSingleton()); CommandLine command_line(CommandLine::ForCurrentProcess()->GetProgram()); command_line.AppendArg(url); return process_singleton->NotifyOtherProcessWithTimeoutOrCreate( - command_line, base::Bind(&NotificationCallback), timeout_ms / 1000); + command_line, base::Bind(&NotificationCallback), timeout.InSeconds()); } void CheckNotified() { @@ -241,7 +241,7 @@ TEST_F(ProcessSingletonLinuxTest, CheckSocketFile) { TEST_F(ProcessSingletonLinuxTest, NotifyOtherProcessSuccess) { CreateProcessSingletonOnThread(); EXPECT_EQ(ProcessSingleton::PROCESS_NOTIFIED, - NotifyOtherProcess(true, TestTimeouts::action_timeout_ms())); + NotifyOtherProcess(true, TestTimeouts::action_timeout())); CheckNotified(); } @@ -251,7 +251,7 @@ TEST_F(ProcessSingletonLinuxTest, NotifyOtherProcessFailure) { BlockWorkerThread(); EXPECT_EQ(ProcessSingleton::PROCESS_NONE, - NotifyOtherProcess(true, TestTimeouts::action_timeout_ms())); + NotifyOtherProcess(true, TestTimeouts::action_timeout())); ASSERT_EQ(1, kill_callbacks_); UnblockWorkerThread(); @@ -274,7 +274,7 @@ TEST_F(ProcessSingletonLinuxTest, NotifyOtherProcessNoSuicide) { EXPECT_EQ(0, unlink(socket_path_.value().c_str())); EXPECT_EQ(ProcessSingleton::PROCESS_NONE, - NotifyOtherProcess(false, TestTimeouts::action_timeout_ms())); + NotifyOtherProcess(false, TestTimeouts::action_timeout())); // If we've gotten to this point without killing ourself, the test succeeded. } @@ -286,7 +286,7 @@ TEST_F(ProcessSingletonLinuxTest, NotifyOtherProcessHostChanged) { EXPECT_EQ(0, symlink("FAKEFOOHOST-1234", lock_path_.value().c_str())); EXPECT_EQ(ProcessSingleton::PROCESS_NOTIFIED, - NotifyOtherProcess(false, TestTimeouts::action_timeout_ms())); + NotifyOtherProcess(false, TestTimeouts::action_timeout())); CheckNotified(); } @@ -301,7 +301,7 @@ TEST_F(ProcessSingletonLinuxTest, NotifyOtherProcessDifferingHost) { EXPECT_EQ(0, symlink("FAKEFOOHOST-1234", lock_path_.value().c_str())); EXPECT_EQ(ProcessSingleton::PROFILE_IN_USE, - NotifyOtherProcess(false, TestTimeouts::action_timeout_ms())); + NotifyOtherProcess(false, TestTimeouts::action_timeout())); ASSERT_EQ(0, unlink(lock_path_.value().c_str())); @@ -320,7 +320,7 @@ TEST_F(ProcessSingletonLinuxTest, NotifyOtherProcessOrCreate_DifferingHost) { std::string url("about:blank"); EXPECT_EQ(ProcessSingleton::PROFILE_IN_USE, - NotifyOtherProcessOrCreate(url, TestTimeouts::action_timeout_ms())); + NotifyOtherProcessOrCreate(url, TestTimeouts::action_timeout())); ASSERT_EQ(0, unlink(lock_path_.value().c_str())); @@ -371,6 +371,6 @@ TEST_F(ProcessSingletonLinuxTest, NotifyOtherProcessOrCreate_BadCookie) { std::string url("about:blank"); EXPECT_EQ(ProcessSingleton::PROFILE_IN_USE, - NotifyOtherProcessOrCreate(url, TestTimeouts::action_timeout_ms())); + NotifyOtherProcessOrCreate(url, TestTimeouts::action_timeout())); } diff --git a/chrome/browser/service/service_process_control_browsertest.cc b/chrome/browser/service/service_process_control_browsertest.cc index 714c59a..2a9acd0 100644 --- a/chrome/browser/service/service_process_control_browsertest.cc +++ b/chrome/browser/service/service_process_control_browsertest.cc @@ -66,7 +66,7 @@ class ServiceProcessControlBrowserTest void WaitForShutdown() { EXPECT_TRUE(base::WaitForSingleProcess( service_process_handle_, - TestTimeouts::action_max_timeout_ms())); + TestTimeouts::action_max_timeout())); } void ProcessControlLaunched() { |