OLD | NEW |
1 // Copyright (c) 2009 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" |
11 #include "chrome/browser/extensions/extension_browsertest.h" | 11 #include "chrome/browser/extensions/extension_browsertest.h" |
12 #include "chrome/browser/extensions/extensions_service.h" | 12 #include "chrome/browser/extensions/extensions_service.h" |
13 #include "chrome/browser/privacy_blacklist/blacklist.h" | 13 #include "chrome/browser/privacy_blacklist/blacklist.h" |
14 #include "chrome/browser/privacy_blacklist/blacklist_manager.h" | 14 #include "chrome/browser/privacy_blacklist/blacklist_manager.h" |
15 #include "chrome/browser/profile.h" | 15 #include "chrome/browser/profile.h" |
16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/test/in_process_browser_test.h" | 17 #include "chrome/test/in_process_browser_test.h" |
18 #include "chrome/test/ui_test_utils.h" | 18 #include "chrome/test/ui_test_utils.h" |
19 #include "grit/browser_resources.h" | 19 #include "grit/browser_resources.h" |
20 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
| 21 #include "net/base/mock_host_resolver.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
22 | 23 |
23 namespace { | 24 namespace { |
24 | 25 |
25 void GetBlacklistHasMatchOnIOThread(const BlacklistManager* manager, | 26 void GetBlacklistHasMatchOnIOThread(const BlacklistManager* manager, |
26 const GURL& url, | 27 const GURL& url, |
27 bool *has_match) { | 28 bool *has_match) { |
28 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); | 29 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); |
29 const Blacklist* blacklist = manager->GetCompiledBlacklist(); | 30 const Blacklist* blacklist = manager->GetCompiledBlacklist(); |
30 scoped_ptr<Blacklist::Match> match(blacklist->findMatch(url)); | 31 scoped_ptr<Blacklist::Match> match(blacklist->findMatch(url)); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 test_data_dir_.AppendASCII("common").AppendASCII("privacy_blacklist"))); | 75 test_data_dir_.AppendASCII("common").AppendASCII("privacy_blacklist"))); |
75 | 76 |
76 // Navigate to a blacklisted URL. The request should be blocked. | 77 // Navigate to a blacklisted URL. The request should be blocked. |
77 ui_test_utils::NavigateToURL(browser(), GURL(kTestUrl)); | 78 ui_test_utils::NavigateToURL(browser(), GURL(kTestUrl)); |
78 string16 expected_title(l10n_util::GetStringUTF16(IDS_BLACKLIST_TITLE)); | 79 string16 expected_title(l10n_util::GetStringUTF16(IDS_BLACKLIST_TITLE)); |
79 string16 tab_title; | 80 string16 tab_title; |
80 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &tab_title)); | 81 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &tab_title)); |
81 EXPECT_EQ(expected_title, tab_title); | 82 EXPECT_EQ(expected_title, tab_title); |
82 EXPECT_TRUE(BlacklistHasMatch(kTestUrl)); | 83 EXPECT_TRUE(BlacklistHasMatch(kTestUrl)); |
83 } | 84 } |
OLD | NEW |