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

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

Issue 8733004: Make ExtensionService use ExtensionSet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: + Created 9 years 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) 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 <map> 5 #include <map>
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 146 }
147 147
148 class ServiceForManifestTests : public MockService { 148 class ServiceForManifestTests : public MockService {
149 public: 149 public:
150 ServiceForManifestTests() {} 150 ServiceForManifestTests() {}
151 151
152 virtual ~ServiceForManifestTests() {} 152 virtual ~ServiceForManifestTests() {}
153 153
154 virtual const Extension* GetExtensionById( 154 virtual const Extension* GetExtensionById(
155 const std::string& id, bool include_disabled) const OVERRIDE { 155 const std::string& id, bool include_disabled) const OVERRIDE {
156 for (ExtensionList::const_iterator iter = extensions_.begin(); 156 return extensions_.GetByID(id);
157 iter != extensions_.end(); ++iter) {
158 if ((*iter)->id() == id) {
159 return *iter;
160 }
161 }
162 return NULL;
163 } 157 }
164 158
165 virtual const ExtensionList* extensions() const OVERRIDE { 159 virtual const ExtensionSet* extensions() const OVERRIDE {
166 return &extensions_; 160 return &extensions_;
167 } 161 }
168 162
169 virtual PendingExtensionManager* pending_extension_manager() OVERRIDE { 163 virtual PendingExtensionManager* pending_extension_manager() OVERRIDE {
170 return &pending_extension_manager_; 164 return &pending_extension_manager_;
171 } 165 }
172 166
173 void set_extensions(ExtensionList extensions) { 167 void set_extensions(ExtensionList extensions) {
174 extensions_ = extensions; 168 for (ExtensionList::const_iterator it = extensions.begin();
169 it != extensions.end(); ++it) {
170 extensions_.Insert(*it);
171 }
175 } 172 }
176 173
177 private: 174 private:
178 ExtensionList extensions_; 175 ExtensionSet extensions_;
179 }; 176 };
180 177
181 class ServiceForDownloadTests : public MockService { 178 class ServiceForDownloadTests : public MockService {
182 public: 179 public:
183 ServiceForDownloadTests() 180 ServiceForDownloadTests()
184 : MockService() { 181 : MockService() {
185 } 182 }
186 183
187 // Add a fake crx installer to be returned by a call to UpdateExtension() 184 // Add a fake crx installer to be returned by a call to UpdateExtension()
188 // with a specific ID. Caller keeps ownership of |crx_installer|. 185 // with a specific ID. Caller keeps ownership of |crx_installer|.
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 1257
1261 // TODO(asargent) - (http://crbug.com/12780) add tests for: 1258 // TODO(asargent) - (http://crbug.com/12780) add tests for:
1262 // -prodversionmin (shouldn't update if browser version too old) 1259 // -prodversionmin (shouldn't update if browser version too old)
1263 // -manifests & updates arriving out of order / interleaved 1260 // -manifests & updates arriving out of order / interleaved
1264 // -malformed update url (empty, file://, has query, has a # fragment, etc.) 1261 // -malformed update url (empty, file://, has query, has a # fragment, etc.)
1265 // -An extension gets uninstalled while updates are in progress (so it doesn't 1262 // -An extension gets uninstalled while updates are in progress (so it doesn't
1266 // "come back from the dead") 1263 // "come back from the dead")
1267 // -An extension gets manually updated to v3 while we're downloading v2 (ie 1264 // -An extension gets manually updated to v3 while we're downloading v2 (ie
1268 // you don't get downgraded accidentally) 1265 // you don't get downgraded accidentally)
1269 // -An update manifest mentions multiple updates 1266 // -An update manifest mentions multiple updates
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_updater.cc ('k') | chrome/browser/extensions/extension_webrequest_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698