| OLD | NEW |
| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/component_loader.h" | 7 #include "chrome/browser/extensions/component_loader.h" |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 class MockExtensionService : public TestExtensionService { | 23 class MockExtensionService : public TestExtensionService { |
| 24 private: | 24 private: |
| 25 bool ready_; | 25 bool ready_; |
| 26 size_t unloaded_count_; | 26 size_t unloaded_count_; |
| 27 ExtensionSet extension_set_; | 27 ExtensionSet extension_set_; |
| 28 | 28 |
| 29 public: | 29 public: |
| 30 MockExtensionService() : ready_(false), unloaded_count_(0) { | 30 MockExtensionService() : ready_(false), unloaded_count_(0) { |
| 31 } | 31 } |
| 32 | 32 |
| 33 virtual void AddExtension(const Extension* extension) OVERRIDE { | 33 virtual void AddComponentExtension(const Extension* extension) OVERRIDE { |
| 34 EXPECT_FALSE(extension_set_.Contains(extension->id())); | 34 EXPECT_FALSE(extension_set_.Contains(extension->id())); |
| 35 // ExtensionService must become the owner of the extension object. | 35 // ExtensionService must become the owner of the extension object. |
| 36 extension_set_.Insert(extension); | 36 extension_set_.Insert(extension); |
| 37 } | 37 } |
| 38 | 38 |
| 39 virtual void UnloadExtension( | 39 virtual void UnloadExtension( |
| 40 const std::string& extension_id, | 40 const std::string& extension_id, |
| 41 extension_misc::UnloadedExtensionReason reason) OVERRIDE { | 41 extension_misc::UnloadedExtensionReason reason) OVERRIDE { |
| 42 ASSERT_TRUE(extension_set_.Contains(extension_id)); | 42 ASSERT_TRUE(extension_set_.Contains(extension_id)); |
| 43 // Remove the extension with the matching id. | 43 // Remove the extension with the matching id. |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 EXPECT_EQ(default_count + 1, extension_service_.extensions()->size()); | 281 EXPECT_EQ(default_count + 1, extension_service_.extensions()->size()); |
| 282 EXPECT_EQ(0u, extension_service_.unloaded_count()); | 282 EXPECT_EQ(0u, extension_service_.unloaded_count()); |
| 283 | 283 |
| 284 // replace loaded component extension. | 284 // replace loaded component extension. |
| 285 component_loader_.AddOrReplace(known_extension); | 285 component_loader_.AddOrReplace(known_extension); |
| 286 EXPECT_EQ(default_count + 1, extension_service_.extensions()->size()); | 286 EXPECT_EQ(default_count + 1, extension_service_.extensions()->size()); |
| 287 EXPECT_EQ(1u, extension_service_.unloaded_count()); | 287 EXPECT_EQ(1u, extension_service_.unloaded_count()); |
| 288 } | 288 } |
| 289 | 289 |
| 290 } // namespace extensions | 290 } // namespace extensions |
| OLD | NEW |