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

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

Issue 209473008: Block all web requests until force enrollment status has been confirmed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Created 6 years, 9 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
« no previous file with comments | « chrome/browser/policy/policy_helpers.cc ('k') | chrome/browser/profiles/profile_io_data.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
11 #include "base/message_loop/message_loop_proxy.h" 12 #include "base/message_loop/message_loop_proxy.h"
12 #include "base/prefs/pref_registry_simple.h" 13 #include "base/prefs/pref_registry_simple.h"
13 #include "base/prefs/testing_pref_service.h" 14 #include "base/prefs/testing_pref_service.h"
14 #include "chrome/browser/policy/policy_helpers.h" 15 #include "chrome/browser/policy/policy_helpers.h"
15 #include "chrome/common/net/url_fixer_upper.h" 16 #include "chrome/common/net/url_fixer_upper.h"
16 #include "components/policy/core/common/policy_pref_names.h" 17 #include "components/policy/core/common/policy_pref_names.h"
17 #include "google_apis/gaia/gaia_urls.h" 18 #include "google_apis/gaia/gaia_urls.h"
18 #include "net/base/request_priority.h" 19 #include "net/base/request_priority.h"
19 #include "net/url_request/url_request.h" 20 #include "net/url_request/url_request.h"
(...skipping 16 matching lines...) Expand all
36 return URLFixerUpper::SegmentURL; 37 return URLFixerUpper::SegmentURL;
37 } 38 }
38 39
39 class TestingURLBlacklistManager : public URLBlacklistManager { 40 class TestingURLBlacklistManager : public URLBlacklistManager {
40 public: 41 public:
41 explicit TestingURLBlacklistManager(PrefService* pref_service) 42 explicit TestingURLBlacklistManager(PrefService* pref_service)
42 : URLBlacklistManager(pref_service, 43 : URLBlacklistManager(pref_service,
43 base::MessageLoopProxy::current(), 44 base::MessageLoopProxy::current(),
44 base::MessageLoopProxy::current(), 45 base::MessageLoopProxy::current(),
45 GetSegmentURLCallback(), 46 GetSegmentURLCallback(),
46 OverrideBlacklistForURL), 47 base::Bind(OverrideBlacklistForURL)),
47 update_called_(0), 48 update_called_(0),
48 set_blacklist_called_(false) {} 49 set_blacklist_called_(false) {}
49 50
50 virtual ~TestingURLBlacklistManager() { 51 virtual ~TestingURLBlacklistManager() {
51 } 52 }
52 53
53 // Make this method public for testing. 54 // Make this method public for testing.
54 using URLBlacklistManager::ScheduleUpdate; 55 using URLBlacklistManager::ScheduleUpdate;
55 56
56 // Makes a direct call to UpdateOnIO during tests. 57 // Makes a direct call to UpdateOnIO during tests.
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 520
520 GURL sync_url(GaiaUrls::GetInstance()->service_login_url().Resolve( 521 GURL sync_url(GaiaUrls::GetInstance()->service_login_url().Resolve(
521 "?service=chromiumsync")); 522 "?service=chromiumsync"));
522 net::URLRequest sync_request(sync_url, net::DEFAULT_PRIORITY, NULL, &context); 523 net::URLRequest sync_request(sync_url, net::DEFAULT_PRIORITY, NULL, &context);
523 sync_request.SetLoadFlags(net::LOAD_MAIN_FRAME); 524 sync_request.SetLoadFlags(net::LOAD_MAIN_FRAME);
524 EXPECT_EQ(block_signin_urls, 525 EXPECT_EQ(block_signin_urls,
525 blacklist_manager_->IsRequestBlocked(sync_request)); 526 blacklist_manager_->IsRequestBlocked(sync_request));
526 } 527 }
527 528
528 } // namespace policy 529 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_helpers.cc ('k') | chrome/browser/profiles/profile_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698