OLD | NEW |
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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 FilePath path = extensions_dir_.AppendASCII(name); | 139 FilePath path = extensions_dir_.AppendASCII(name); |
140 std::string errors; | 140 std::string errors; |
141 scoped_refptr<Extension> extension = Extension::Create( | 141 scoped_refptr<Extension> extension = Extension::Create( |
142 path, location, manifest, extra_flags, &errors); | 142 path, location, manifest, extra_flags, &errors); |
143 EXPECT_TRUE(extension) << errors; | 143 EXPECT_TRUE(extension) << errors; |
144 if (!extension) | 144 if (!extension) |
145 return NULL; | 145 return NULL; |
146 | 146 |
147 EXPECT_TRUE(Extension::IdIsValid(extension->id())); | 147 EXPECT_TRUE(Extension::IdIsValid(extension->id())); |
148 prefs_->OnExtensionInstalled(extension, Extension::ENABLED, | 148 prefs_->OnExtensionInstalled(extension, Extension::ENABLED, |
149 extra_flags & Extension::FROM_WEBSTORE, | |
150 syncer::StringOrdinal::CreateInitialOrdinal()); | 149 syncer::StringOrdinal::CreateInitialOrdinal()); |
151 return extension; | 150 return extension; |
152 } | 151 } |
153 | 152 |
154 std::string TestExtensionPrefs::AddExtensionAndReturnId(std::string name) { | 153 std::string TestExtensionPrefs::AddExtensionAndReturnId(std::string name) { |
155 scoped_refptr<Extension> extension(AddExtension(name)); | 154 scoped_refptr<Extension> extension(AddExtension(name)); |
156 return extension->id(); | 155 return extension->id(); |
157 } | 156 } |
158 | 157 |
159 PrefService* TestExtensionPrefs::CreateIncognitoPrefService() const { | 158 PrefService* TestExtensionPrefs::CreateIncognitoPrefService() const { |
160 return pref_service_->CreateIncognitoPrefService( | 159 return pref_service_->CreateIncognitoPrefService( |
161 new ExtensionPrefStore(extension_pref_value_map_.get(), true)); | 160 new ExtensionPrefStore(extension_pref_value_map_.get(), true)); |
162 } | 161 } |
163 | 162 |
164 void TestExtensionPrefs::set_extensions_disabled(bool extensions_disabled) { | 163 void TestExtensionPrefs::set_extensions_disabled(bool extensions_disabled) { |
165 extensions_disabled_ = extensions_disabled; | 164 extensions_disabled_ = extensions_disabled; |
166 } | 165 } |
167 | 166 |
168 } // namespace extensions | 167 } // namespace extensions |
OLD | NEW |