Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6111)

Unified Diff: chrome/test/ui/ui_test.cc

Issue 10787010: Switch to TimeDelta interfaces in chrome automation test infrastructure. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase onto master. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/ui/ui_test.h ('k') | chrome/test/webdriver/webdriver_automation.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/ui/ui_test.cc
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index be708eaee28a8ac3c595e8803483a912dc82f3ca..dabb5f0aab515ff46add62aae4884f5c735e2a41 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -120,7 +120,7 @@ void UITestBase::SetUp() {
"of the app before testing.");
JavaScriptExecutionController::set_timeout(
- TestTimeouts::action_max_timeout_ms());
+ TestTimeouts::action_max_timeout());
test_start_time_ = Time::NowFromSystemTime();
SetLaunchSwitches();
@@ -139,13 +139,22 @@ AutomationProxy* UITestBase::automation() const {
return launcher_->automation();
}
+base::TimeDelta UITestBase::action_timeout() {
+ return automation()->action_timeout();
+}
+
int UITestBase::action_timeout_ms() {
- return automation()->action_timeout_ms();
+ return action_timeout().InMilliseconds();
+}
+
+void UITestBase::set_action_timeout(base::TimeDelta timeout) {
+ automation()->set_action_timeout(timeout);
+ VLOG(1) << "Automation action timeout set to "
+ << timeout.InMilliseconds() << " ms";
}
void UITestBase::set_action_timeout_ms(int timeout) {
- automation()->set_action_timeout_ms(timeout);
- VLOG(1) << "Automation action timeout set to " << timeout << " ms";
+ set_action_timeout(base::TimeDelta::FromMilliseconds(timeout));
}
ProxyLauncher* UITestBase::CreateProxyLauncher() {
@@ -415,7 +424,7 @@ bool UITestBase::CloseBrowser(BrowserProxy* browser,
if (*application_closed) {
int exit_code = -1;
EXPECT_TRUE(launcher_->WaitForBrowserProcessToQuit(
- TestTimeouts::action_max_timeout_ms(), &exit_code));
+ TestTimeouts::action_max_timeout(), &exit_code));
EXPECT_EQ(0, exit_code); // Expect a clean shutown.
}
@@ -594,7 +603,7 @@ void UITest::WaitForFinish(const std::string &name,
const GURL &url,
const std::string& test_complete_cookie,
const std::string& expected_cookie_value,
- const int wait_time) {
+ const base::TimeDelta wait_time) {
// The webpage being tested has javascript which sets a cookie
// which signals completion of the test. The cookie name is
// a concatenation of the test name and the test id. This allows
@@ -628,9 +637,9 @@ bool UITest::EvictFileFromSystemCacheWrapper(const FilePath& path) {
bool UITest::WaitUntilJavaScriptCondition(TabProxy* tab,
const std::wstring& frame_xpath,
const std::wstring& jscript,
- int timeout_ms) {
+ base::TimeDelta timeout) {
const TimeDelta kDelay = TimeDelta::FromMilliseconds(250);
- const int kMaxDelays = timeout_ms / kDelay.InMilliseconds();
+ const int kMaxDelays = timeout / kDelay;
// Wait until the test signals it has completed.
for (int i = 0; i < kMaxDelays; ++i) {
@@ -653,10 +662,10 @@ bool UITest::WaitUntilJavaScriptCondition(TabProxy* tab,
bool UITest::WaitUntilCookieValue(TabProxy* tab,
const GURL& url,
const char* cookie_name,
- int timeout_ms,
+ base::TimeDelta timeout,
const char* expected_value) {
const TimeDelta kDelay = TimeDelta::FromMilliseconds(250);
- const int kMaxDelays = timeout_ms / kDelay.InMilliseconds();
+ const int kMaxDelays = timeout / kDelay;
std::string cookie_value;
for (int i = 0; i < kMaxDelays; ++i) {
@@ -674,9 +683,9 @@ bool UITest::WaitUntilCookieValue(TabProxy* tab,
std::string UITest::WaitUntilCookieNonEmpty(TabProxy* tab,
const GURL& url,
const char* cookie_name,
- int timeout_ms) {
+ base::TimeDelta timeout) {
const TimeDelta kDelay = TimeDelta::FromMilliseconds(250);
- const int kMaxDelays = timeout_ms / kDelay.InMilliseconds();
+ const int kMaxDelays = timeout / kDelay;
for (int i = 0; i < kMaxDelays; ++i) {
std::string cookie_value;
« no previous file with comments | « chrome/test/ui/ui_test.h ('k') | chrome/test/webdriver/webdriver_automation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698