| Index: chrome/test/automation/automation_proxy.cc
|
| ===================================================================
|
| --- chrome/test/automation/automation_proxy.cc (revision 80714)
|
| +++ chrome/test/automation/automation_proxy.cc (working copy)
|
| @@ -14,6 +14,7 @@
|
| #include "base/threading/platform_thread.h"
|
| #include "base/process_util.h"
|
| #include "base/synchronization/waitable_event.h"
|
| +#include "base/test/test_timeouts.h"
|
| #include "chrome/common/automation_constants.h"
|
| #include "chrome/common/automation_messages.h"
|
| #include "chrome/common/chrome_version_info.h"
|
| @@ -90,7 +91,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 +100,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 +170,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 +210,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 +444,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 +554,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;
|
| }
|
|
|