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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 return AddExtensionWithManifest(dictionary, Extension::INTERNAL); | 101 return AddExtensionWithManifest(dictionary, Extension::INTERNAL); |
102 } | 102 } |
103 | 103 |
104 scoped_refptr<Extension> TestExtensionPrefs::AddExtensionWithManifest( | 104 scoped_refptr<Extension> TestExtensionPrefs::AddExtensionWithManifest( |
105 const DictionaryValue& manifest, Extension::Location location) { | 105 const DictionaryValue& manifest, Extension::Location location) { |
106 std::string name; | 106 std::string name; |
107 EXPECT_TRUE(manifest.GetString(extension_manifest_keys::kName, &name)); | 107 EXPECT_TRUE(manifest.GetString(extension_manifest_keys::kName, &name)); |
108 FilePath path = extensions_dir_.AppendASCII(name); | 108 FilePath path = extensions_dir_.AppendASCII(name); |
109 std::string errors; | 109 std::string errors; |
110 scoped_refptr<Extension> extension = Extension::Create( | 110 scoped_refptr<Extension> extension = Extension::Create( |
111 path, location, manifest, false, true, &errors); | 111 path, location, manifest, Extension::STRICT_ERROR_CHECKS, &errors); |
112 EXPECT_TRUE(extension); | 112 EXPECT_TRUE(extension); |
113 if (!extension) | 113 if (!extension) |
114 return NULL; | 114 return NULL; |
115 | 115 |
116 EXPECT_TRUE(Extension::IdIsValid(extension->id())); | 116 EXPECT_TRUE(Extension::IdIsValid(extension->id())); |
117 const bool kInitialIncognitoEnabled = false; | 117 const bool kInitialIncognitoEnabled = false; |
118 prefs_->OnExtensionInstalled(extension, Extension::ENABLED, | 118 prefs_->OnExtensionInstalled(extension, Extension::ENABLED, |
119 kInitialIncognitoEnabled); | 119 kInitialIncognitoEnabled); |
120 return extension; | 120 return extension; |
121 } | 121 } |
122 | 122 |
123 std::string TestExtensionPrefs::AddExtensionAndReturnId(std::string name) { | 123 std::string TestExtensionPrefs::AddExtensionAndReturnId(std::string name) { |
124 scoped_refptr<Extension> extension(AddExtension(name)); | 124 scoped_refptr<Extension> extension(AddExtension(name)); |
125 return extension->id(); | 125 return extension->id(); |
126 } | 126 } |
127 | 127 |
128 PrefService* TestExtensionPrefs::CreateIncognitoPrefService() const { | 128 PrefService* TestExtensionPrefs::CreateIncognitoPrefService() const { |
129 return pref_service_->CreateIncognitoPrefService( | 129 return pref_service_->CreateIncognitoPrefService( |
130 new ExtensionPrefStore(extension_pref_value_map_.get(), true)); | 130 new ExtensionPrefStore(extension_pref_value_map_.get(), true)); |
131 } | 131 } |
OLD | NEW |