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

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

Issue 320253004: Componentize URLFixerUpper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win64 fix Created 6 years, 6 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 | Annotate | Revision Log
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"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/message_loop/message_loop_proxy.h" 12 #include "base/message_loop/message_loop_proxy.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 "chrome/browser/policy/policy_helpers.h" 15 #include "chrome/browser/policy/policy_helpers.h"
16 #include "chrome/common/net/url_fixer_upper.h"
17 #include "components/policy/core/common/policy_pref_names.h" 16 #include "components/policy/core/common/policy_pref_names.h"
17 #include "components/url_fixer/url_fixer.h"
18 #include "google_apis/gaia/gaia_urls.h" 18 #include "google_apis/gaia/gaia_urls.h"
19 #include "net/base/load_flags.h" 19 #include "net/base/load_flags.h"
20 #include "net/base/net_errors.h" 20 #include "net/base/net_errors.h"
21 #include "net/base/request_priority.h" 21 #include "net/base/request_priority.h"
22 #include "net/url_request/url_request.h" 22 #include "net/url_request/url_request.h"
23 #include "net/url_request/url_request_test_util.h" 23 #include "net/url_request/url_request_test_util.h"
24 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
25 #include "url/gurl.h" 25 #include "url/gurl.h"
26 26
27 // TODO(joaodasilva): this file should be moved next to 27 // TODO(joaodasilva): this file should be moved next to
28 // components/policy/core/browser/url_blacklist_manager.(cc|h). 28 // components/policy/core/browser/url_blacklist_manager.(cc|h).
29 // However, url_fixer_upper.h can't be included from the component. Rather 29 // However, url_fixer_upper.h can't be included from the component. Rather
30 // than having it mocked out, the actual URLFixerUpper::SegmentURL call is used 30 // than having it mocked out, the actual url_fixer::SegmentURL call is used
31 // to make sure that the parsing of URL filters is correct. 31 // to make sure that the parsing of URL filters is correct.
32 32
33 namespace policy { 33 namespace policy {
34 34
35 namespace { 35 namespace {
36 36
37 // Helper to get the disambiguated SegmentURL() function. 37 // Helper to get the disambiguated SegmentURL() function.
38 URLBlacklist::SegmentURLCallback GetSegmentURLCallback() { 38 URLBlacklist::SegmentURLCallback GetSegmentURLCallback() {
39 return URLFixerUpper::SegmentURL; 39 return url_fixer::SegmentURL;
40 } 40 }
41 41
42 class TestingURLBlacklistManager : public URLBlacklistManager { 42 class TestingURLBlacklistManager : public URLBlacklistManager {
43 public: 43 public:
44 explicit TestingURLBlacklistManager(PrefService* pref_service) 44 explicit TestingURLBlacklistManager(PrefService* pref_service)
45 : URLBlacklistManager(pref_service, 45 : URLBlacklistManager(pref_service,
46 base::MessageLoopProxy::current(), 46 base::MessageLoopProxy::current(),
47 base::MessageLoopProxy::current(), 47 base::MessageLoopProxy::current(),
48 GetSegmentURLCallback(), 48 GetSegmentURLCallback(),
49 base::Bind(OverrideBlacklistForURL)), 49 base::Bind(OverrideBlacklistForURL)),
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 665
666 GURL sync_url(GaiaUrls::GetInstance()->service_login_url().Resolve( 666 GURL sync_url(GaiaUrls::GetInstance()->service_login_url().Resolve(
667 "?service=chromiumsync")); 667 "?service=chromiumsync"));
668 net::URLRequest sync_request(sync_url, net::DEFAULT_PRIORITY, NULL, &context); 668 net::URLRequest sync_request(sync_url, net::DEFAULT_PRIORITY, NULL, &context);
669 sync_request.SetLoadFlags(net::LOAD_MAIN_FRAME); 669 sync_request.SetLoadFlags(net::LOAD_MAIN_FRAME);
670 EXPECT_EQ(block_signin_urls, 670 EXPECT_EQ(block_signin_urls,
671 blacklist_manager_->IsRequestBlocked(sync_request, &reason)); 671 blacklist_manager_->IsRequestBlocked(sync_request, &reason));
672 } 672 }
673 673
674 } // namespace policy 674 } // 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