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