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

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

Issue 12093036: Move Extension Location and Type enums to Manifest, and move InstallWarning to its own file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
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>(
107 new IncrementalTimeProvider())); 107 new IncrementalTimeProvider()));
108 } 108 }
109 109
110 scoped_refptr<Extension> TestExtensionPrefs::AddExtension(std::string name) { 110 scoped_refptr<Extension> TestExtensionPrefs::AddExtension(std::string name) {
111 DictionaryValue dictionary; 111 DictionaryValue dictionary;
112 dictionary.SetString(extension_manifest_keys::kName, name); 112 dictionary.SetString(extension_manifest_keys::kName, name);
113 dictionary.SetString(extension_manifest_keys::kVersion, "0.1"); 113 dictionary.SetString(extension_manifest_keys::kVersion, "0.1");
114 return AddExtensionWithManifest(dictionary, Extension::INTERNAL); 114 return AddExtensionWithManifest(dictionary, Manifest::INTERNAL);
115 } 115 }
116 116
117 scoped_refptr<Extension> TestExtensionPrefs::AddApp(std::string name) { 117 scoped_refptr<Extension> TestExtensionPrefs::AddApp(std::string name) {
118 DictionaryValue dictionary; 118 DictionaryValue dictionary;
119 dictionary.SetString(extension_manifest_keys::kName, name); 119 dictionary.SetString(extension_manifest_keys::kName, name);
120 dictionary.SetString(extension_manifest_keys::kVersion, "0.1"); 120 dictionary.SetString(extension_manifest_keys::kVersion, "0.1");
121 dictionary.SetString(extension_manifest_keys::kApp, "true"); 121 dictionary.SetString(extension_manifest_keys::kApp, "true");
122 dictionary.SetString(extension_manifest_keys::kLaunchWebURL, 122 dictionary.SetString(extension_manifest_keys::kLaunchWebURL,
123 "http://example.com"); 123 "http://example.com");
124 return AddExtensionWithManifest(dictionary, Extension::INTERNAL); 124 return AddExtensionWithManifest(dictionary, Manifest::INTERNAL);
125 125
126 } 126 }
127 127
128 scoped_refptr<Extension> TestExtensionPrefs::AddExtensionWithManifest( 128 scoped_refptr<Extension> TestExtensionPrefs::AddExtensionWithManifest(
129 const DictionaryValue& manifest, Extension::Location location) { 129 const DictionaryValue& manifest, Manifest::Location location) {
130 return AddExtensionWithManifestAndFlags(manifest, location, 130 return AddExtensionWithManifestAndFlags(manifest, location,
131 Extension::NO_FLAGS); 131 Extension::NO_FLAGS);
132 } 132 }
133 133
134 scoped_refptr<Extension> TestExtensionPrefs::AddExtensionWithManifestAndFlags( 134 scoped_refptr<Extension> TestExtensionPrefs::AddExtensionWithManifestAndFlags(
135 const DictionaryValue& manifest, 135 const DictionaryValue& manifest,
136 Extension::Location location, 136 Manifest::Location location,
137 int extra_flags) { 137 int extra_flags) {
138 std::string name; 138 std::string name;
139 EXPECT_TRUE(manifest.GetString(extension_manifest_keys::kName, &name)); 139 EXPECT_TRUE(manifest.GetString(extension_manifest_keys::kName, &name));
140 FilePath path = extensions_dir_.AppendASCII(name); 140 FilePath path = extensions_dir_.AppendASCII(name);
141 std::string errors; 141 std::string errors;
142 scoped_refptr<Extension> extension = Extension::Create( 142 scoped_refptr<Extension> extension = Extension::Create(
143 path, location, manifest, extra_flags, &errors); 143 path, location, manifest, extra_flags, &errors);
144 EXPECT_TRUE(extension) << errors; 144 EXPECT_TRUE(extension) << errors;
145 if (!extension) 145 if (!extension)
146 return NULL; 146 return NULL;
(...skipping 12 matching lines...) Expand all
159 PrefServiceSyncable* 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
« no previous file with comments | « chrome/browser/extensions/test_extension_prefs.h ('k') | chrome/browser/extensions/unpacked_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698