[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
diff --git a/chrome/browser/process_singleton_win_uitest.cc b/chrome/browser/process_singleton_win_uitest.cc
index 7611a839..929e271b2 100644
--- a/chrome/browser/process_singleton_win_uitest.cc
+++ b/chrome/browser/process_singleton_win_uitest.cc
@@ -33,11 +33,12 @@
// NewRunnableMethod class to run the StartChrome methods in many threads.
class ChromeStarter : public base::RefCountedThreadSafe<ChromeStarter> {
public:
- ChromeStarter()
+ explicit ChromeStarter(int timeout_ms)
: ready_event_(false /* manual */, false /* signaled */),
done_event_(false /* manual */, false /* signaled */),
process_handle_(NULL),
- process_terminated_(false) {
+ process_terminated_(false),
+ timeout_ms_(timeout_ms) {
}
// We must reset some data members since we reuse the same ChromeStarter
@@ -75,9 +76,8 @@
// We can wait on the handle here, we should get stuck on one and only
// one process. The test below will take care of killing that process
// to unstuck us once it confirms there is only one.
- static const int64 kWaitForProcessDeath = 5000;
process_terminated_ = base::WaitForSingleProcess(process_handle_,
- kWaitForProcessDeath);
+ timeout_ms_);
// Let the test know we are done.
done_event_.Signal();
}
@@ -90,10 +90,14 @@
private:
friend class base::RefCountedThreadSafe<ChromeStarter>;
+
~ChromeStarter() {
if (process_handle_ != NULL)
base::CloseProcessHandle(process_handle_);
}
+
+ int timeout_ms_;
+
DISALLOW_COPY_AND_ASSIGN(ChromeStarter);
};
@@ -111,7 +115,7 @@
for (size_t i = 0; i < kNbThreads; ++i) {
chrome_starter_threads_[i].reset(new base::Thread("ChromeStarter"));
ASSERT_TRUE(chrome_starter_threads_[i]->Start());
- chrome_starters_[i] = new ChromeStarter;
+ chrome_starters_[i] = new ChromeStarter(action_max_timeout_ms());
}
}