OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <gtest/gtest.h> | |
8 | |
9 #include <sstream> | 7 #include <sstream> |
10 | 8 |
11 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
12 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
13 #include "base/logging.h" | 11 #include "base/logging.h" |
14 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
15 #include "base/process_util.h" | 13 #include "base/process_util.h" |
16 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
17 #include "base/threading/platform_thread.h" | 15 #include "base/threading/platform_thread.h" |
18 #include "chrome/common/automation_constants.h" | 16 #include "chrome/common/automation_constants.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 scoped_refptr<ExtensionProxy> AutomationProxy::InstallExtension( | 242 scoped_refptr<ExtensionProxy> AutomationProxy::InstallExtension( |
245 const FilePath& extension_path, bool with_ui) { | 243 const FilePath& extension_path, bool with_ui) { |
246 int handle = 0; | 244 int handle = 0; |
247 if (!Send(new AutomationMsg_InstallExtension(extension_path, | 245 if (!Send(new AutomationMsg_InstallExtension(extension_path, |
248 with_ui, &handle))) | 246 with_ui, &handle))) |
249 return NULL; | 247 return NULL; |
250 | 248 |
251 return ProxyObjectFromHandle<ExtensionProxy>(handle); | 249 return ProxyObjectFromHandle<ExtensionProxy>(handle); |
252 } | 250 } |
253 | 251 |
254 void AutomationProxy::EnsureExtensionTestResult() { | 252 bool AutomationProxy::GetExtensionTestResult( |
255 bool result; | 253 bool* result, std::string* message) { |
256 std::string message; | 254 return Send(new AutomationMsg_WaitForExtensionTestResult(result, message)); |
257 if (!Send(new AutomationMsg_WaitForExtensionTestResult(&result, | |
258 &message))) { | |
259 FAIL() << "Could not send WaitForExtensionTestResult message"; | |
260 return; | |
261 } | |
262 ASSERT_TRUE(result) << "Extension test message: " << message; | |
263 } | 255 } |
264 | 256 |
265 bool AutomationProxy::GetBrowserWindowCount(int* num_windows) { | 257 bool AutomationProxy::GetBrowserWindowCount(int* num_windows) { |
266 if (!num_windows) { | 258 if (!num_windows) { |
267 NOTREACHED(); | 259 NOTREACHED(); |
268 return false; | 260 return false; |
269 } | 261 } |
270 | 262 |
271 return Send(new AutomationMsg_BrowserWindowCount(num_windows)); | 263 return Send(new AutomationMsg_BrowserWindowCount(num_windows)); |
272 } | 264 } |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 } | 581 } |
590 | 582 |
591 bool AutomationProxy::SendJSONRequest(const std::string& request, | 583 bool AutomationProxy::SendJSONRequest(const std::string& request, |
592 int timeout_ms, | 584 int timeout_ms, |
593 std::string* response) { | 585 std::string* response) { |
594 bool result = false; | 586 bool result = false; |
595 if (!SendAutomationJSONRequest(this, request, timeout_ms, response, &result)) | 587 if (!SendAutomationJSONRequest(this, request, timeout_ms, response, &result)) |
596 return false; | 588 return false; |
597 return result; | 589 return result; |
598 } | 590 } |
OLD | NEW |