| 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 <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 Loading... |
| 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 return extensions_.GetByID(id); | 156 for (ExtensionList::const_iterator iter = extensions_.begin(); |
| 157 iter != extensions_.end(); ++iter) { |
| 158 if ((*iter)->id() == id) { |
| 159 return *iter; |
| 160 } |
| 161 } |
| 162 return NULL; |
| 157 } | 163 } |
| 158 | 164 |
| 159 virtual const ExtensionSet* extensions() const OVERRIDE { | 165 virtual const ExtensionList* extensions() const OVERRIDE { |
| 160 return &extensions_; | 166 return &extensions_; |
| 161 } | 167 } |
| 162 | 168 |
| 163 virtual PendingExtensionManager* pending_extension_manager() OVERRIDE { | 169 virtual PendingExtensionManager* pending_extension_manager() OVERRIDE { |
| 164 return &pending_extension_manager_; | 170 return &pending_extension_manager_; |
| 165 } | 171 } |
| 166 | 172 |
| 167 void set_extensions(ExtensionList extensions) { | 173 void set_extensions(ExtensionList extensions) { |
| 168 for (ExtensionList::const_iterator it = extensions.begin(); | 174 extensions_ = extensions; |
| 169 it != extensions.end(); ++it) { | |
| 170 extensions_.Insert(*it); | |
| 171 } | |
| 172 } | 175 } |
| 173 | 176 |
| 174 private: | 177 private: |
| 175 ExtensionSet extensions_; | 178 ExtensionList extensions_; |
| 176 }; | 179 }; |
| 177 | 180 |
| 178 class ServiceForDownloadTests : public MockService { | 181 class ServiceForDownloadTests : public MockService { |
| 179 public: | 182 public: |
| 180 ServiceForDownloadTests() | 183 ServiceForDownloadTests() |
| 181 : MockService() { | 184 : MockService() { |
| 182 } | 185 } |
| 183 | 186 |
| 184 // Add a fake crx installer to be returned by a call to UpdateExtension() | 187 // Add a fake crx installer to be returned by a call to UpdateExtension() |
| 185 // with a specific ID. Caller keeps ownership of |crx_installer|. | 188 // with a specific ID. Caller keeps ownership of |crx_installer|. |
| (...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 | 1260 |
| 1258 // TODO(asargent) - (http://crbug.com/12780) add tests for: | 1261 // TODO(asargent) - (http://crbug.com/12780) add tests for: |
| 1259 // -prodversionmin (shouldn't update if browser version too old) | 1262 // -prodversionmin (shouldn't update if browser version too old) |
| 1260 // -manifests & updates arriving out of order / interleaved | 1263 // -manifests & updates arriving out of order / interleaved |
| 1261 // -malformed update url (empty, file://, has query, has a # fragment, etc.) | 1264 // -malformed update url (empty, file://, has query, has a # fragment, etc.) |
| 1262 // -An extension gets uninstalled while updates are in progress (so it doesn't | 1265 // -An extension gets uninstalled while updates are in progress (so it doesn't |
| 1263 // "come back from the dead") | 1266 // "come back from the dead") |
| 1264 // -An extension gets manually updated to v3 while we're downloading v2 (ie | 1267 // -An extension gets manually updated to v3 while we're downloading v2 (ie |
| 1265 // you don't get downgraded accidentally) | 1268 // you don't get downgraded accidentally) |
| 1266 // -An update manifest mentions multiple updates | 1269 // -An update manifest mentions multiple updates |
| OLD | NEW |