| 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/files/file_path.h" | 5 #include "base/files/file_path.h" |
| 6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 7 #include "base/message_loop/message_loop_proxy.h" | 7 #include "base/message_loop/message_loop_proxy.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 service->RegisterForPolicy( | 144 service->RegisterForPolicy( |
| 145 kTestUser, | 145 kTestUser, |
| 146 #if !defined(OS_ANDROID) | 146 #if !defined(OS_ANDROID) |
| 147 "mock_oauth_token", | 147 "mock_oauth_token", |
| 148 #endif | 148 #endif |
| 149 base::Bind(&UserPolicySigninServiceTest::OnRegisterCompleted, | 149 base::Bind(&UserPolicySigninServiceTest::OnRegisterCompleted, |
| 150 base::Unretained(this))); | 150 base::Unretained(this))); |
| 151 ASSERT_TRUE(IsRequestActive()); | 151 ASSERT_TRUE(IsRequestActive()); |
| 152 } | 152 } |
| 153 | 153 |
| 154 virtual void SetUp() override { | 154 void SetUp() override { |
| 155 UserPolicySigninServiceFactory::SetDeviceManagementServiceForTesting( | 155 UserPolicySigninServiceFactory::SetDeviceManagementServiceForTesting( |
| 156 &device_management_service_); | 156 &device_management_service_); |
| 157 | 157 |
| 158 local_state_.reset(new TestingPrefServiceSimple); | 158 local_state_.reset(new TestingPrefServiceSimple); |
| 159 chrome::RegisterLocalState(local_state_->registry()); | 159 chrome::RegisterLocalState(local_state_->registry()); |
| 160 system_request_context_getter_ = new net::TestURLRequestContextGetter( | 160 system_request_context_getter_ = new net::TestURLRequestContextGetter( |
| 161 base::MessageLoopProxy::current()); | 161 base::MessageLoopProxy::current()); |
| 162 TestingBrowserProcess::GetGlobal()->SetSystemRequestContext( | 162 TestingBrowserProcess::GetGlobal()->SetSystemRequestContext( |
| 163 system_request_context_getter_.get()); | 163 system_request_context_getter_.get()); |
| 164 TestingBrowserProcess::GetGlobal()->SetLocalState(local_state_.get()); | 164 TestingBrowserProcess::GetGlobal()->SetLocalState(local_state_.get()); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 profile_.get())); | 201 profile_.get())); |
| 202 manager_->Init(&schema_registry_); | 202 manager_->Init(&schema_registry_); |
| 203 mock_store_ = static_cast<MockUserCloudPolicyStore*>( | 203 mock_store_ = static_cast<MockUserCloudPolicyStore*>( |
| 204 manager_->core()->store()); | 204 manager_->core()->store()); |
| 205 DCHECK(mock_store_); | 205 DCHECK(mock_store_); |
| 206 AddProfile(); | 206 AddProfile(); |
| 207 | 207 |
| 208 Mock::VerifyAndClearExpectations(mock_store_); | 208 Mock::VerifyAndClearExpectations(mock_store_); |
| 209 } | 209 } |
| 210 | 210 |
| 211 virtual void TearDown() override { | 211 void TearDown() override { |
| 212 UserPolicySigninServiceFactory::SetDeviceManagementServiceForTesting(NULL); | 212 UserPolicySigninServiceFactory::SetDeviceManagementServiceForTesting(NULL); |
| 213 UserCloudPolicyManagerFactory::GetInstance()->ClearTestingFactory(); | 213 UserCloudPolicyManagerFactory::GetInstance()->ClearTestingFactory(); |
| 214 // Free the profile before we clear out the browser prefs. | 214 // Free the profile before we clear out the browser prefs. |
| 215 profile_.reset(); | 215 profile_.reset(); |
| 216 TestingBrowserProcess* testing_browser_process = | 216 TestingBrowserProcess* testing_browser_process = |
| 217 TestingBrowserProcess::GetGlobal(); | 217 TestingBrowserProcess::GetGlobal(); |
| 218 testing_browser_process->SetLocalState(NULL); | 218 testing_browser_process->SetLocalState(NULL); |
| 219 local_state_.reset(); | 219 local_state_.reset(); |
| 220 testing_browser_process->SetBrowserPolicyConnector(NULL); | 220 testing_browser_process->SetBrowserPolicyConnector(NULL); |
| 221 base::RunLoop run_loop; | 221 base::RunLoop run_loop; |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 base::RunLoop().RunUntilIdle(); | 831 base::RunLoop().RunUntilIdle(); |
| 832 EXPECT_FALSE(manager_->IsClientRegistered()); | 832 EXPECT_FALSE(manager_->IsClientRegistered()); |
| 833 #if !defined(OS_ANDROID) | 833 #if !defined(OS_ANDROID) |
| 834 EXPECT_FALSE(signin_manager_->IsSignoutProhibited()); | 834 EXPECT_FALSE(signin_manager_->IsSignoutProhibited()); |
| 835 #endif | 835 #endif |
| 836 } | 836 } |
| 837 | 837 |
| 838 } // namespace | 838 } // namespace |
| 839 | 839 |
| 840 } // namespace policy | 840 } // namespace policy |
| OLD | NEW |