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

Side by Side Diff: chrome_frame/test_utils.cc

Issue 271099: Re-try r29078: Remove some deprecated file_util wstring functions. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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_frame/test_utils.h ('k') | net/tools/crash_cache/crash_cache.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) 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 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "chrome/common/chrome_paths.h" 13 #include "chrome/common/chrome_paths.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 // Statics 16 // Statics
17 17
18 std::wstring ScopedChromeFrameRegistrar::GetChromeFrameBuildPath() { 18 FilePath ScopedChromeFrameRegistrar::GetChromeFrameBuildPath() {
19 std::wstring build_path; 19 FilePath build_path;
20 PathService::Get(chrome::DIR_APP, &build_path); 20 PathService::Get(chrome::DIR_APP, &build_path);
21 file_util::AppendToPath(&build_path, L"servers\\npchrome_tab.dll"); 21 build_path = build_path.Append(L"servers").
22 Append(L"npchrome_tab.dll");
22 file_util::PathExists(build_path); 23 file_util::PathExists(build_path);
23 return build_path; 24 return build_path;
24 } 25 }
25 26
26 void ScopedChromeFrameRegistrar::RegisterDefaults() { 27 void ScopedChromeFrameRegistrar::RegisterDefaults() {
27 std::wstring dll_path_ = GetChromeFrameBuildPath(); 28 FilePath dll_path = GetChromeFrameBuildPath();
28 RegisterAtPath(dll_path_); 29 RegisterAtPath(dll_path.value());
29 } 30 }
30 31
31 void ScopedChromeFrameRegistrar::RegisterAtPath( 32 void ScopedChromeFrameRegistrar::RegisterAtPath(
32 const std::wstring& path) { 33 const std::wstring& path) {
33 34
34 ASSERT_FALSE(path.empty()); 35 ASSERT_FALSE(path.empty());
35 HMODULE chrome_frame_dll_handle = LoadLibrary(path.c_str()); 36 HMODULE chrome_frame_dll_handle = LoadLibrary(path.c_str());
36 ASSERT_TRUE(chrome_frame_dll_handle != NULL); 37 ASSERT_TRUE(chrome_frame_dll_handle != NULL);
37 38
38 typedef HRESULT (STDAPICALLTYPE* DllRegisterServerFn)(); 39 typedef HRESULT (STDAPICALLTYPE* DllRegisterServerFn)();
(...skipping 10 matching lines...) Expand all
49 50
50 if (register_npapi_server != NULL) 51 if (register_npapi_server != NULL)
51 EXPECT_HRESULT_SUCCEEDED((*register_npapi_server)()); 52 EXPECT_HRESULT_SUCCEEDED((*register_npapi_server)());
52 53
53 ASSERT_TRUE(FreeLibrary(chrome_frame_dll_handle)); 54 ASSERT_TRUE(FreeLibrary(chrome_frame_dll_handle));
54 } 55 }
55 56
56 // Non-statics 57 // Non-statics
57 58
58 ScopedChromeFrameRegistrar::ScopedChromeFrameRegistrar() { 59 ScopedChromeFrameRegistrar::ScopedChromeFrameRegistrar() {
59 original_dll_path_ = GetChromeFrameBuildPath(); 60 original_dll_path_ = GetChromeFrameBuildPath().ToWStringHack();
60 RegisterChromeFrameAtPath(original_dll_path_); 61 RegisterChromeFrameAtPath(original_dll_path_);
61 } 62 }
62 63
63 ScopedChromeFrameRegistrar::~ScopedChromeFrameRegistrar() { 64 ScopedChromeFrameRegistrar::~ScopedChromeFrameRegistrar() {
64 if (FilePath(original_dll_path_) != FilePath(new_chrome_frame_dll_path_)) { 65 if (FilePath(original_dll_path_) != FilePath(new_chrome_frame_dll_path_)) {
65 RegisterChromeFrameAtPath(original_dll_path_); 66 RegisterChromeFrameAtPath(original_dll_path_);
66 } 67 }
67 } 68 }
68 69
69 void ScopedChromeFrameRegistrar::RegisterChromeFrameAtPath( 70 void ScopedChromeFrameRegistrar::RegisterChromeFrameAtPath(
(...skipping 16 matching lines...) Expand all
86 file_util::AppendToPath(&reference_build_dir, L"chrome"); 87 file_util::AppendToPath(&reference_build_dir, L"chrome");
87 file_util::AppendToPath(&reference_build_dir, L"servers"); 88 file_util::AppendToPath(&reference_build_dir, L"servers");
88 file_util::AppendToPath(&reference_build_dir, L"npchrome_tab.dll"); 89 file_util::AppendToPath(&reference_build_dir, L"npchrome_tab.dll");
89 90
90 RegisterChromeFrameAtPath(reference_build_dir); 91 RegisterChromeFrameAtPath(reference_build_dir);
91 } 92 }
92 93
93 std::wstring ScopedChromeFrameRegistrar::GetChromeFrameDllPath() const { 94 std::wstring ScopedChromeFrameRegistrar::GetChromeFrameDllPath() const {
94 return new_chrome_frame_dll_path_; 95 return new_chrome_frame_dll_path_;
95 } 96 }
OLDNEW
« no previous file with comments | « chrome_frame/test_utils.h ('k') | net/tools/crash_cache/crash_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698