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

Side by Side Diff: chrome/browser/policy/url_blacklist_manager_unittest.cc

Issue 624173002: replace OVERRIDE and FINAL with override and final in chrome/browser/[j-q]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master 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 "components/policy/core/browser/url_blacklist_manager.h" 5 #include "components/policy/core/browser/url_blacklist_manager.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 // Makes a direct call to UpdateOnIO during tests. 60 // Makes a direct call to UpdateOnIO during tests.
61 void UpdateOnIOForTesting() { 61 void UpdateOnIOForTesting() {
62 scoped_ptr<base::ListValue> block(new base::ListValue); 62 scoped_ptr<base::ListValue> block(new base::ListValue);
63 block->Append(new base::StringValue("example.com")); 63 block->Append(new base::StringValue("example.com"));
64 scoped_ptr<base::ListValue> allow(new base::ListValue); 64 scoped_ptr<base::ListValue> allow(new base::ListValue);
65 URLBlacklistManager::UpdateOnIO(block.Pass(), allow.Pass()); 65 URLBlacklistManager::UpdateOnIO(block.Pass(), allow.Pass());
66 } 66 }
67 67
68 // URLBlacklistManager overrides: 68 // URLBlacklistManager overrides:
69 virtual void SetBlacklist(scoped_ptr<URLBlacklist> blacklist) OVERRIDE { 69 virtual void SetBlacklist(scoped_ptr<URLBlacklist> blacklist) override {
70 set_blacklist_called_ = true; 70 set_blacklist_called_ = true;
71 URLBlacklistManager::SetBlacklist(blacklist.Pass()); 71 URLBlacklistManager::SetBlacklist(blacklist.Pass());
72 } 72 }
73 73
74 virtual void Update() OVERRIDE { 74 virtual void Update() override {
75 update_called_++; 75 update_called_++;
76 URLBlacklistManager::Update(); 76 URLBlacklistManager::Update();
77 } 77 }
78 78
79 int update_called() const { return update_called_; } 79 int update_called() const { return update_called_; }
80 bool set_blacklist_called() const { return set_blacklist_called_; } 80 bool set_blacklist_called() const { return set_blacklist_called_; }
81 81
82 private: 82 private:
83 int update_called_; 83 int update_called_;
84 bool set_blacklist_called_; 84 bool set_blacklist_called_;
85 85
86 DISALLOW_COPY_AND_ASSIGN(TestingURLBlacklistManager); 86 DISALLOW_COPY_AND_ASSIGN(TestingURLBlacklistManager);
87 }; 87 };
88 88
89 class URLBlacklistManagerTest : public testing::Test { 89 class URLBlacklistManagerTest : public testing::Test {
90 protected: 90 protected:
91 URLBlacklistManagerTest() {} 91 URLBlacklistManagerTest() {}
92 92
93 virtual void SetUp() OVERRIDE { 93 virtual void SetUp() override {
94 pref_service_.registry()->RegisterListPref(policy_prefs::kUrlBlacklist); 94 pref_service_.registry()->RegisterListPref(policy_prefs::kUrlBlacklist);
95 pref_service_.registry()->RegisterListPref(policy_prefs::kUrlWhitelist); 95 pref_service_.registry()->RegisterListPref(policy_prefs::kUrlWhitelist);
96 blacklist_manager_.reset(new TestingURLBlacklistManager(&pref_service_)); 96 blacklist_manager_.reset(new TestingURLBlacklistManager(&pref_service_));
97 loop_.RunUntilIdle(); 97 loop_.RunUntilIdle();
98 } 98 }
99 99
100 virtual void TearDown() OVERRIDE { 100 virtual void TearDown() override {
101 if (blacklist_manager_.get()) 101 if (blacklist_manager_.get())
102 blacklist_manager_->ShutdownOnUIThread(); 102 blacklist_manager_->ShutdownOnUIThread();
103 loop_.RunUntilIdle(); 103 loop_.RunUntilIdle();
104 // Delete |blacklist_manager_| while |io_thread_| is mapping IO to 104 // Delete |blacklist_manager_| while |io_thread_| is mapping IO to
105 // |loop_|. 105 // |loop_|.
106 blacklist_manager_.reset(); 106 blacklist_manager_.reset();
107 } 107 }
108 108
109 base::MessageLoopForIO loop_; 109 base::MessageLoopForIO loop_;
110 TestingPrefServiceSimple pref_service_; 110 TestingPrefServiceSimple pref_service_;
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 blacklist.Allow(allowed.get()); 695 blacklist.Allow(allowed.get());
696 696
697 EXPECT_TRUE(blacklist.IsURLBlocked(GURL("http://www.google.com"))); 697 EXPECT_TRUE(blacklist.IsURLBlocked(GURL("http://www.google.com")));
698 EXPECT_TRUE((blacklist.IsURLBlocked(GURL("chrome-extension://xyz")))); 698 EXPECT_TRUE((blacklist.IsURLBlocked(GURL("chrome-extension://xyz"))));
699 EXPECT_FALSE((blacklist.IsURLBlocked(GURL("chrome-extension://abc")))); 699 EXPECT_FALSE((blacklist.IsURLBlocked(GURL("chrome-extension://abc"))));
700 EXPECT_FALSE((blacklist.IsURLBlocked(GURL("chrome-search://local-ntp")))); 700 EXPECT_FALSE((blacklist.IsURLBlocked(GURL("chrome-search://local-ntp"))));
701 EXPECT_FALSE((blacklist.IsURLBlocked(GURL("chrome-native://ntp")))); 701 EXPECT_FALSE((blacklist.IsURLBlocked(GURL("chrome-native://ntp"))));
702 } 702 }
703 703
704 } // namespace policy 704 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/test/local_policy_test_server.h ('k') | chrome/browser/power/process_power_collector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698