Chromium Code Reviews| 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" |
|
pneubeck (no reviews)
2015/04/30 08:00:08
also not required anymore? (I can't find any refer
Pranay
2015/05/04 03:26:59
Done.
| |
| 7 #include "base/message_loop/message_loop_proxy.h" | |
| 8 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 9 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/thread_task_runner_handle.h" | |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
| 13 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 13 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
| 14 #include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h" | 14 #include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h" |
| 15 #include "chrome/browser/prefs/browser_prefs.h" | 15 #include "chrome/browser/prefs/browser_prefs.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/signin/account_tracker_service_factory.h" | 17 #include "chrome/browser/signin/account_tracker_service_factory.h" |
| 18 #include "chrome/browser/signin/chrome_signin_client_factory.h" | 18 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
| 19 #include "chrome/browser/signin/fake_account_tracker_service.h" | 19 #include "chrome/browser/signin/fake_account_tracker_service.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 | 103 |
| 104 UserCloudPolicyManager* BuildCloudPolicyManager( | 104 UserCloudPolicyManager* BuildCloudPolicyManager( |
| 105 content::BrowserContext* context) { | 105 content::BrowserContext* context) { |
| 106 MockUserCloudPolicyStore* store = new MockUserCloudPolicyStore(); | 106 MockUserCloudPolicyStore* store = new MockUserCloudPolicyStore(); |
| 107 EXPECT_CALL(*store, Load()).Times(AnyNumber()); | 107 EXPECT_CALL(*store, Load()).Times(AnyNumber()); |
| 108 | 108 |
| 109 return new UserCloudPolicyManager( | 109 return new UserCloudPolicyManager( |
| 110 scoped_ptr<UserCloudPolicyStore>(store), | 110 scoped_ptr<UserCloudPolicyStore>(store), |
| 111 base::FilePath(), | 111 base::FilePath(), |
| 112 scoped_ptr<CloudExternalDataManager>(), | 112 scoped_ptr<CloudExternalDataManager>(), |
| 113 base::MessageLoopProxy::current(), | 113 base::ThreadTaskRunnerHandle::Get(), |
| 114 base::MessageLoopProxy::current(), | 114 base::ThreadTaskRunnerHandle::Get(), |
| 115 base::MessageLoopProxy::current()); | 115 base::ThreadTaskRunnerHandle::Get()); |
| 116 } | 116 } |
| 117 | 117 |
| 118 class UserPolicySigninServiceTest : public testing::Test { | 118 class UserPolicySigninServiceTest : public testing::Test { |
| 119 public: | 119 public: |
| 120 UserPolicySigninServiceTest() | 120 UserPolicySigninServiceTest() |
| 121 : mock_store_(NULL), | 121 : mock_store_(NULL), |
| 122 thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), | 122 thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), |
| 123 register_completed_(false) {} | 123 register_completed_(false) {} |
| 124 | 124 |
| 125 MOCK_METHOD1(OnPolicyRefresh, void(bool)); | 125 MOCK_METHOD1(OnPolicyRefresh, void(bool)); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 151 ASSERT_TRUE(IsRequestActive()); | 151 ASSERT_TRUE(IsRequestActive()); |
| 152 } | 152 } |
| 153 | 153 |
| 154 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::ThreadTaskRunnerHandle::Get()); |
| 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()); |
| 165 | 165 |
| 166 g_browser_process->browser_policy_connector()->Init( | 166 g_browser_process->browser_policy_connector()->Init( |
| 167 local_state_.get(), system_request_context_getter_); | 167 local_state_.get(), system_request_context_getter_); |
| 168 | 168 |
| 169 // Create a testing profile with cloud-policy-on-signin enabled, and bring | 169 // Create a testing profile with cloud-policy-on-signin enabled, and bring |
| 170 // up a UserCloudPolicyManager with a MockUserCloudPolicyStore. | 170 // up a UserCloudPolicyManager with a MockUserCloudPolicyStore. |
| 171 scoped_ptr<TestingPrefServiceSyncable> prefs( | 171 scoped_ptr<TestingPrefServiceSyncable> prefs( |
| (...skipping 659 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 |