Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Side by Side Diff: chrome/test/mini_installer_test/mini_installer_test_util.cc

Issue 3915004: Convert LOG(INFO) to VLOG(1) - chrome/test/. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/memory_test/memory_test.cc ('k') | chrome/test/page_cycler/page_cycler_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 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/mini_installer_test/mini_installer_test_util.h" 5 #include "chrome/test/mini_installer_test/mini_installer_test_util.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/platform_thread.h" 9 #include "base/platform_thread.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 standalone_installer_path.assign( 74 standalone_installer_path.assign(
75 mini_installer_constants::kChromeStandAloneInstallerLocation); 75 mini_installer_constants::kChromeStandAloneInstallerLocation);
76 standalone_installer_path.append(file_details.at(0).name_); 76 standalone_installer_path.append(file_details.at(0).name_);
77 return_command->append(mini_installer_constants::kChromeApplyTagExe); 77 return_command->append(mini_installer_constants::kChromeApplyTagExe);
78 return_command->append(L" "); 78 return_command->append(L" ");
79 return_command->append(standalone_installer_path); 79 return_command->append(standalone_installer_path);
80 return_command->append(L" "); 80 return_command->append(L" ");
81 return_command->append(mini_installer_constants::kStandaloneInstaller); 81 return_command->append(mini_installer_constants::kStandaloneInstaller);
82 return_command->append(L" "); 82 return_command->append(L" ");
83 return_command->append(mini_installer_constants::kChromeApplyTagParameters); 83 return_command->append(mini_installer_constants::kChromeApplyTagParameters);
84 LOG(INFO) << "Command to run Apply tag: " << return_command->c_str(); 84 VLOG(1) << "Command to run Apply tag: " << return_command->c_str();
85 return true; 85 return true;
86 } 86 }
87 87
88 std::wstring MiniInstallerTestUtil::GetFilePath(const wchar_t* exe_name) { 88 std::wstring MiniInstallerTestUtil::GetFilePath(const wchar_t* exe_name) {
89 FilePath installer_path; 89 FilePath installer_path;
90 PathService::Get(base::DIR_EXE, &installer_path); 90 PathService::Get(base::DIR_EXE, &installer_path);
91 installer_path = installer_path.Append(exe_name); 91 installer_path = installer_path.Append(exe_name);
92 LOG(INFO) << "Chrome exe path: " << installer_path.value().c_str(); 92 VLOG(1) << "Chrome exe path: " << installer_path.value().c_str();
93 return installer_path.ToWStringHack(); 93 return installer_path.ToWStringHack();
94 } 94 }
95 95
96 // This method will first call GetLatestFile to get the list of all 96 // This method will first call GetLatestFile to get the list of all
97 // builds, sorted on creation time. Then goes through each build folder 97 // builds, sorted on creation time. Then goes through each build folder
98 // until it finds the installer file that matches the pattern argument. 98 // until it finds the installer file that matches the pattern argument.
99 bool MiniInstallerTestUtil::GetInstaller(const wchar_t* pattern, 99 bool MiniInstallerTestUtil::GetInstaller(const wchar_t* pattern,
100 std::wstring *path, const wchar_t* channel_type, bool chrome_frame) { 100 std::wstring *path, const wchar_t* channel_type, bool chrome_frame) {
101 FileInfoList builds_list; 101 FileInfoList builds_list;
102 FileInfoList exe_list; 102 FileInfoList exe_list;
(...skipping 26 matching lines...) Expand all
129 return file_util::PathExists(FilePath::FromWStringHack(*path)); 129 return file_util::PathExists(FilePath::FromWStringHack(*path));
130 } 130 }
131 131
132 // This method will get the latest installer filename from the directory. 132 // This method will get the latest installer filename from the directory.
133 bool MiniInstallerTestUtil::GetLatestFile(const wchar_t* file_name, 133 bool MiniInstallerTestUtil::GetLatestFile(const wchar_t* file_name,
134 const wchar_t* pattern, FileInfoList *file_details) { 134 const wchar_t* pattern, FileInfoList *file_details) {
135 135
136 WIN32_FIND_DATA find_file_data; 136 WIN32_FIND_DATA find_file_data;
137 HANDLE file_handle = FindFirstFile(file_name, &find_file_data); 137 HANDLE file_handle = FindFirstFile(file_name, &find_file_data);
138 if (file_handle == INVALID_HANDLE_VALUE) { 138 if (file_handle == INVALID_HANDLE_VALUE) {
139 LOG(INFO) << "Handle is invalid."; 139 VLOG(1) << "Handle is invalid.";
140 return false; 140 return false;
141 } 141 }
142 BOOL ret = TRUE; 142 BOOL ret = TRUE;
143 bool return_val = false; 143 bool return_val = false;
144 while (ret) { 144 while (ret) {
145 std::wstring search_path = find_file_data.cFileName; 145 std::wstring search_path = find_file_data.cFileName;
146 size_t position_found = search_path.find(pattern); 146 size_t position_found = search_path.find(pattern);
147 if (position_found != -1) { 147 if (position_found != -1) {
148 std::wstring extension = file_util::GetFileExtensionFromPath(file_name); 148 std::wstring extension = file_util::GetFileExtensionFromPath(file_name);
149 if ((base::strcasecmp(WideToUTF8(extension).c_str(), "exe")) == 0) { 149 if ((base::strcasecmp(WideToUTF8(extension).c_str(), "exe")) == 0) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 // Following code will extract build, patch details from the file 241 // Following code will extract build, patch details from the file
242 // and concatenate with 1.0 to form the build version. 242 // and concatenate with 1.0 to form the build version.
243 // Patteren followed: 1.0.<build>.<patch>htt 243 // Patteren followed: 1.0.<build>.<patch>htt
244 file_name = file_name.substr(22, 25); 244 file_name = file_name.substr(22, 25);
245 std::wstring::size_type last_dot = file_name.find(L'.'); 245 std::wstring::size_type last_dot = file_name.find(L'.');
246 file_name = file_name.substr(0, last_dot); 246 file_name = file_name.substr(0, last_dot);
247 std::wstring::size_type pos = file_name.find(L'_'); 247 std::wstring::size_type pos = file_name.find(L'_');
248 file_name.replace(pos, 1, L"."); 248 file_name.replace(pos, 1, L".");
249 file_name = L"3.0." + file_name; 249 file_name = L"3.0." + file_name;
250 return_file_name->assign(file_name.c_str()); 250 return_file_name->assign(file_name.c_str());
251 LOG(INFO) << "Standalone installer version: " << file_name.c_str(); 251 VLOG(1) << "Standalone installer version: " << file_name.c_str();
252 return true; 252 return true;
253 } 253 }
254 254
255 void MiniInstallerTestUtil::SendEnterKeyToWindow() { 255 void MiniInstallerTestUtil::SendEnterKeyToWindow() {
256 INPUT key; 256 INPUT key;
257 key.type = INPUT_KEYBOARD; 257 key.type = INPUT_KEYBOARD;
258 key.ki.wVk = VK_RETURN; 258 key.ki.wVk = VK_RETURN;
259 key.ki.dwFlags = 0; 259 key.ki.dwFlags = 0;
260 key.ki.time = 0; 260 key.ki.time = 0;
261 key.ki.wScan = 0; 261 key.ki.wScan = 0;
(...skipping 19 matching lines...) Expand all
281 if (expected_status) 281 if (expected_status)
282 ASSERT_NE(0, base::GetProcessCount(process_name, NULL)); 282 ASSERT_NE(0, base::GetProcessCount(process_name, NULL));
283 else 283 else
284 ASSERT_EQ(0, base::GetProcessCount(process_name, NULL)); 284 ASSERT_EQ(0, base::GetProcessCount(process_name, NULL));
285 } 285 }
286 286
287 bool MiniInstallerTestUtil::VerifyProcessClose( 287 bool MiniInstallerTestUtil::VerifyProcessClose(
288 const wchar_t* process_name) { 288 const wchar_t* process_name) {
289 int timer = 0; 289 int timer = 0;
290 if (base::GetProcessCount(process_name, NULL) > 0) { 290 if (base::GetProcessCount(process_name, NULL) > 0) {
291 LOG(INFO) << "Waiting for this process to end: " << process_name; 291 VLOG(1) << "Waiting for this process to end: " << process_name;
292 while ((base::GetProcessCount(process_name, NULL) > 0) && 292 while ((base::GetProcessCount(process_name, NULL) > 0) &&
293 (timer < TestTimeouts::large_test_timeout_ms())) { 293 (timer < TestTimeouts::large_test_timeout_ms())) {
294 PlatformThread::Sleep(200); 294 PlatformThread::Sleep(200);
295 timer = timer + 200; 295 timer = timer + 200;
296 } 296 }
297 } else { 297 } else {
298 if (base::GetProcessCount(process_name, NULL) != 0) 298 if (base::GetProcessCount(process_name, NULL) != 0)
299 return false; 299 return false;
300 } 300 }
301 return true; 301 return true;
302 } 302 }
303 303
304 bool MiniInstallerTestUtil::VerifyProcessHandleClosed( 304 bool MiniInstallerTestUtil::VerifyProcessHandleClosed(
305 base::ProcessHandle handle) { 305 base::ProcessHandle handle) {
306 DWORD result = WaitForSingleObject(handle, 306 DWORD result = WaitForSingleObject(handle,
307 TestTimeouts::large_test_timeout_ms()); 307 TestTimeouts::large_test_timeout_ms());
308 return result == WAIT_OBJECT_0; 308 return result == WAIT_OBJECT_0;
309 } 309 }
OLDNEW
« no previous file with comments | « chrome/test/memory_test/memory_test.cc ('k') | chrome/test/page_cycler/page_cycler_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698