| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 |
| 7 #include <sstream> | 9 #include <sstream> |
| 8 | 10 |
| 9 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 10 #include "base/file_version_info.h" | 12 #include "base/file_version_info.h" |
| 11 #include "base/logging.h" | 13 #include "base/logging.h" |
| 12 #include "base/platform_thread.h" | 14 #include "base/platform_thread.h" |
| 13 #include "base/process_util.h" | 15 #include "base/process_util.h" |
| 14 #include "base/ref_counted.h" | 16 #include "base/ref_counted.h" |
| 15 #include "base/waitable_event.h" | 17 #include "base/waitable_event.h" |
| 16 #include "chrome/app/chrome_version_info.h" | 18 #include "chrome/common/chrome_version_info.h" |
| 17 #include "chrome/test/automation/automation_constants.h" | 19 #include "chrome/test/automation/automation_constants.h" |
| 18 #include "chrome/test/automation/automation_messages.h" | 20 #include "chrome/test/automation/automation_messages.h" |
| 19 #include "chrome/test/automation/browser_proxy.h" | 21 #include "chrome/test/automation/browser_proxy.h" |
| 20 #include "chrome/test/automation/extension_proxy.h" | 22 #include "chrome/test/automation/extension_proxy.h" |
| 21 #include "chrome/test/automation/tab_proxy.h" | 23 #include "chrome/test/automation/tab_proxy.h" |
| 22 #include "chrome/test/automation/window_proxy.h" | 24 #include "chrome/test/automation/window_proxy.h" |
| 23 #include <gtest/gtest.h> | |
| 24 #include "ipc/ipc_descriptors.h" | 25 #include "ipc/ipc_descriptors.h" |
| 25 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
| 26 // TODO(port): Enable when dialog_delegate is ported. | 27 // TODO(port): Enable when dialog_delegate is ported. |
| 27 #include "views/window/dialog_delegate.h" | 28 #include "views/window/dialog_delegate.h" |
| 28 #endif | 29 #endif |
| 29 | 30 |
| 30 using base::TimeDelta; | 31 using base::TimeDelta; |
| 31 using base::TimeTicks; | 32 using base::TimeTicks; |
| 32 | 33 |
| 33 namespace { | 34 namespace { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 tracker_.reset(new AutomationHandleTracker()); | 168 tracker_.reset(new AutomationHandleTracker()); |
| 168 } | 169 } |
| 169 | 170 |
| 170 AutomationLaunchResult AutomationProxy::WaitForAppLaunch() { | 171 AutomationLaunchResult AutomationProxy::WaitForAppLaunch() { |
| 171 AutomationLaunchResult result = AUTOMATION_SUCCESS; | 172 AutomationLaunchResult result = AUTOMATION_SUCCESS; |
| 172 if (app_launched_.TimedWait(command_execution_timeout_)) { | 173 if (app_launched_.TimedWait(command_execution_timeout_)) { |
| 173 if (perform_version_check_) { | 174 if (perform_version_check_) { |
| 174 // Obtain our own version number and compare it to what the automation | 175 // Obtain our own version number and compare it to what the automation |
| 175 // provider sent. | 176 // provider sent. |
| 176 scoped_ptr<FileVersionInfo> file_version_info( | 177 scoped_ptr<FileVersionInfo> file_version_info( |
| 177 chrome_app::GetChromeVersionInfo()); | 178 chrome::GetChromeVersionInfo()); |
| 178 DCHECK(file_version_info != NULL); | 179 DCHECK(file_version_info != NULL); |
| 179 std::string version_string( | 180 std::string version_string( |
| 180 WideToASCII(file_version_info->file_version())); | 181 WideToASCII(file_version_info->file_version())); |
| 181 | 182 |
| 182 // Note that we use a simple string comparison since we expect the version | 183 // Note that we use a simple string comparison since we expect the version |
| 183 // to be a punctuated numeric string. Consider using base/Version if we | 184 // to be a punctuated numeric string. Consider using base/Version if we |
| 184 // ever need something more complicated here. | 185 // ever need something more complicated here. |
| 185 if (server_version_ != version_string) { | 186 if (server_version_ != version_string) { |
| 186 result = AUTOMATION_VERSION_MISMATCH; | 187 result = AUTOMATION_VERSION_MISMATCH; |
| 187 } | 188 } |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 password, | 529 password, |
| 529 &success)); | 530 &success)); |
| 530 // If message sending unsuccessful or test failed, return false. | 531 // If message sending unsuccessful or test failed, return false. |
| 531 return sent && success; | 532 return sent && success; |
| 532 } | 533 } |
| 533 #endif | 534 #endif |
| 534 | 535 |
| 535 bool AutomationProxy::ResetToDefaultTheme() { | 536 bool AutomationProxy::ResetToDefaultTheme() { |
| 536 return Send(new AutomationMsg_ResetToDefaultTheme(0)); | 537 return Send(new AutomationMsg_ResetToDefaultTheme(0)); |
| 537 } | 538 } |
| OLD | NEW |