| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_frame/test_utils.h" | 5 #include "chrome_frame/test_utils.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include <atlwin.h> | 8 #include <atlwin.h> |
| 9 #include <winternl.h> | 9 #include <winternl.h> |
| 10 | 10 |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 15 #include "base/process_util.h" | 15 #include "base/process_util.h" |
| 16 #include "base/scoped_handle.h" | 16 #include "base/scoped_handle.h" |
| 17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 18 #include "chrome/common/chrome_paths.h" | 18 #include "chrome/common/chrome_paths.h" |
| 19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 21 |
| 22 const wchar_t kChromeFrameDllName[] = L"npchrome_frame.dll"; |
| 23 |
| 22 // Statics | 24 // Statics |
| 23 | |
| 24 FilePath ScopedChromeFrameRegistrar::GetChromeFrameBuildPath() { | 25 FilePath ScopedChromeFrameRegistrar::GetChromeFrameBuildPath() { |
| 25 FilePath build_path; | 26 FilePath build_path; |
| 26 PathService::Get(chrome::DIR_APP, &build_path); | 27 PathService::Get(chrome::DIR_APP, &build_path); |
| 27 build_path = build_path.Append(L"servers"). | 28 build_path = build_path.Append(L"servers"). |
| 28 Append(L"npchrome_tab.dll"); | 29 Append(kChromeFrameDllName); |
| 29 file_util::PathExists(build_path); | 30 file_util::PathExists(build_path); |
| 30 return build_path; | 31 return build_path; |
| 31 } | 32 } |
| 32 | 33 |
| 33 void ScopedChromeFrameRegistrar::RegisterDefaults() { | 34 void ScopedChromeFrameRegistrar::RegisterDefaults() { |
| 34 FilePath dll_path = GetChromeFrameBuildPath(); | 35 FilePath dll_path = GetChromeFrameBuildPath(); |
| 35 RegisterAtPath(dll_path.value()); | 36 RegisterAtPath(dll_path.value()); |
| 36 } | 37 } |
| 37 | 38 |
| 38 void ScopedChromeFrameRegistrar::RegisterAtPath( | 39 void ScopedChromeFrameRegistrar::RegisterAtPath( |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 86 |
| 86 file_util::UpOneDirectory(&reference_build_dir); | 87 file_util::UpOneDirectory(&reference_build_dir); |
| 87 file_util::UpOneDirectory(&reference_build_dir); | 88 file_util::UpOneDirectory(&reference_build_dir); |
| 88 | 89 |
| 89 file_util::AppendToPath(&reference_build_dir, L"chrome"); | 90 file_util::AppendToPath(&reference_build_dir, L"chrome"); |
| 90 file_util::AppendToPath(&reference_build_dir, L"tools"); | 91 file_util::AppendToPath(&reference_build_dir, L"tools"); |
| 91 file_util::AppendToPath(&reference_build_dir, L"test"); | 92 file_util::AppendToPath(&reference_build_dir, L"test"); |
| 92 file_util::AppendToPath(&reference_build_dir, L"reference_build"); | 93 file_util::AppendToPath(&reference_build_dir, L"reference_build"); |
| 93 file_util::AppendToPath(&reference_build_dir, L"chrome_frame"); | 94 file_util::AppendToPath(&reference_build_dir, L"chrome_frame"); |
| 94 file_util::AppendToPath(&reference_build_dir, L"servers"); | 95 file_util::AppendToPath(&reference_build_dir, L"servers"); |
| 95 file_util::AppendToPath(&reference_build_dir, L"npchrome_tab.dll"); | 96 file_util::AppendToPath(&reference_build_dir, kChromeFrameDllName); |
| 96 | 97 |
| 97 RegisterChromeFrameAtPath(reference_build_dir); | 98 RegisterChromeFrameAtPath(reference_build_dir); |
| 98 } | 99 } |
| 99 | 100 |
| 100 std::wstring ScopedChromeFrameRegistrar::GetChromeFrameDllPath() const { | 101 std::wstring ScopedChromeFrameRegistrar::GetChromeFrameDllPath() const { |
| 101 return new_chrome_frame_dll_path_; | 102 return new_chrome_frame_dll_path_; |
| 102 } | 103 } |
| 103 | 104 |
| 104 // TODO(robertshield): The following could be factored out into its own file. | 105 // TODO(robertshield): The following could be factored out into its own file. |
| 105 namespace { | 106 namespace { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 base::NamedProcessIterator iter(process_name, &filter); | 252 base::NamedProcessIterator iter(process_name, &filter); |
| 252 while (entry = iter.NextProcessEntry()) { | 253 while (entry = iter.NextProcessEntry()) { |
| 253 if (!base::KillProcessById((*entry).th32ProcessID, 0, true)) { | 254 if (!base::KillProcessById((*entry).th32ProcessID, 0, true)) { |
| 254 DLOG(ERROR) << "Failed to kill process " << (*entry).th32ProcessID; | 255 DLOG(ERROR) << "Failed to kill process " << (*entry).th32ProcessID; |
| 255 result = false; | 256 result = false; |
| 256 } | 257 } |
| 257 } | 258 } |
| 258 | 259 |
| 259 return result; | 260 return result; |
| 260 } | 261 } |
| OLD | NEW |