Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/chromeos/policy/cloud_external_data_policy_observer.h" | 5 #include "chrome/browser/chromeos/policy/cloud_external_data_policy_observer.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 12 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/message_loop/message_loop_proxy.h" | 15 #include "base/message_loop/message_loop_proxy.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "base/run_loop.h" | 17 #include "base/run_loop.h" |
| 18 #include "base/values.h" | 18 #include "base/values.h" |
| 19 #include "chrome/browser/chrome_notification_types.h" | 19 #include "chrome/browser/chrome_notification_types.h" |
| 20 #include "chrome/browser/chromeos/policy/affiliated_invalidation_service_provide r.h" | |
| 20 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base_test_u til.h" | 21 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base_test_u til.h" |
| 21 #include "chrome/browser/chromeos/policy/device_local_account.h" | 22 #include "chrome/browser/chromeos/policy/device_local_account.h" |
| 22 #include "chrome/browser/chromeos/policy/device_local_account_external_data_mana ger.h" | 23 #include "chrome/browser/chromeos/policy/device_local_account_external_data_mana ger.h" |
| 23 #include "chrome/browser/chromeos/policy/device_local_account_policy_provider.h" | 24 #include "chrome/browser/chromeos/policy/device_local_account_policy_provider.h" |
| 24 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" | 25 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
| 25 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" | 26 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
| 26 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 27 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 27 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 28 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 28 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" | 29 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" |
| 29 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 const std::string device_local_account_user_id_; | 134 const std::string device_local_account_user_id_; |
| 134 | 135 |
| 135 std::string avatar_policy_1_data_; | 136 std::string avatar_policy_1_data_; |
| 136 std::string avatar_policy_2_data_; | 137 std::string avatar_policy_2_data_; |
| 137 std::string avatar_policy_1_; | 138 std::string avatar_policy_1_; |
| 138 std::string avatar_policy_2_; | 139 std::string avatar_policy_2_; |
| 139 | 140 |
| 140 chromeos::CrosSettings cros_settings_; | 141 chromeos::CrosSettings cros_settings_; |
| 141 scoped_ptr<DeviceLocalAccountPolicyService> | 142 scoped_ptr<DeviceLocalAccountPolicyService> |
| 142 device_local_account_policy_service_; | 143 device_local_account_policy_service_; |
| 144 scoped_ptr<AffiliatedInvalidationServiceProvider> | |
| 145 affiliated_invalidation_service_provider_; | |
| 143 net::TestURLFetcherFactory url_fetcher_factory_; | 146 net::TestURLFetcherFactory url_fetcher_factory_; |
| 144 | 147 |
| 145 scoped_ptr<DeviceLocalAccountPolicyProvider> | 148 scoped_ptr<DeviceLocalAccountPolicyProvider> |
| 146 device_local_account_policy_provider_; | 149 device_local_account_policy_provider_; |
| 147 | 150 |
| 148 MockCloudExternalDataManager external_data_manager_; | 151 MockCloudExternalDataManager external_data_manager_; |
| 149 MockConfigurationPolicyProvider user_policy_provider_; | 152 MockConfigurationPolicyProvider user_policy_provider_; |
| 150 | 153 |
| 151 scoped_ptr<TestingProfile> profile_; | 154 scoped_ptr<TestingProfile> profile_; |
| 152 | 155 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 170 DeviceLocalAccount::TYPE_PUBLIC_SESSION)), | 173 DeviceLocalAccount::TYPE_PUBLIC_SESSION)), |
| 171 cros_settings_(&device_settings_service_), | 174 cros_settings_(&device_settings_service_), |
| 172 profile_manager_(TestingBrowserProcess::GetGlobal()) { | 175 profile_manager_(TestingBrowserProcess::GetGlobal()) { |
| 173 } | 176 } |
| 174 | 177 |
| 175 CloudExternalDataPolicyObserverTest::~CloudExternalDataPolicyObserverTest() { | 178 CloudExternalDataPolicyObserverTest::~CloudExternalDataPolicyObserverTest() { |
| 176 } | 179 } |
| 177 | 180 |
| 178 void CloudExternalDataPolicyObserverTest::SetUp() { | 181 void CloudExternalDataPolicyObserverTest::SetUp() { |
| 179 chromeos::DeviceSettingsTestBase::SetUp(); | 182 chromeos::DeviceSettingsTestBase::SetUp(); |
| 183 | |
| 180 ASSERT_TRUE(profile_manager_.SetUp()); | 184 ASSERT_TRUE(profile_manager_.SetUp()); |
| 185 | |
| 186 affiliated_invalidation_service_provider_.reset( | |
| 187 new AffiliatedInvalidationServiceProvider); | |
| 188 // Mark the |affiliated_invalidation_service_provider_| as shut down | |
| 189 // immediately. This will prevent it from trying to find an available | |
| 190 // invalidation service, which pulls in a lot of additional run-time | |
| 191 // dependencies. | |
| 192 affiliated_invalidation_service_provider_->Shutdown(); | |
| 193 | |
| 181 device_local_account_policy_service_.reset( | 194 device_local_account_policy_service_.reset( |
| 182 new DeviceLocalAccountPolicyService(&device_settings_test_helper_, | 195 new DeviceLocalAccountPolicyService( |
| 183 &device_settings_service_, | 196 &device_settings_test_helper_, |
| 184 &cros_settings_, | 197 &device_settings_service_, |
| 185 base::MessageLoopProxy::current(), | 198 &cros_settings_, |
| 186 base::MessageLoopProxy::current(), | 199 affiliated_invalidation_service_provider_.get(), |
| 187 base::MessageLoopProxy::current(), | 200 base::MessageLoopProxy::current(), |
| 188 base::MessageLoopProxy::current(), | 201 base::MessageLoopProxy::current(), |
| 189 NULL)); | 202 base::MessageLoopProxy::current(), |
| 203 base::MessageLoopProxy::current(), | |
| 204 NULL)); | |
|
pneubeck (no reviews)
2015/01/30 14:23:58
nit: nullptr
bartfab (slow)
2015/02/03 18:31:05
Done.
| |
| 190 url_fetcher_factory_.set_remove_fetcher_on_delete(true); | 205 url_fetcher_factory_.set_remove_fetcher_on_delete(true); |
| 191 | 206 |
| 192 EXPECT_CALL(user_policy_provider_, IsInitializationComplete(_)) | 207 EXPECT_CALL(user_policy_provider_, IsInitializationComplete(_)) |
| 193 .WillRepeatedly(Return(true)); | 208 .WillRepeatedly(Return(true)); |
| 194 user_policy_provider_.Init(); | 209 user_policy_provider_.Init(); |
| 195 | 210 |
| 196 ConstructAvatarPolicy("avatar1.jpg", | 211 ConstructAvatarPolicy("avatar1.jpg", |
| 197 kAvatar1URL, | 212 kAvatar1URL, |
| 198 &avatar_policy_1_data_, | 213 &avatar_policy_1_data_, |
| 199 &avatar_policy_1_); | 214 &avatar_policy_1_); |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 947 | 962 |
| 948 EXPECT_TRUE(set_calls_.empty()); | 963 EXPECT_TRUE(set_calls_.empty()); |
| 949 EXPECT_TRUE(cleared_calls_.empty()); | 964 EXPECT_TRUE(cleared_calls_.empty()); |
| 950 ASSERT_EQ(1u, fetched_calls_.size()); | 965 ASSERT_EQ(1u, fetched_calls_.size()); |
| 951 EXPECT_EQ(kRegularUserID, fetched_calls_.front().first); | 966 EXPECT_EQ(kRegularUserID, fetched_calls_.front().first); |
| 952 EXPECT_EQ(avatar_policy_2_data_, fetched_calls_.front().second); | 967 EXPECT_EQ(avatar_policy_2_data_, fetched_calls_.front().second); |
| 953 ClearObservations(); | 968 ClearObservations(); |
| 954 } | 969 } |
| 955 | 970 |
| 956 } // namespace policy | 971 } // namespace policy |
| OLD | NEW |