OLD | NEW |
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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "chrome/browser/policy/browser_policy_connector.h" | 9 #include "chrome/browser/policy/browser_policy_connector.h" |
10 #include "chrome/browser/policy/cloud_policy_constants.h" | 10 #include "chrome/browser/policy/cloud_policy_constants.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 local_state_.reset(new TestingPrefServiceSimple); | 93 local_state_.reset(new TestingPrefServiceSimple); |
94 chrome::RegisterLocalState(local_state_->registry()); | 94 chrome::RegisterLocalState(local_state_->registry()); |
95 TestingBrowserProcess::GetGlobal()->SetLocalState( | 95 TestingBrowserProcess::GetGlobal()->SetLocalState( |
96 local_state_.get()); | 96 local_state_.get()); |
97 | 97 |
98 // Create a testing profile with cloud-policy-on-signin enabled, and bring | 98 // Create a testing profile with cloud-policy-on-signin enabled, and bring |
99 // up a UserCloudPolicyManager with a MockUserCloudPolicyStore. | 99 // up a UserCloudPolicyManager with a MockUserCloudPolicyStore. |
100 scoped_ptr<TestingPrefServiceSyncable> prefs( | 100 scoped_ptr<TestingPrefServiceSyncable> prefs( |
101 new TestingPrefServiceSyncable()); | 101 new TestingPrefServiceSyncable()); |
102 Profile::RegisterUserPrefs(prefs->registry()); | |
103 chrome::RegisterUserPrefs(prefs.get(), prefs->registry()); | 102 chrome::RegisterUserPrefs(prefs.get(), prefs->registry()); |
104 TestingProfile::Builder builder; | 103 TestingProfile::Builder builder; |
105 builder.SetPrefService(scoped_ptr<PrefServiceSyncable>(prefs.Pass())); | 104 builder.SetPrefService(scoped_ptr<PrefServiceSyncable>(prefs.Pass())); |
106 profile_ = builder.Build().Pass(); | 105 profile_ = builder.Build().Pass(); |
107 profile_->CreateRequestContext(); | 106 profile_->CreateRequestContext(); |
108 | 107 |
109 mock_store_ = new MockUserCloudPolicyStore(); | 108 mock_store_ = new MockUserCloudPolicyStore(); |
110 EXPECT_CALL(*mock_store_, Load()).Times(AnyNumber()); | 109 EXPECT_CALL(*mock_store_, Load()).Times(AnyNumber()); |
111 manager_.reset(new UserCloudPolicyManager( | 110 manager_.reset(new UserCloudPolicyManager( |
112 profile_.get(), scoped_ptr<UserCloudPolicyStore>(mock_store_))); | 111 profile_.get(), scoped_ptr<UserCloudPolicyStore>(mock_store_))); |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 signin_manager_->ForceSignOut(); | 628 signin_manager_->ForceSignOut(); |
630 ASSERT_FALSE(manager_->core()->service()); | 629 ASSERT_FALSE(manager_->core()->service()); |
631 | 630 |
632 // Now sign in again. | 631 // Now sign in again. |
633 TestSuccessfulSignin(); | 632 TestSuccessfulSignin(); |
634 } | 633 } |
635 | 634 |
636 } // namespace | 635 } // namespace |
637 | 636 |
638 } // namespace policy | 637 } // namespace policy |
OLD | NEW |