summaryrefslogtreecommitdiffstats
path: root/chrome/browser/process_singleton_linux_uitest.cc
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-30 10:21:27 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-30 10:21:27 +0000
commit0e60b64fcae0a0f21982bc42e0e608c8d44b12c1 (patch)
tree5ec1f7dfc5a1955d370ef071abba840c4054271d /chrome/browser/process_singleton_linux_uitest.cc
parent80de4fa5861be1171ad502eba157570839601086 (diff)
downloadchromium_src-0e60b64fcae0a0f21982bc42e0e608c8d44b12c1.zip
chromium_src-0e60b64fcae0a0f21982bc42e0e608c8d44b12c1.tar.gz
chromium_src-0e60b64fcae0a0f21982bc42e0e608c8d44b12c1.tar.bz2
[GTTF] Miscellanous UI tests cleanups:
- use built-in timeouts instead of "inventing" them in each test case - avoid unneeded checks and operations - use automation calls more effectively - use FLAKY mark instead of DISABLED to maintain test coverage - split some tests to make the above possible TEST=UI test based BUG=39785 Review URL: http://codereview.chromium.org/1547003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43070 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/process_singleton_linux_uitest.cc')
-rw-r--r--chrome/browser/process_singleton_linux_uitest.cc25
1 files changed, 14 insertions, 11 deletions
diff --git a/chrome/browser/process_singleton_linux_uitest.cc b/chrome/browser/process_singleton_linux_uitest.cc
index 8bef102..d0ba750 100644
--- a/chrome/browser/process_singleton_linux_uitest.cc
+++ b/chrome/browser/process_singleton_linux_uitest.cc
@@ -32,7 +32,8 @@ typedef UITest ProcessSingletonLinuxTest;
// A helper method to call ProcessSingleton::NotifyOtherProcess().
// |url| will be added to CommandLine for current process, so that it can be
// sent to browser process by ProcessSingleton::NotifyOtherProcess().
-ProcessSingleton::NotifyResult NotifyOtherProcess(const std::string& url) {
+ProcessSingleton::NotifyResult NotifyOtherProcess(const std::string& url,
+ int timeout_ms) {
FilePath user_data_dir;
PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
@@ -49,10 +50,8 @@ ProcessSingleton::NotifyResult NotifyOtherProcess(const std::string& url) {
ProcessSingleton process_singleton(user_data_dir);
- // Use a short timeout to keep tests fast.
- const int kTimeoutSeconds = 3;
- return process_singleton.NotifyOtherProcessWithTimeout(new_cmd_line,
- kTimeoutSeconds);
+ return process_singleton.NotifyOtherProcessWithTimeout(
+ new_cmd_line, timeout_ms / 1000);
}
} // namespace
@@ -95,7 +94,8 @@ TEST_F(ProcessSingletonLinuxTest, NotifyOtherProcessSuccess) {
std::string url("about:blank");
int original_tab_count = GetTabCount();
- EXPECT_EQ(ProcessSingleton::PROCESS_NOTIFIED, NotifyOtherProcess(url));
+ EXPECT_EQ(ProcessSingleton::PROCESS_NOTIFIED,
+ NotifyOtherProcess(url, action_timeout_ms()));
EXPECT_EQ(original_tab_count + 1, GetTabCount());
EXPECT_EQ(url, GetActiveTabURL().spec());
}
@@ -115,10 +115,11 @@ TEST_F(ProcessSingletonLinuxTest, NotifyOtherProcessFailure) {
HANDLE_EINTR(waitpid(pid, 0, WUNTRACED));
std::string url("about:blank");
- EXPECT_EQ(ProcessSingleton::PROCESS_NONE, NotifyOtherProcess(url));
+ EXPECT_EQ(ProcessSingleton::PROCESS_NONE,
+ NotifyOtherProcess(url, action_timeout_ms()));
// Wait for a while to make sure the browser process is actually killed.
- EXPECT_FALSE(CrashAwareSleep(1000));
+ EXPECT_FALSE(CrashAwareSleep(sleep_timeout_ms()));
}
// Test that we can still notify a process on the same host even after the
@@ -131,7 +132,8 @@ TEST_F(ProcessSingletonLinuxTest, NotifyOtherProcessHostChanged) {
int original_tab_count = GetTabCount();
std::string url("about:blank");
- EXPECT_EQ(ProcessSingleton::PROCESS_NOTIFIED, NotifyOtherProcess(url));
+ EXPECT_EQ(ProcessSingleton::PROCESS_NOTIFIED,
+ NotifyOtherProcess(url, action_timeout_ms()));
EXPECT_EQ(original_tab_count + 1, GetTabCount());
EXPECT_EQ(url, GetActiveTabURL().spec());
}
@@ -146,12 +148,13 @@ TEST_F(ProcessSingletonLinuxTest, NotifyOtherProcessDifferingHost) {
// Kill the browser process, so that it does not respond on the socket.
kill(pid, SIGKILL);
// Wait for a while to make sure the browser process is actually killed.
- EXPECT_FALSE(CrashAwareSleep(1000));
+ EXPECT_FALSE(CrashAwareSleep(sleep_timeout_ms()));
FilePath lock_path = user_data_dir().Append(chrome::kSingletonLockFilename);
EXPECT_EQ(0, unlink(lock_path.value().c_str()));
EXPECT_EQ(0, symlink("FAKEFOOHOST-1234", lock_path.value().c_str()));
std::string url("about:blank");
- EXPECT_EQ(ProcessSingleton::PROFILE_IN_USE, NotifyOtherProcess(url));
+ EXPECT_EQ(ProcessSingleton::PROFILE_IN_USE,
+ NotifyOtherProcess(url, action_timeout_ms()));
}