Index: chrome/test/automation/automation_proxy.cc |
=================================================================== |
--- chrome/test/automation/automation_proxy.cc (revision 80714) |
+++ chrome/test/automation/automation_proxy.cc (working copy) |
@@ -90,7 +90,7 @@ |
} // anonymous namespace |
-AutomationProxy::AutomationProxy(int command_execution_timeout_ms, |
+AutomationProxy::AutomationProxy(int action_timeout_ms, |
bool disconnect_on_failure) |
: app_launched_(true, false), |
initial_loads_complete_(true, false), |
@@ -99,13 +99,13 @@ |
app_launch_signaled_(0), |
perform_version_check_(false), |
disconnect_on_failure_(disconnect_on_failure), |
- command_execution_timeout_( |
- TimeDelta::FromMilliseconds(command_execution_timeout_ms)), |
+ action_timeout_( |
+ TimeDelta::FromMilliseconds(action_timeout_ms)), |
listener_thread_id_(0) { |
// base::WaitableEvent::TimedWait() will choke if we give it a negative value. |
// Zero also seems unreasonable, since we need to wait for IPC, but at |
// least it is legal... ;-) |
- DCHECK_GE(command_execution_timeout_ms, 0); |
+ DCHECK_GE(action_timeout_ms, 0); |
listener_thread_id_ = base::PlatformThread::CurrentId(); |
InitializeHandleTracker(); |
InitializeThread(); |
@@ -169,7 +169,7 @@ |
AutomationLaunchResult AutomationProxy::WaitForAppLaunch() { |
AutomationLaunchResult result = AUTOMATION_SUCCESS; |
- if (app_launched_.TimedWait(command_execution_timeout_)) { |
+ if (app_launched_.TimedWait(action_timeout_)) { |
if (perform_version_check_) { |
// Obtain our own version number and compare it to what the automation |
// provider sent. |
@@ -209,11 +209,11 @@ |
} |
bool AutomationProxy::WaitForInitialLoads() { |
- return initial_loads_complete_.TimedWait(command_execution_timeout_); |
+ return initial_loads_complete_.TimedWait(action_timeout_); |
} |
bool AutomationProxy::WaitForInitialNewTabUILoad(int* load_time) { |
- if (new_tab_ui_load_complete_.TimedWait(command_execution_timeout_)) { |
+ if (new_tab_ui_load_complete_.TimedWait(action_timeout_)) { |
*load_time = new_tab_ui_load_time_; |
new_tab_ui_load_complete_.Reset(); |
return true; |
@@ -443,14 +443,18 @@ |
#endif // defined(OS_POSIX) |
bool AutomationProxy::Send(IPC::Message* message) { |
+ return Send(message, |
+ static_cast<int>(action_timeout_.InMilliseconds())); |
+} |
+ |
+bool AutomationProxy::Send(IPC::Message* message, int timeout_ms) { |
if (!channel_.get()) { |
LOG(ERROR) << "Automation channel has been closed; dropping message!"; |
delete message; |
return false; |
} |
- bool success = channel_->SendWithTimeout(message, |
- command_execution_timeout_ms()); |
+ bool success = channel_->SendWithTimeout(message, timeout_ms); |
if (!success && disconnect_on_failure_) { |
// Send failed (possibly due to a timeout). Browser is likely in a weird |
@@ -549,9 +553,10 @@ |
} |
bool AutomationProxy::SendJSONRequest(const std::string& request, |
+ int timeout_ms, |
std::string* response) { |
bool result = false; |
- if (!SendAutomationJSONRequest(this, request, response, &result)) |
+ if (!SendAutomationJSONRequest(this, request, timeout_ms, response, &result)) |
return false; |
return result; |
} |