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