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

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

Issue 660123003: Standardize usage of virtual/override/final in chrome/browser/policy/ (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
« no previous file with comments | « chrome/browser/policy/test/local_policy_test_server.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 public: 44 public:
45 explicit TestingURLBlacklistManager(PrefService* pref_service) 45 explicit TestingURLBlacklistManager(PrefService* pref_service)
46 : URLBlacklistManager(pref_service, 46 : URLBlacklistManager(pref_service,
47 base::MessageLoopProxy::current(), 47 base::MessageLoopProxy::current(),
48 base::MessageLoopProxy::current(), 48 base::MessageLoopProxy::current(),
49 GetSegmentURLCallback(), 49 GetSegmentURLCallback(),
50 base::Bind(OverrideBlacklistForURL)), 50 base::Bind(OverrideBlacklistForURL)),
51 update_called_(0), 51 update_called_(0),
52 set_blacklist_called_(false) {} 52 set_blacklist_called_(false) {}
53 53
54 virtual ~TestingURLBlacklistManager() { 54 ~TestingURLBlacklistManager() override {}
55 }
56 55
57 // Make this method public for testing. 56 // Make this method public for testing.
58 using URLBlacklistManager::ScheduleUpdate; 57 using URLBlacklistManager::ScheduleUpdate;
59 58
60 // Makes a direct call to UpdateOnIO during tests. 59 // Makes a direct call to UpdateOnIO during tests.
61 void UpdateOnIOForTesting() { 60 void UpdateOnIOForTesting() {
62 scoped_ptr<base::ListValue> block(new base::ListValue); 61 scoped_ptr<base::ListValue> block(new base::ListValue);
63 block->Append(new base::StringValue("example.com")); 62 block->Append(new base::StringValue("example.com"));
64 scoped_ptr<base::ListValue> allow(new base::ListValue); 63 scoped_ptr<base::ListValue> allow(new base::ListValue);
65 URLBlacklistManager::UpdateOnIO(block.Pass(), allow.Pass()); 64 URLBlacklistManager::UpdateOnIO(block.Pass(), allow.Pass());
66 } 65 }
67 66
68 // URLBlacklistManager overrides: 67 // URLBlacklistManager overrides:
69 virtual void SetBlacklist(scoped_ptr<URLBlacklist> blacklist) override { 68 void SetBlacklist(scoped_ptr<URLBlacklist> blacklist) override {
70 set_blacklist_called_ = true; 69 set_blacklist_called_ = true;
71 URLBlacklistManager::SetBlacklist(blacklist.Pass()); 70 URLBlacklistManager::SetBlacklist(blacklist.Pass());
72 } 71 }
73 72
74 virtual void Update() override { 73 void Update() override {
75 update_called_++; 74 update_called_++;
76 URLBlacklistManager::Update(); 75 URLBlacklistManager::Update();
77 } 76 }
78 77
79 int update_called() const { return update_called_; } 78 int update_called() const { return update_called_; }
80 bool set_blacklist_called() const { return set_blacklist_called_; } 79 bool set_blacklist_called() const { return set_blacklist_called_; }
81 80
82 private: 81 private:
83 int update_called_; 82 int update_called_;
84 bool set_blacklist_called_; 83 bool set_blacklist_called_;
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 blacklist.Allow(allowed.get()); 694 blacklist.Allow(allowed.get());
696 695
697 EXPECT_TRUE(blacklist.IsURLBlocked(GURL("http://www.google.com"))); 696 EXPECT_TRUE(blacklist.IsURLBlocked(GURL("http://www.google.com")));
698 EXPECT_TRUE((blacklist.IsURLBlocked(GURL("chrome-extension://xyz")))); 697 EXPECT_TRUE((blacklist.IsURLBlocked(GURL("chrome-extension://xyz"))));
699 EXPECT_FALSE((blacklist.IsURLBlocked(GURL("chrome-extension://abc")))); 698 EXPECT_FALSE((blacklist.IsURLBlocked(GURL("chrome-extension://abc"))));
700 EXPECT_FALSE((blacklist.IsURLBlocked(GURL("chrome-search://local-ntp")))); 699 EXPECT_FALSE((blacklist.IsURLBlocked(GURL("chrome-search://local-ntp"))));
701 EXPECT_FALSE((blacklist.IsURLBlocked(GURL("chrome-native://ntp")))); 700 EXPECT_FALSE((blacklist.IsURLBlocked(GURL("chrome-native://ntp"))));
702 } 701 }
703 702
704 } // namespace policy 703 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/test/local_policy_test_server.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698