| 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/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 FilePath path = extensions_dir_.AppendASCII(name); | 132 FilePath path = extensions_dir_.AppendASCII(name); |
| 133 std::string errors; | 133 std::string errors; |
| 134 scoped_refptr<Extension> extension = Extension::Create( | 134 scoped_refptr<Extension> extension = Extension::Create( |
| 135 path, location, manifest, extra_flags, &errors); | 135 path, location, manifest, extra_flags, &errors); |
| 136 EXPECT_TRUE(extension) << errors; | 136 EXPECT_TRUE(extension) << errors; |
| 137 if (!extension) | 137 if (!extension) |
| 138 return NULL; | 138 return NULL; |
| 139 | 139 |
| 140 EXPECT_TRUE(Extension::IdIsValid(extension->id())); | 140 EXPECT_TRUE(Extension::IdIsValid(extension->id())); |
| 141 prefs_->OnExtensionInstalled(extension, Extension::ENABLED, | 141 prefs_->OnExtensionInstalled(extension, Extension::ENABLED, |
| 142 extra_flags & Extension::FROM_WEBSTORE, 0); | 142 extra_flags & Extension::FROM_WEBSTORE, |
| 143 StringOrdinal::CreateValidOrdinal()); |
| 143 return extension; | 144 return extension; |
| 144 } | 145 } |
| 145 | 146 |
| 146 std::string TestExtensionPrefs::AddExtensionAndReturnId(std::string name) { | 147 std::string TestExtensionPrefs::AddExtensionAndReturnId(std::string name) { |
| 147 scoped_refptr<Extension> extension(AddExtension(name)); | 148 scoped_refptr<Extension> extension(AddExtension(name)); |
| 148 return extension->id(); | 149 return extension->id(); |
| 149 } | 150 } |
| 150 | 151 |
| 151 PrefService* TestExtensionPrefs::CreateIncognitoPrefService() const { | 152 PrefService* TestExtensionPrefs::CreateIncognitoPrefService() const { |
| 152 return pref_service_->CreateIncognitoPrefService( | 153 return pref_service_->CreateIncognitoPrefService( |
| 153 new ExtensionPrefStore(extension_pref_value_map_.get(), true)); | 154 new ExtensionPrefStore(extension_pref_value_map_.get(), true)); |
| 154 } | 155 } |
| 155 | 156 |
| 156 void TestExtensionPrefs::set_extensions_disabled(bool extensions_disabled) { | 157 void TestExtensionPrefs::set_extensions_disabled(bool extensions_disabled) { |
| 157 extensions_disabled_ = extensions_disabled; | 158 extensions_disabled_ = extensions_disabled; |
| 158 } | 159 } |
| OLD | NEW |