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

Side by Side Diff: chrome/browser/extensions/test_extension_prefs.cc

Issue 2314363002: extensions: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Comment addressed Created 4 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/extensions/test_extension_prefs.h" 5 #include "chrome/browser/extensions/test_extension_prefs.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 mutable base::Time current_time_; 65 mutable base::Time current_time_;
66 }; 66 };
67 67
68 } // namespace 68 } // namespace
69 69
70 TestExtensionPrefs::TestExtensionPrefs( 70 TestExtensionPrefs::TestExtensionPrefs(
71 const scoped_refptr<base::SequencedTaskRunner>& task_runner) 71 const scoped_refptr<base::SequencedTaskRunner>& task_runner)
72 : task_runner_(task_runner), extensions_disabled_(false) { 72 : task_runner_(task_runner), extensions_disabled_(false) {
73 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); 73 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir());
74 preferences_file_ = temp_dir_.path().Append(chrome::kPreferencesFilename); 74 preferences_file_ = temp_dir_.GetPath().Append(chrome::kPreferencesFilename);
75 extensions_dir_ = temp_dir_.path().AppendASCII("Extensions"); 75 extensions_dir_ = temp_dir_.GetPath().AppendASCII("Extensions");
76 EXPECT_TRUE(base::CreateDirectory(extensions_dir_)); 76 EXPECT_TRUE(base::CreateDirectory(extensions_dir_));
77 77
78 ResetPrefRegistry(); 78 ResetPrefRegistry();
79 RecreateExtensionPrefs(); 79 RecreateExtensionPrefs();
80 } 80 }
81 81
82 TestExtensionPrefs::~TestExtensionPrefs() { 82 TestExtensionPrefs::~TestExtensionPrefs() {
83 } 83 }
84 84
85 ExtensionPrefs* TestExtensionPrefs::prefs() { 85 ExtensionPrefs* TestExtensionPrefs::prefs() {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 run_loop.Run(); 117 run_loop.Run();
118 } 118 }
119 119
120 extension_pref_value_map_.reset(new ExtensionPrefValueMap); 120 extension_pref_value_map_.reset(new ExtensionPrefValueMap);
121 syncable_prefs::PrefServiceMockFactory factory; 121 syncable_prefs::PrefServiceMockFactory factory;
122 factory.SetUserPrefsFile(preferences_file_, task_runner_.get()); 122 factory.SetUserPrefsFile(preferences_file_, task_runner_.get());
123 factory.set_extension_prefs( 123 factory.set_extension_prefs(
124 new ExtensionPrefStore(extension_pref_value_map_.get(), false)); 124 new ExtensionPrefStore(extension_pref_value_map_.get(), false));
125 pref_service_ = factory.CreateSyncable(pref_registry_.get()); 125 pref_service_ = factory.CreateSyncable(pref_registry_.get());
126 std::unique_ptr<ExtensionPrefs> prefs(ExtensionPrefs::Create( 126 std::unique_ptr<ExtensionPrefs> prefs(ExtensionPrefs::Create(
127 &profile_, pref_service_.get(), temp_dir_.path(), 127 &profile_, pref_service_.get(), temp_dir_.GetPath(),
128 extension_pref_value_map_.get(), extensions_disabled_, 128 extension_pref_value_map_.get(), extensions_disabled_,
129 std::vector<ExtensionPrefsObserver*>(), 129 std::vector<ExtensionPrefsObserver*>(),
130 // Guarantee that no two extensions get the same installation time 130 // Guarantee that no two extensions get the same installation time
131 // stamp and we can reliably assert the installation order in the tests. 131 // stamp and we can reliably assert the installation order in the tests.
132 std::unique_ptr<ExtensionPrefs::TimeProvider>( 132 std::unique_ptr<ExtensionPrefs::TimeProvider>(
133 new IncrementalTimeProvider()))); 133 new IncrementalTimeProvider())));
134 ExtensionPrefsFactory::GetInstance()->SetInstanceForTesting(&profile_, 134 ExtensionPrefsFactory::GetInstance()->SetInstanceForTesting(&profile_,
135 std::move(prefs)); 135 std::move(prefs));
136 // Hack: After recreating ExtensionPrefs, the AppSorting also needs to be 136 // Hack: After recreating ExtensionPrefs, the AppSorting also needs to be
137 // recreated. (ExtensionPrefs is never recreated in non-test code.) 137 // recreated. (ExtensionPrefs is never recreated in non-test code.)
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 void TestExtensionPrefs::set_extensions_disabled(bool extensions_disabled) { 207 void TestExtensionPrefs::set_extensions_disabled(bool extensions_disabled) {
208 extensions_disabled_ = extensions_disabled; 208 extensions_disabled_ = extensions_disabled;
209 } 209 }
210 210
211 ChromeAppSorting* TestExtensionPrefs::app_sorting() { 211 ChromeAppSorting* TestExtensionPrefs::app_sorting() {
212 return static_cast<ChromeAppSorting*>( 212 return static_cast<ChromeAppSorting*>(
213 ExtensionSystem::Get(&profile_)->app_sorting()); 213 ExtensionSystem::Get(&profile_)->app_sorting());
214 } 214 }
215 215
216 } // namespace extensions 216 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/test_extension_prefs.h ('k') | chrome/browser/extensions/updater/local_extension_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698