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

Side by Side Diff: chrome/browser/privacy_blacklist/blacklist_manager_unittest.cc

Issue 523137: Also match against the query string if present. (Closed)
Patch Set: updates Created 10 years, 11 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/privacy_blacklist/blacklist_manager.h" 5 #include "chrome/browser/privacy_blacklist/blacklist_manager.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/thread.h" 9 #include "base/thread.h"
10 #include "chrome/browser/privacy_blacklist/blacklist.h" 10 #include "chrome/browser/privacy_blacklist/blacklist.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 private: 71 private:
72 MessageLoop loop_; 72 MessageLoop loop_;
73 73
74 ChromeThread mock_ui_thread_; 74 ChromeThread mock_ui_thread_;
75 ChromeThread mock_file_thread_; 75 ChromeThread mock_file_thread_;
76 ChromeThread mock_io_thread_; 76 ChromeThread mock_io_thread_;
77 }; 77 };
78 78
79 // Returns true if |blacklist| contains a match for |url|. 79 // Returns true if |blacklist| contains a match for |url|.
80 bool BlacklistHasMatch(const Blacklist* blacklist, const char* url) { 80 bool BlacklistHasMatch(const Blacklist* blacklist, const char* url) {
81 Blacklist::Match* match = blacklist->findMatch(GURL(url)); 81 Blacklist::Match* match = blacklist->FindMatch(GURL(url));
82 82
83 if (!match) 83 if (!match)
84 return false; 84 return false;
85 85
86 delete match; 86 delete match;
87 return true; 87 return true;
88 } 88 }
89 89
90 TEST_F(BlacklistManagerTest, Basic) { 90 TEST_F(BlacklistManagerTest, Basic) {
91 scoped_refptr<BlacklistManager> manager( 91 scoped_refptr<BlacklistManager> manager(
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 WaitForBlacklistUpdate(); 190 WaitForBlacklistUpdate();
191 191
192 // The manager should recompile the blacklist. 192 // The manager should recompile the blacklist.
193 const Blacklist* blacklist = manager->GetCompiledBlacklist(); 193 const Blacklist* blacklist = manager->GetCompiledBlacklist();
194 EXPECT_TRUE(BlacklistHasMatch(blacklist, 194 EXPECT_TRUE(BlacklistHasMatch(blacklist,
195 "http://host/annoying_ads/ad.jpg")); 195 "http://host/annoying_ads/ad.jpg"));
196 } 196 }
197 } 197 }
198 198
199 } // namespace 199 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698