| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "base/scoped_temp_dir.h" | 6 #include "base/scoped_temp_dir.h" |
| 7 #include "chrome/browser/browser_thread.h" | 7 #include "chrome/browser/browser_thread.h" |
| 8 #include "chrome/browser/net/gaia/token_service.h" | 8 #include "chrome/browser/net/gaia/token_service.h" |
| 9 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 9 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
| 10 #include "chrome/browser/policy/device_management_policy_provider.h" | 10 #include "chrome/browser/policy/device_management_policy_provider.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 void CreateNewProvider() { | 44 void CreateNewProvider() { |
| 45 provider_.reset(new DeviceManagementPolicyProvider( | 45 provider_.reset(new DeviceManagementPolicyProvider( |
| 46 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(), | 46 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(), |
| 47 backend_, | 47 backend_, |
| 48 storage_dir_.path())); | 48 storage_dir_.path())); |
| 49 loop_.RunAllPending(); | 49 loop_.RunAllPending(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void SimulateSuccessfulLoginAndRunPending() { | 52 void SimulateSuccessfulLoginAndRunPending() { |
| 53 loop_.RunAllPending(); | 53 loop_.RunAllPending(); |
| 54 SimulateSuccessfulLogin(); | 54 SimulateSuccessfulLogin(provider_->token_fetcher_, |
| 55 kTestDasherDomainUsername); |
| 55 loop_.RunAllPending(); | 56 loop_.RunAllPending(); |
| 56 } | 57 } |
| 57 | 58 |
| 58 void SimulateSuccessfulInitialPolicyFetch() { | 59 void SimulateSuccessfulInitialPolicyFetch() { |
| 59 MockConfigurationPolicyStore store; | 60 MockConfigurationPolicyStore store; |
| 60 backend_->AllShouldSucceed(); | 61 backend_->AllShouldSucceed(); |
| 61 EXPECT_CALL(*backend_, ProcessRegisterRequest(_, _, _, _)).Times(1); | 62 EXPECT_CALL(*backend_, ProcessRegisterRequest(_, _, _, _)).Times(1); |
| 62 EXPECT_CALL(*backend_, ProcessPolicyRequest(_, _, _)).Times(1); | 63 EXPECT_CALL(*backend_, ProcessPolicyRequest(_, _, _)).Times(1); |
| 63 SimulateSuccessfulLoginAndRunPending(); | 64 SimulateSuccessfulLoginAndRunPending(); |
| 64 EXPECT_CALL(store, Apply(kPolicyDisableSpdy, _)).Times(1); | 65 EXPECT_CALL(store, Apply(kPolicyDisableSpdy, _)).Times(1); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 NotificationRegistrar registrar; | 139 NotificationRegistrar registrar; |
| 139 registrar.Add(&observer, | 140 registrar.Add(&observer, |
| 140 NotificationType::POLICY_CHANGED, | 141 NotificationType::POLICY_CHANGED, |
| 141 NotificationService::AllSources()); | 142 NotificationService::AllSources()); |
| 142 EXPECT_CALL(observer, | 143 EXPECT_CALL(observer, |
| 143 Observe(_, _, _)).Times(1); | 144 Observe(_, _, _)).Times(1); |
| 144 SimulateSuccessfulInitialPolicyFetch(); | 145 SimulateSuccessfulInitialPolicyFetch(); |
| 145 } | 146 } |
| 146 | 147 |
| 147 } | 148 } |
| OLD | NEW |