| OLD | NEW |
| 1 // Copyright (c) 2010 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/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_path.h" |
| 7 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 9 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| 10 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 11 #include "base/test/test_timeouts.h" | 12 #include "base/test/test_timeouts.h" |
| 12 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
| 13 #include "base/time.h" | 14 #include "base/time.h" |
| 14 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 15 #include "chrome/installer/util/logging_installer.h" | 16 #include "chrome/installer/util/logging_installer.h" |
| 16 #include "chrome/test/mini_installer_test/mini_installer_test_constants.h" | 17 #include "chrome/test/mini_installer_test/mini_installer_test_constants.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 if (file_handle == INVALID_HANDLE_VALUE) { | 139 if (file_handle == INVALID_HANDLE_VALUE) { |
| 139 VLOG(1) << "Handle is invalid."; | 140 VLOG(1) << "Handle is invalid."; |
| 140 return false; | 141 return false; |
| 141 } | 142 } |
| 142 BOOL ret = TRUE; | 143 BOOL ret = TRUE; |
| 143 bool return_val = false; | 144 bool return_val = false; |
| 144 while (ret) { | 145 while (ret) { |
| 145 std::wstring search_path = find_file_data.cFileName; | 146 std::wstring search_path = find_file_data.cFileName; |
| 146 size_t position_found = search_path.find(pattern); | 147 size_t position_found = search_path.find(pattern); |
| 147 if (position_found != -1) { | 148 if (position_found != -1) { |
| 148 std::wstring extension = file_util::GetFileExtensionFromPath(file_name); | 149 std::wstring extension = FilePath(file_name).Extension(); |
| 149 if ((base::strcasecmp(WideToUTF8(extension).c_str(), "exe")) == 0) { | 150 if ((base::strcasecmp(WideToUTF8(extension).c_str(), ".exe")) == 0) { |
| 150 file_details->push_back(FileInfo(find_file_data.cFileName, 0)); | 151 file_details->push_back(FileInfo(find_file_data.cFileName, 0)); |
| 151 return_val = true; | 152 return_val = true; |
| 152 break; | 153 break; |
| 153 } else { | 154 } else { |
| 154 FILETIME file_time = find_file_data.ftCreationTime; | 155 FILETIME file_time = find_file_data.ftCreationTime; |
| 155 base::Time creation_time = base::Time::FromFileTime(file_time); | 156 base::Time creation_time = base::Time::FromFileTime(file_time); |
| 156 file_details->push_back(FileInfo(find_file_data.cFileName, | 157 file_details->push_back(FileInfo(find_file_data.cFileName, |
| 157 static_cast<int>(creation_time.ToDoubleT()))); | 158 static_cast<int>(creation_time.ToDoubleT()))); |
| 158 return_val = true; | 159 return_val = true; |
| 159 } | 160 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 } | 301 } |
| 301 return true; | 302 return true; |
| 302 } | 303 } |
| 303 | 304 |
| 304 bool MiniInstallerTestUtil::VerifyProcessHandleClosed( | 305 bool MiniInstallerTestUtil::VerifyProcessHandleClosed( |
| 305 base::ProcessHandle handle) { | 306 base::ProcessHandle handle) { |
| 306 DWORD result = WaitForSingleObject(handle, | 307 DWORD result = WaitForSingleObject(handle, |
| 307 TestTimeouts::large_test_timeout_ms()); | 308 TestTimeouts::large_test_timeout_ms()); |
| 308 return result == WAIT_OBJECT_0; | 309 return result == WAIT_OBJECT_0; |
| 309 } | 310 } |
| OLD | NEW |