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

Side by Side Diff: chrome/browser/privacy_blacklist/blacklist_manager_browsertest.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "chrome/browser/browser.h" 9 #include "chrome/browser/browser.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 10 matching lines...) Expand all
21 #include "net/base/mock_host_resolver.h" 21 #include "net/base/mock_host_resolver.h"
22 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
23 23
24 namespace { 24 namespace {
25 25
26 void GetBlacklistHasMatchOnIOThread(const BlacklistManager* manager, 26 void GetBlacklistHasMatchOnIOThread(const BlacklistManager* manager,
27 const GURL& url, 27 const GURL& url,
28 bool *has_match) { 28 bool *has_match) {
29 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); 29 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
30 const Blacklist* blacklist = manager->GetCompiledBlacklist(); 30 const Blacklist* blacklist = manager->GetCompiledBlacklist();
31 scoped_ptr<Blacklist::Match> match(blacklist->findMatch(url)); 31 scoped_ptr<Blacklist::Match> match(blacklist->FindMatch(url));
32 *has_match = (match.get() != NULL); 32 *has_match = (match.get() != NULL);
33 ChromeThread::PostTask(ChromeThread::UI, FROM_HERE, 33 ChromeThread::PostTask(ChromeThread::UI, FROM_HERE,
34 new MessageLoop::QuitTask()); 34 new MessageLoop::QuitTask());
35 } 35 }
36 36
37 } // namespace 37 } // namespace
38 38
39 class BlacklistManagerBrowserTest : public ExtensionBrowserTest { 39 class BlacklistManagerBrowserTest : public ExtensionBrowserTest {
40 public: 40 public:
41 virtual void SetUp() { 41 virtual void SetUp() {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 test_data_dir_.AppendASCII("common").AppendASCII("privacy_blacklist"))); 75 test_data_dir_.AppendASCII("common").AppendASCII("privacy_blacklist")));
76 76
77 // Navigate to a blacklisted URL. The request should be blocked. 77 // Navigate to a blacklisted URL. The request should be blocked.
78 ui_test_utils::NavigateToURL(browser(), GURL(kTestUrl)); 78 ui_test_utils::NavigateToURL(browser(), GURL(kTestUrl));
79 string16 expected_title(l10n_util::GetStringUTF16(IDS_BLACKLIST_TITLE)); 79 string16 expected_title(l10n_util::GetStringUTF16(IDS_BLACKLIST_TITLE));
80 string16 tab_title; 80 string16 tab_title;
81 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &tab_title)); 81 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &tab_title));
82 EXPECT_EQ(expected_title, tab_title); 82 EXPECT_EQ(expected_title, tab_title);
83 EXPECT_TRUE(BlacklistHasMatch(kTestUrl)); 83 EXPECT_TRUE(BlacklistHasMatch(kTestUrl));
84 } 84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698