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

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

Issue 1171333003: Move net::FormatUrl and friends outside of //net and into //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again now that CQ is fixed Created 5 years, 4 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/bind.h" 10 #include "base/bind.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/prefs/pref_registry_simple.h" 13 #include "base/prefs/pref_registry_simple.h"
14 #include "base/prefs/testing_pref_service.h" 14 #include "base/prefs/testing_pref_service.h"
15 #include "base/thread_task_runner_handle.h" 15 #include "base/thread_task_runner_handle.h"
16 #include "chrome/browser/policy/policy_helpers.h" 16 #include "chrome/browser/policy/policy_helpers.h"
17 #include "components/policy/core/common/policy_pref_names.h" 17 #include "components/policy/core/common/policy_pref_names.h"
18 #include "components/url_fixer/url_fixer.h" 18 #include "components/url_formatter/url_fixer.h"
19 #include "google_apis/gaia/gaia_urls.h" 19 #include "google_apis/gaia/gaia_urls.h"
20 #include "net/base/load_flags.h" 20 #include "net/base/load_flags.h"
21 #include "net/base/net_errors.h" 21 #include "net/base/net_errors.h"
22 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
23 #include "url/gurl.h" 23 #include "url/gurl.h"
24 24
25 // TODO(joaodasilva): this file should be moved next to 25 // TODO(joaodasilva): this file should be moved next to
26 // components/policy/core/browser/url_blacklist_manager.(cc|h). 26 // components/policy/core/browser/url_blacklist_manager.(cc|h).
27 // However, url_fixer_upper.h can't be included from the component. Rather 27 // However, url_fixer_upper.h can't be included from the component. Rather
28 // than having it mocked out, the actual url_fixer::SegmentURL call is used 28 // than having it mocked out, the actual url_formatter::SegmentURL call is used
29 // to make sure that the parsing of URL filters is correct. 29 // to make sure that the parsing of URL filters is correct.
30 30
31 namespace policy { 31 namespace policy {
32 32
33 namespace { 33 namespace {
34 34
35 // Helper to get the disambiguated SegmentURL() function. 35 // Helper to get the disambiguated SegmentURL() function.
36 URLBlacklist::SegmentURLCallback GetSegmentURLCallback() { 36 URLBlacklist::SegmentURLCallback GetSegmentURLCallback() {
37 return url_fixer::SegmentURL; 37 return url_formatter::SegmentURL;
38 } 38 }
39 39
40 class TestingURLBlacklistManager : public URLBlacklistManager { 40 class TestingURLBlacklistManager : public URLBlacklistManager {
41 public: 41 public:
42 explicit TestingURLBlacklistManager(PrefService* pref_service) 42 explicit TestingURLBlacklistManager(PrefService* pref_service)
43 : URLBlacklistManager(pref_service, 43 : URLBlacklistManager(pref_service,
44 base::ThreadTaskRunnerHandle::Get(), 44 base::ThreadTaskRunnerHandle::Get(),
45 base::ThreadTaskRunnerHandle::Get(), 45 base::ThreadTaskRunnerHandle::Get(),
46 GetSegmentURLCallback(), 46 GetSegmentURLCallback(),
47 base::Bind(OverrideBlacklistForURL)), 47 base::Bind(OverrideBlacklistForURL)),
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 blacklist.Allow(allowed.get()); 667 blacklist.Allow(allowed.get());
668 668
669 EXPECT_TRUE(blacklist.IsURLBlocked(GURL("http://www.google.com"))); 669 EXPECT_TRUE(blacklist.IsURLBlocked(GURL("http://www.google.com")));
670 EXPECT_TRUE((blacklist.IsURLBlocked(GURL("chrome-extension://xyz")))); 670 EXPECT_TRUE((blacklist.IsURLBlocked(GURL("chrome-extension://xyz"))));
671 EXPECT_FALSE((blacklist.IsURLBlocked(GURL("chrome-extension://abc")))); 671 EXPECT_FALSE((blacklist.IsURLBlocked(GURL("chrome-extension://abc"))));
672 EXPECT_FALSE((blacklist.IsURLBlocked(GURL("chrome-search://local-ntp")))); 672 EXPECT_FALSE((blacklist.IsURLBlocked(GURL("chrome-search://local-ntp"))));
673 EXPECT_FALSE((blacklist.IsURLBlocked(GURL("chrome-native://ntp")))); 673 EXPECT_FALSE((blacklist.IsURLBlocked(GURL("chrome-native://ntp"))));
674 } 674 }
675 675
676 } // namespace policy 676 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/managed_bookmarks_policy_handler.cc ('k') | chrome/browser/prefs/session_startup_pref.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698