| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/test/automation/automation_proxy.h" | 5 #include "chrome/test/automation/automation_proxy.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/process_util.h" | 13 #include "base/process_util.h" |
| 14 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
| 15 #include "base/threading/platform_thread.h" | 15 #include "base/threading/platform_thread.h" |
| 16 #include "chrome/common/automation_constants.h" | 16 #include "chrome/common/automation_constants.h" |
| 17 #include "chrome/common/automation_messages.h" | 17 #include "chrome/common/automation_messages.h" |
| 18 #include "chrome/common/chrome_version_info.h" | 18 #include "chrome/common/chrome_version_info.h" |
| 19 #include "chrome/test/automation/automation_json_requests.h" | 19 #include "chrome/test/automation/automation_json_requests.h" |
| 20 #include "chrome/test/automation/browser_proxy.h" | 20 #include "chrome/test/automation/browser_proxy.h" |
| 21 #include "chrome/test/automation/extension_proxy.h" | |
| 22 #include "chrome/test/automation/tab_proxy.h" | 21 #include "chrome/test/automation/tab_proxy.h" |
| 23 #include "chrome/test/automation/window_proxy.h" | 22 #include "chrome/test/automation/window_proxy.h" |
| 24 #include "ipc/ipc_descriptors.h" | 23 #include "ipc/ipc_descriptors.h" |
| 25 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
| 26 // TODO(port): Enable when dialog_delegate is ported. | 25 // TODO(port): Enable when dialog_delegate is ported. |
| 27 #include "ui/views/window/dialog_delegate.h" | 26 #include "ui/views/window/dialog_delegate.h" |
| 28 #endif | 27 #endif |
| 29 | 28 |
| 30 using base::TimeDelta; | 29 using base::TimeDelta; |
| 31 using base::TimeTicks; | 30 using base::TimeTicks; |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 228 |
| 230 void AutomationProxy::SignalInitialLoads() { | 229 void AutomationProxy::SignalInitialLoads() { |
| 231 initial_loads_complete_.Signal(); | 230 initial_loads_complete_.Signal(); |
| 232 } | 231 } |
| 233 | 232 |
| 234 void AutomationProxy::SignalNewTabUITab(int load_time) { | 233 void AutomationProxy::SignalNewTabUITab(int load_time) { |
| 235 new_tab_ui_load_time_ = load_time; | 234 new_tab_ui_load_time_ = load_time; |
| 236 new_tab_ui_load_complete_.Signal(); | 235 new_tab_ui_load_complete_.Signal(); |
| 237 } | 236 } |
| 238 | 237 |
| 239 scoped_refptr<ExtensionProxy> AutomationProxy::InstallExtension( | |
| 240 const FilePath& extension_path, bool with_ui) { | |
| 241 int handle = 0; | |
| 242 if (!Send(new AutomationMsg_InstallExtension(extension_path, | |
| 243 with_ui, &handle))) | |
| 244 return NULL; | |
| 245 | |
| 246 return ProxyObjectFromHandle<ExtensionProxy>(handle); | |
| 247 } | |
| 248 | |
| 249 bool AutomationProxy::GetExtensionTestResult( | |
| 250 bool* result, std::string* message) { | |
| 251 return Send(new AutomationMsg_WaitForExtensionTestResult(result, message)); | |
| 252 } | |
| 253 | |
| 254 bool AutomationProxy::GetBrowserWindowCount(int* num_windows) { | 238 bool AutomationProxy::GetBrowserWindowCount(int* num_windows) { |
| 255 if (!num_windows) { | 239 if (!num_windows) { |
| 256 NOTREACHED(); | 240 NOTREACHED(); |
| 257 return false; | 241 return false; |
| 258 } | 242 } |
| 259 | 243 |
| 260 return Send(new AutomationMsg_BrowserWindowCount(num_windows)); | 244 return Send(new AutomationMsg_BrowserWindowCount(num_windows)); |
| 261 } | 245 } |
| 262 | 246 |
| 263 bool AutomationProxy::GetNormalBrowserWindowCount(int* num_windows) { | 247 bool AutomationProxy::GetNormalBrowserWindowCount(int* num_windows) { |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 } | 563 } |
| 580 | 564 |
| 581 bool AutomationProxy::SendJSONRequest(const std::string& request, | 565 bool AutomationProxy::SendJSONRequest(const std::string& request, |
| 582 int timeout_ms, | 566 int timeout_ms, |
| 583 std::string* response) { | 567 std::string* response) { |
| 584 bool result = false; | 568 bool result = false; |
| 585 if (!SendAutomationJSONRequest(this, request, timeout_ms, response, &result)) | 569 if (!SendAutomationJSONRequest(this, request, timeout_ms, response, &result)) |
| 586 return false; | 570 return false; |
| 587 return result; | 571 return result; |
| 588 } | 572 } |
| OLD | NEW |