| Index: chrome/browser/extensions/component_loader_unittest.cc
|
| ===================================================================
|
| --- chrome/browser/extensions/component_loader_unittest.cc (revision 113231)
|
| +++ chrome/browser/extensions/component_loader_unittest.cc (working copy)
|
| @@ -11,6 +11,7 @@
|
| #include "chrome/browser/extensions/test_extension_service.h"
|
| #include "chrome/common/chrome_paths.h"
|
| #include "chrome/common/extensions/extension.h"
|
| +#include "chrome/common/extensions/extension_set.h"
|
| #include "chrome/common/pref_names.h"
|
| #include "chrome/test/base/testing_pref_service.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| @@ -20,7 +21,7 @@
|
| class MockExtensionService : public TestExtensionService {
|
| private:
|
| bool ready_;
|
| - ExtensionList extension_list_;
|
| + ExtensionSet extension_set_;
|
|
|
| public:
|
| MockExtensionService() : ready_(false) {
|
| @@ -28,37 +29,30 @@
|
|
|
| virtual void AddExtension(const Extension* extension) OVERRIDE {
|
| // ExtensionService must become the owner of the extension object.
|
| - extension_list_.push_back(extension);
|
| + extension_set_.Insert(extension);
|
| }
|
|
|
| virtual void UnloadExtension(
|
| const std::string& extension_id,
|
| extension_misc::UnloadedExtensionReason reason) OVERRIDE {
|
| // Remove the extension with the matching id.
|
| - for (ExtensionList::iterator it = extension_list_.begin();
|
| - it != extension_list_.end();
|
| - ++it) {
|
| - if ((*it)->id() == extension_id) {
|
| - extension_list_.erase(it);
|
| - return;
|
| - }
|
| - }
|
| + extension_set_.Remove(extension_id);
|
| }
|
|
|
| virtual bool is_ready() OVERRIDE {
|
| return ready_;
|
| }
|
|
|
| - virtual const ExtensionList* extensions() const OVERRIDE {
|
| - return &extension_list_;
|
| + virtual const ExtensionSet* extensions() const OVERRIDE {
|
| + return &extension_set_;
|
| }
|
|
|
| void set_ready(bool ready) {
|
| ready_ = ready;
|
| }
|
|
|
| - void clear_extension_list() {
|
| - extension_list_.clear();
|
| + void clear_extensions() {
|
| + extension_set_.Clear();
|
| }
|
| };
|
|
|
| @@ -217,7 +211,7 @@
|
| unsigned int default_count = extension_service_.extensions()->size();
|
|
|
| // Clear the list of loaded extensions, and reload with one more.
|
| - extension_service_.clear_extension_list();
|
| + extension_service_.clear_extensions();
|
| component_loader_.Add(manifest_contents_, extension_path_);
|
| component_loader_.LoadAll();
|
|
|
| @@ -237,7 +231,7 @@
|
|
|
| // Now that the pref is set, check if it's added by default.
|
| extension_service_.set_ready(false);
|
| - extension_service_.clear_extension_list();
|
| + extension_service_.clear_extensions();
|
| component_loader_.ClearAllRegistered();
|
| component_loader_.AddDefaultComponentExtensions();
|
| component_loader_.LoadAll();
|
|
|