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

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

Issue 624153002: replace OVERRIDE and FINAL with override and 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 virtual 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 virtual void UnloadExtension(
46 const std::string& extension_id, 46 const std::string& extension_id,
47 UnloadedExtensionInfo::Reason reason) OVERRIDE { 47 UnloadedExtensionInfo::Reason reason) override {
48 ASSERT_TRUE(extension_set_.Contains(extension_id)); 48 ASSERT_TRUE(extension_set_.Contains(extension_id));
49 // Remove the extension with the matching id. 49 // Remove the extension with the matching id.
50 extension_set_.Remove(extension_id); 50 extension_set_.Remove(extension_id);
51 unloaded_count_++; 51 unloaded_count_++;
52 } 52 }
53 53
54 virtual void RemoveComponentExtension(const std::string & extension_id) 54 virtual void RemoveComponentExtension(const std::string & extension_id)
55 OVERRIDE { 55 override {
56 UnloadExtension(extension_id, UnloadedExtensionInfo::REASON_DISABLE); 56 UnloadExtension(extension_id, UnloadedExtensionInfo::REASON_DISABLE);
57 } 57 }
58 58
59 virtual bool is_ready() OVERRIDE { 59 virtual bool is_ready() override {
60 return ready_; 60 return ready_;
61 } 61 }
62 62
63 virtual const ExtensionSet* extensions() const OVERRIDE { 63 virtual const ExtensionSet* extensions() const override {
64 return &extension_set_; 64 return &extension_set_;
65 } 65 }
66 66
67 void set_ready(bool ready) { 67 void set_ready(bool ready) {
68 ready_ = ready; 68 ready_ = ready;
69 } 69 }
70 70
71 size_t unloaded_count() const { 71 size_t unloaded_count() const {
72 return unloaded_count_; 72 return unloaded_count_;
73 } 73 }
74 74
75 void clear_extensions() { 75 void clear_extensions() {
76 extension_set_.Clear(); 76 extension_set_.Clear();
77 } 77 }
78 }; 78 };
79 79
80 } // namespace 80 } // namespace
81 81
82 class ComponentLoaderTest : public testing::Test { 82 class ComponentLoaderTest : public testing::Test {
83 public: 83 public:
84 ComponentLoaderTest() 84 ComponentLoaderTest()
85 // Note: we pass the same pref service here, to stand in for both 85 // Note: we pass the same pref service here, to stand in for both
86 // user prefs and local state. 86 // user prefs and local state.
87 : component_loader_(&extension_service_, 87 : component_loader_(&extension_service_,
88 &prefs_, 88 &prefs_,
89 &local_state_, 89 &local_state_,
90 &profile_) { 90 &profile_) {
91 } 91 }
92 92
93 virtual void SetUp() OVERRIDE { 93 virtual void SetUp() override {
94 extension_path_ = 94 extension_path_ =
95 GetBasePath().AppendASCII("good") 95 GetBasePath().AppendASCII("good")
96 .AppendASCII("Extensions") 96 .AppendASCII("Extensions")
97 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") 97 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj")
98 .AppendASCII("1.0.0.0"); 98 .AppendASCII("1.0.0.0");
99 99
100 // Read in the extension manifest. 100 // Read in the extension manifest.
101 ASSERT_TRUE(base::ReadFileToString( 101 ASSERT_TRUE(base::ReadFileToString(
102 extension_path_.Append(kManifestFilename), 102 extension_path_.Append(kManifestFilename),
103 &manifest_contents_)); 103 &manifest_contents_));
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 component_loader_.AddOrReplace(known_extension); 274 component_loader_.AddOrReplace(known_extension);
275 EXPECT_EQ(default_count + 1, extension_service_.extensions()->size()); 275 EXPECT_EQ(default_count + 1, extension_service_.extensions()->size());
276 EXPECT_EQ(1u, extension_service_.unloaded_count()); 276 EXPECT_EQ(1u, extension_service_.unloaded_count());
277 277
278 // Add an invalid component extension. 278 // Add an invalid component extension.
279 std::string extension_id = component_loader_.AddOrReplace(invalid_extension); 279 std::string extension_id = component_loader_.AddOrReplace(invalid_extension);
280 EXPECT_TRUE(extension_id.empty()); 280 EXPECT_TRUE(extension_id.empty());
281 } 281 }
282 282
283 } // namespace extensions 283 } // 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