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

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

Issue 11570009: Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 7 years, 12 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
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 base::Bind(&base::DoNothing), 86 base::Bind(&base::DoNothing),
87 run_loop.QuitClosure())); 87 run_loop.QuitClosure()));
88 run_loop.Run(); 88 run_loop.Run();
89 } 89 }
90 90
91 extension_pref_value_map_.reset(new ExtensionPrefValueMap); 91 extension_pref_value_map_.reset(new ExtensionPrefValueMap);
92 PrefServiceMockBuilder builder; 92 PrefServiceMockBuilder builder;
93 builder.WithUserFilePrefs(preferences_file_, task_runner_); 93 builder.WithUserFilePrefs(preferences_file_, task_runner_);
94 builder.WithExtensionPrefs( 94 builder.WithExtensionPrefs(
95 new ExtensionPrefStore(extension_pref_value_map_.get(), false)); 95 new ExtensionPrefStore(extension_pref_value_map_.get(), false));
96 pref_service_.reset(builder.Create()); 96 pref_service_.reset(builder.CreateSyncable());
97 ExtensionPrefs::RegisterUserPrefs(pref_service_.get()); 97 ExtensionPrefs::RegisterUserPrefs(pref_service_.get());
98 98
99 prefs_ = ExtensionPrefs::Create( 99 prefs_ = ExtensionPrefs::Create(
100 pref_service_.get(), 100 pref_service_.get(),
101 temp_dir_.path(), 101 temp_dir_.path(),
102 extension_pref_value_map_.get(), 102 extension_pref_value_map_.get(),
103 extensions_disabled_, 103 extensions_disabled_,
104 // Guarantee that no two extensions get the same installation time 104 // Guarantee that no two extensions get the same installation time
105 // stamp and we can reliably assert the installation order in the tests. 105 // stamp and we can reliably assert the installation order in the tests.
106 scoped_ptr<ExtensionPrefs::TimeProvider>( 106 scoped_ptr<ExtensionPrefs::TimeProvider>(
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 prefs_->OnExtensionInstalled(extension, Extension::ENABLED, 149 prefs_->OnExtensionInstalled(extension, Extension::ENABLED,
150 syncer::StringOrdinal::CreateInitialOrdinal()); 150 syncer::StringOrdinal::CreateInitialOrdinal());
151 return extension; 151 return extension;
152 } 152 }
153 153
154 std::string TestExtensionPrefs::AddExtensionAndReturnId(std::string name) { 154 std::string TestExtensionPrefs::AddExtensionAndReturnId(std::string name) {
155 scoped_refptr<Extension> extension(AddExtension(name)); 155 scoped_refptr<Extension> extension(AddExtension(name));
156 return extension->id(); 156 return extension->id();
157 } 157 }
158 158
159 PrefService* TestExtensionPrefs::CreateIncognitoPrefService() const { 159 PrefServiceSyncable* TestExtensionPrefs::CreateIncognitoPrefService() const {
160 return pref_service_->CreateIncognitoPrefService( 160 return pref_service_->CreateIncognitoPrefService(
161 new ExtensionPrefStore(extension_pref_value_map_.get(), true)); 161 new ExtensionPrefStore(extension_pref_value_map_.get(), true));
162 } 162 }
163 163
164 void TestExtensionPrefs::set_extensions_disabled(bool extensions_disabled) { 164 void TestExtensionPrefs::set_extensions_disabled(bool extensions_disabled) {
165 extensions_disabled_ = extensions_disabled; 165 extensions_disabled_ = extensions_disabled;
166 } 166 }
167 167
168 } // namespace extensions 168 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698