| OLD | NEW |
| 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_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"; | 22 const wchar_t kChromeFrameDllName[] = L"npchrome_frame.dll"; |
| 23 const wchar_t kChromeLauncherExeName[] = L"chrome_launcher.exe"; | 23 const wchar_t kChromeLauncherExeName[] = L"chrome_launcher.exe"; |
| 24 const char kReferenceChromeFrameDllName[] = "npchrome_tab.dll"; | |
| 25 | 24 |
| 26 // Statics | 25 // Statics |
| 27 FilePath ScopedChromeFrameRegistrar::GetChromeFrameBuildPath() { | 26 FilePath ScopedChromeFrameRegistrar::GetChromeFrameBuildPath() { |
| 28 FilePath build_path; | 27 FilePath build_path; |
| 29 PathService::Get(chrome::DIR_APP, &build_path); | 28 PathService::Get(chrome::DIR_APP, &build_path); |
| 30 | 29 |
| 31 FilePath dll_path = build_path.Append(L"servers"). | 30 FilePath dll_path = build_path.Append(L"servers"). |
| 32 Append(kChromeFrameDllName); | 31 Append(kChromeFrameDllName); |
| 33 | 32 |
| 34 if (!file_util::PathExists(dll_path)) { | 33 if (!file_util::PathExists(dll_path)) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 104 |
| 106 reference_build_dir = reference_build_dir.DirName(); | 105 reference_build_dir = reference_build_dir.DirName(); |
| 107 reference_build_dir = reference_build_dir.DirName(); | 106 reference_build_dir = reference_build_dir.DirName(); |
| 108 | 107 |
| 109 reference_build_dir = reference_build_dir.AppendASCII("chrome_frame"); | 108 reference_build_dir = reference_build_dir.AppendASCII("chrome_frame"); |
| 110 reference_build_dir = reference_build_dir.AppendASCII("tools"); | 109 reference_build_dir = reference_build_dir.AppendASCII("tools"); |
| 111 reference_build_dir = reference_build_dir.AppendASCII("test"); | 110 reference_build_dir = reference_build_dir.AppendASCII("test"); |
| 112 reference_build_dir = reference_build_dir.AppendASCII("reference_build"); | 111 reference_build_dir = reference_build_dir.AppendASCII("reference_build"); |
| 113 reference_build_dir = reference_build_dir.AppendASCII("chrome"); | 112 reference_build_dir = reference_build_dir.AppendASCII("chrome"); |
| 114 reference_build_dir = reference_build_dir.AppendASCII("servers"); | 113 reference_build_dir = reference_build_dir.AppendASCII("servers"); |
| 115 reference_build_dir = reference_build_dir.AppendASCII( | 114 reference_build_dir = reference_build_dir.Append(kChromeFrameDllName); |
| 116 kReferenceChromeFrameDllName); | |
| 117 return reference_build_dir; | 115 return reference_build_dir; |
| 118 } | 116 } |
| 119 | 117 |
| 120 // Non-statics | 118 // Non-statics |
| 121 | 119 |
| 122 ScopedChromeFrameRegistrar::ScopedChromeFrameRegistrar( | 120 ScopedChromeFrameRegistrar::ScopedChromeFrameRegistrar( |
| 123 const std::wstring& path) { | 121 const std::wstring& path) { |
| 124 original_dll_path_ = path; | 122 original_dll_path_ = path; |
| 125 RegisterChromeFrameAtPath(original_dll_path_); | 123 RegisterChromeFrameAtPath(original_dll_path_); |
| 126 } | 124 } |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 base::NamedProcessIterator iter(process_name, &filter); | 297 base::NamedProcessIterator iter(process_name, &filter); |
| 300 while (const base::ProcessEntry* entry = iter.NextProcessEntry()) { | 298 while (const base::ProcessEntry* entry = iter.NextProcessEntry()) { |
| 301 if (!base::KillProcessById(entry->pid(), 0, true)) { | 299 if (!base::KillProcessById(entry->pid(), 0, true)) { |
| 302 DLOG(ERROR) << "Failed to kill process " << (*entry).th32ProcessID; | 300 DLOG(ERROR) << "Failed to kill process " << (*entry).th32ProcessID; |
| 303 result = false; | 301 result = false; |
| 304 } | 302 } |
| 305 } | 303 } |
| 306 | 304 |
| 307 return result; | 305 return result; |
| 308 } | 306 } |
| OLD | NEW |