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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "chrome/test/mini_installer_test/mini_installer_test_util.h" | 7 #include "chrome/test/mini_installer_test/mini_installer_test_util.h" |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 bool MiniInstallerTestUtil::GetCommandForTagging( | 72 bool MiniInstallerTestUtil::GetCommandForTagging( |
73 std::wstring *return_command) { | 73 std::wstring *return_command) { |
74 std::wstring tagged_installer_path = MiniInstallerTestUtil::GetFilePath( | 74 std::wstring tagged_installer_path = MiniInstallerTestUtil::GetFilePath( |
75 mini_installer_constants::kStandaloneInstaller); | 75 mini_installer_constants::kStandaloneInstaller); |
76 FilePath standalone_installer_path; | 76 FilePath standalone_installer_path; |
77 if (!MiniInstallerTestUtil::GetStandaloneInstallerPath( | 77 if (!MiniInstallerTestUtil::GetStandaloneInstallerPath( |
78 &standalone_installer_path)) { | 78 &standalone_installer_path)) { |
79 return false; | 79 return false; |
80 } | 80 } |
81 | 81 |
82 VLOG(1) << "Tagging command: " << standalone_installer_path.value().c_str(); | |
83 *return_command = base::StringPrintf(L"%ls %ls %ls %ls", | 82 *return_command = base::StringPrintf(L"%ls %ls %ls %ls", |
84 mini_installer_constants::kChromeApplyTagExe, | 83 mini_installer_constants::kChromeApplyTagExe, |
85 standalone_installer_path.value().c_str(), | 84 standalone_installer_path.value().c_str(), |
86 tagged_installer_path.c_str(), | 85 tagged_installer_path.c_str(), |
87 mini_installer_constants::kChromeApplyTagParameters); | 86 mini_installer_constants::kChromeApplyTagParameters); |
88 VLOG(1) << "Command to run Apply tag: " << return_command; | 87 VLOG(1) << "Command to run Apply tag: " << *return_command; |
89 return true; | 88 return true; |
90 } | 89 } |
91 | 90 |
92 std::wstring MiniInstallerTestUtil::GetFilePath(const wchar_t* exe_name) { | 91 std::wstring MiniInstallerTestUtil::GetFilePath(const wchar_t* exe_name) { |
93 FilePath installer_path; | 92 FilePath installer_path; |
94 PathService::Get(base::DIR_EXE, &installer_path); | 93 PathService::Get(base::DIR_EXE, &installer_path); |
95 installer_path = installer_path.Append(exe_name); | 94 installer_path = installer_path.Append(exe_name); |
96 VLOG(1) << "Chrome exe path: " << installer_path.value().c_str(); | |
97 return installer_path.value(); | 95 return installer_path.value(); |
98 } | 96 } |
99 | 97 |
100 // This method will first call GetLatestFile to get the list of all | 98 // This method will first call GetLatestFile to get the list of all |
101 // builds, sorted on creation time. Then goes through each build folder | 99 // builds, sorted on creation time. Then goes through each build folder |
102 // until it finds the installer file that matches the pattern argument. | 100 // until it finds the installer file that matches the pattern argument. |
103 bool MiniInstallerTestUtil::GetInstaller(const wchar_t* pattern, | 101 bool MiniInstallerTestUtil::GetInstaller(const wchar_t* pattern, |
104 std::wstring *path, const wchar_t* channel_type, bool chrome_frame) { | 102 std::wstring *path, const wchar_t* channel_type, bool chrome_frame) { |
105 FileInfoList builds_list; | 103 FileInfoList builds_list; |
106 FileInfoList exe_list; | 104 FileInfoList exe_list; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 } | 250 } |
253 | 251 |
254 bool MiniInstallerTestUtil::GetStandaloneVersion( | 252 bool MiniInstallerTestUtil::GetStandaloneVersion( |
255 std::wstring* version) { | 253 std::wstring* version) { |
256 const CommandLine* cmd = CommandLine::ForCurrentProcess(); | 254 const CommandLine* cmd = CommandLine::ForCurrentProcess(); |
257 std::wstring build = | 255 std::wstring build = |
258 cmd->GetSwitchValueNative(switches::kInstallerTestBuild); | 256 cmd->GetSwitchValueNative(switches::kInstallerTestBuild); |
259 if (build.empty()) | 257 if (build.empty()) |
260 return false; | 258 return false; |
261 *version = build; | 259 *version = build; |
262 VLOG(1) << "Standalone installer version: " << version; | 260 VLOG(1) << "Standalone installer version: " << *version; |
263 return true; | 261 return true; |
264 } | 262 } |
265 | 263 |
266 void MiniInstallerTestUtil::SendEnterKeyToWindow() { | 264 void MiniInstallerTestUtil::SendEnterKeyToWindow() { |
267 INPUT key; | 265 INPUT key; |
268 key.type = INPUT_KEYBOARD; | 266 key.type = INPUT_KEYBOARD; |
269 key.ki.wVk = VK_RETURN; | 267 key.ki.wVk = VK_RETURN; |
270 key.ki.dwFlags = 0; | 268 key.ki.dwFlags = 0; |
271 key.ki.time = 0; | 269 key.ki.time = 0; |
272 key.ki.wScan = 0; | 270 key.ki.wScan = 0; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 } | 309 } |
312 return true; | 310 return true; |
313 } | 311 } |
314 | 312 |
315 bool MiniInstallerTestUtil::VerifyProcessHandleClosed( | 313 bool MiniInstallerTestUtil::VerifyProcessHandleClosed( |
316 base::ProcessHandle handle) { | 314 base::ProcessHandle handle) { |
317 DWORD result = WaitForSingleObject(handle, | 315 DWORD result = WaitForSingleObject(handle, |
318 TestTimeouts::large_test_timeout_ms()); | 316 TestTimeouts::large_test_timeout_ms()); |
319 return result == WAIT_OBJECT_0; | 317 return result == WAIT_OBJECT_0; |
320 } | 318 } |
OLD | NEW |