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

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

Issue 666153002: Standardize usage of virtual/override/final in chrome/browser/extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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/component_loader.h" 5 #include "chrome/browser/extensions/component_loader.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 18 matching lines...) Expand all
29 class MockExtensionService : public TestExtensionService { 29 class MockExtensionService : public TestExtensionService {
30 private: 30 private:
31 bool ready_; 31 bool ready_;
32 size_t unloaded_count_; 32 size_t unloaded_count_;
33 ExtensionSet extension_set_; 33 ExtensionSet extension_set_;
34 34
35 public: 35 public:
36 MockExtensionService() : ready_(false), unloaded_count_(0) { 36 MockExtensionService() : ready_(false), unloaded_count_(0) {
37 } 37 }
38 38
39 virtual void AddComponentExtension(const Extension* extension) override { 39 void AddComponentExtension(const Extension* extension) override {
40 EXPECT_FALSE(extension_set_.Contains(extension->id())); 40 EXPECT_FALSE(extension_set_.Contains(extension->id()));
41 // ExtensionService must become the owner of the extension object. 41 // ExtensionService must become the owner of the extension object.
42 extension_set_.Insert(extension); 42 extension_set_.Insert(extension);
43 } 43 }
44 44
45 virtual void UnloadExtension( 45 void UnloadExtension(const std::string& extension_id,
46 const std::string& extension_id, 46 UnloadedExtensionInfo::Reason reason) override {
47 UnloadedExtensionInfo::Reason reason) override {
48 ASSERT_TRUE(extension_set_.Contains(extension_id)); 47 ASSERT_TRUE(extension_set_.Contains(extension_id));
49 // Remove the extension with the matching id. 48 // Remove the extension with the matching id.
50 extension_set_.Remove(extension_id); 49 extension_set_.Remove(extension_id);
51 unloaded_count_++; 50 unloaded_count_++;
52 } 51 }
53 52
54 virtual void RemoveComponentExtension(const std::string & extension_id) 53 void RemoveComponentExtension(const std::string& extension_id) override {
55 override {
56 UnloadExtension(extension_id, UnloadedExtensionInfo::REASON_DISABLE); 54 UnloadExtension(extension_id, UnloadedExtensionInfo::REASON_DISABLE);
57 } 55 }
58 56
59 virtual bool is_ready() override { 57 bool is_ready() override { return ready_; }
60 return ready_;
61 }
62 58
63 virtual const ExtensionSet* extensions() const override { 59 const ExtensionSet* extensions() const override { return &extension_set_; }
64 return &extension_set_;
65 }
66 60
67 void set_ready(bool ready) { 61 void set_ready(bool ready) {
68 ready_ = ready; 62 ready_ = ready;
69 } 63 }
70 64
71 size_t unloaded_count() const { 65 size_t unloaded_count() const {
72 return unloaded_count_; 66 return unloaded_count_;
73 } 67 }
74 68
75 void clear_extensions() { 69 void clear_extensions() {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 component_loader_.AddOrReplace(known_extension); 268 component_loader_.AddOrReplace(known_extension);
275 EXPECT_EQ(default_count + 1, extension_service_.extensions()->size()); 269 EXPECT_EQ(default_count + 1, extension_service_.extensions()->size());
276 EXPECT_EQ(1u, extension_service_.unloaded_count()); 270 EXPECT_EQ(1u, extension_service_.unloaded_count());
277 271
278 // Add an invalid component extension. 272 // Add an invalid component extension.
279 std::string extension_id = component_loader_.AddOrReplace(invalid_extension); 273 std::string extension_id = component_loader_.AddOrReplace(invalid_extension);
280 EXPECT_TRUE(extension_id.empty()); 274 EXPECT_TRUE(extension_id.empty());
281 } 275 }
282 276
283 } // namespace extensions 277 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/chrome_url_request_util.cc ('k') | chrome/browser/extensions/content_script_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698