| 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/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.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 "chrome/browser/policy/browser_policy_connector.h" | 10 #include "chrome/browser/policy/browser_policy_connector.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 static ProfileKeyedService* Build(Profile* profile) { | 76 static ProfileKeyedService* Build(Profile* profile) { |
| 77 return new SigninManagerFake(profile); | 77 return new SigninManagerFake(profile); |
| 78 } | 78 } |
| 79 }; | 79 }; |
| 80 } // namespace | 80 } // namespace |
| 81 | 81 |
| 82 class UserPolicySigninServiceTest : public testing::Test { | 82 class UserPolicySigninServiceTest : public testing::Test { |
| 83 public: | 83 public: |
| 84 UserPolicySigninServiceTest() | 84 UserPolicySigninServiceTest() |
| 85 : loop_(MessageLoop::TYPE_IO), | 85 : loop_(base::MessageLoop::TYPE_IO), |
| 86 ui_thread_(content::BrowserThread::UI, &loop_), | 86 ui_thread_(content::BrowserThread::UI, &loop_), |
| 87 file_thread_(content::BrowserThread::FILE, &loop_), | 87 file_thread_(content::BrowserThread::FILE, &loop_), |
| 88 io_thread_(content::BrowserThread::IO, &loop_), | 88 io_thread_(content::BrowserThread::IO, &loop_), |
| 89 register_completed_(false) {} | 89 register_completed_(false) {} |
| 90 | 90 |
| 91 MOCK_METHOD1(OnPolicyRefresh, void(bool)); | 91 MOCK_METHOD1(OnPolicyRefresh, void(bool)); |
| 92 void OnRegisterCompleted(scoped_ptr<CloudPolicyClient> client) { | 92 void OnRegisterCompleted(scoped_ptr<CloudPolicyClient> client) { |
| 93 register_completed_ = true; | 93 register_completed_ = true; |
| 94 created_client_.swap(client); | 94 created_client_.swap(client); |
| 95 } | 95 } |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 } | 256 } |
| 257 | 257 |
| 258 scoped_ptr<TestingProfile> profile_; | 258 scoped_ptr<TestingProfile> profile_; |
| 259 // Weak pointer to a MockUserCloudPolicyStore - lifetime is managed by the | 259 // Weak pointer to a MockUserCloudPolicyStore - lifetime is managed by the |
| 260 // UserCloudPolicyManager. | 260 // UserCloudPolicyManager. |
| 261 MockUserCloudPolicyStore* mock_store_; | 261 MockUserCloudPolicyStore* mock_store_; |
| 262 scoped_ptr<UserCloudPolicyManager> manager_; | 262 scoped_ptr<UserCloudPolicyManager> manager_; |
| 263 | 263 |
| 264 // BrowserPolicyConnector and UrlFetcherFactory want to initialize and free | 264 // BrowserPolicyConnector and UrlFetcherFactory want to initialize and free |
| 265 // various components asynchronously via tasks, so create fake threads here. | 265 // various components asynchronously via tasks, so create fake threads here. |
| 266 MessageLoop loop_; | 266 base::MessageLoop loop_; |
| 267 content::TestBrowserThread ui_thread_; | 267 content::TestBrowserThread ui_thread_; |
| 268 content::TestBrowserThread file_thread_; | 268 content::TestBrowserThread file_thread_; |
| 269 content::TestBrowserThread io_thread_; | 269 content::TestBrowserThread io_thread_; |
| 270 | 270 |
| 271 net::TestURLFetcherFactory url_factory_; | 271 net::TestURLFetcherFactory url_factory_; |
| 272 | 272 |
| 273 SigninManagerFake* signin_manager_; | 273 SigninManagerFake* signin_manager_; |
| 274 | 274 |
| 275 // Used in conjunction with OnRegisterCompleted() to test client registration | 275 // Used in conjunction with OnRegisterCompleted() to test client registration |
| 276 // callbacks. | 276 // callbacks. |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 fetch_request->SendResponse(DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED, | 701 fetch_request->SendResponse(DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED, |
| 702 em::DeviceManagementResponse()); | 702 em::DeviceManagementResponse()); |
| 703 base::RunLoop().RunUntilIdle(); | 703 base::RunLoop().RunUntilIdle(); |
| 704 EXPECT_FALSE(manager_->IsClientRegistered()); | 704 EXPECT_FALSE(manager_->IsClientRegistered()); |
| 705 EXPECT_FALSE(signin_manager_->IsSignoutProhibited()); | 705 EXPECT_FALSE(signin_manager_->IsSignoutProhibited()); |
| 706 } | 706 } |
| 707 | 707 |
| 708 } // namespace | 708 } // namespace |
| 709 | 709 |
| 710 } // namespace policy | 710 } // namespace policy |
| OLD | NEW |