| 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/extensions/device_local_account_external_polic
y_loader.h" | 5 #include "chrome/browser/chromeos/extensions/device_local_account_external_polic
y_loader.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 content::TestBrowserThreadBundle thread_bundle_; | 113 content::TestBrowserThreadBundle thread_bundle_; |
| 114 base::ScopedTempDir temp_dir_; | 114 base::ScopedTempDir temp_dir_; |
| 115 base::FilePath cache_dir_; | 115 base::FilePath cache_dir_; |
| 116 policy::MockCloudPolicyStore store_; | 116 policy::MockCloudPolicyStore store_; |
| 117 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 117 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
| 118 base::FilePath test_dir_; | 118 base::FilePath test_dir_; |
| 119 | 119 |
| 120 scoped_refptr<DeviceLocalAccountExternalPolicyLoader> loader_; | 120 scoped_refptr<DeviceLocalAccountExternalPolicyLoader> loader_; |
| 121 MockExternalPolicyProviderVisitor visitor_; | 121 MockExternalPolicyProviderVisitor visitor_; |
| 122 scoped_ptr<extensions::ExternalProviderImpl> provider_; | 122 std::unique_ptr<extensions::ExternalProviderImpl> provider_; |
| 123 | 123 |
| 124 content::InProcessUtilityThreadHelper in_process_utility_thread_helper_; | 124 content::InProcessUtilityThreadHelper in_process_utility_thread_helper_; |
| 125 | 125 |
| 126 #if defined(OS_CHROMEOS) | 126 #if defined(OS_CHROMEOS) |
| 127 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; | 127 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; |
| 128 chromeos::ScopedTestCrosSettings test_cros_settings_; | 128 chromeos::ScopedTestCrosSettings test_cros_settings_; |
| 129 #endif // defined(OS_CHROMEOS) | 129 #endif // defined(OS_CHROMEOS) |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 DeviceLocalAccountExternalPolicyLoaderTest:: | 132 DeviceLocalAccountExternalPolicyLoaderTest:: |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 VerifyAndResetVisitorCallExpectations() { | 168 VerifyAndResetVisitorCallExpectations() { |
| 169 Mock::VerifyAndClearExpectations(&visitor_); | 169 Mock::VerifyAndClearExpectations(&visitor_); |
| 170 EXPECT_CALL(visitor_, OnExternalExtensionFileFound(_)).Times(0); | 170 EXPECT_CALL(visitor_, OnExternalExtensionFileFound(_)).Times(0); |
| 171 EXPECT_CALL(visitor_, OnExternalExtensionUpdateUrlFound(_, _)).Times(0); | 171 EXPECT_CALL(visitor_, OnExternalExtensionUpdateUrlFound(_, _)).Times(0); |
| 172 EXPECT_CALL(visitor_, OnExternalProviderReady(_)) | 172 EXPECT_CALL(visitor_, OnExternalProviderReady(_)) |
| 173 .Times(0); | 173 .Times(0); |
| 174 EXPECT_CALL(visitor_, OnExternalProviderUpdateComplete(_, _, _, _)).Times(0); | 174 EXPECT_CALL(visitor_, OnExternalProviderUpdateComplete(_, _, _, _)).Times(0); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void DeviceLocalAccountExternalPolicyLoaderTest::SetForceInstallListPolicy() { | 177 void DeviceLocalAccountExternalPolicyLoaderTest::SetForceInstallListPolicy() { |
| 178 scoped_ptr<base::ListValue> forcelist(new base::ListValue); | 178 std::unique_ptr<base::ListValue> forcelist(new base::ListValue); |
| 179 forcelist->AppendString("invalid"); | 179 forcelist->AppendString("invalid"); |
| 180 forcelist->AppendString(base::StringPrintf( | 180 forcelist->AppendString(base::StringPrintf( |
| 181 "%s;%s", | 181 "%s;%s", |
| 182 kExtensionId, | 182 kExtensionId, |
| 183 extension_urls::GetWebstoreUpdateUrl().spec().c_str())); | 183 extension_urls::GetWebstoreUpdateUrl().spec().c_str())); |
| 184 store_.policy_map_.Set(policy::key::kExtensionInstallForcelist, | 184 store_.policy_map_.Set(policy::key::kExtensionInstallForcelist, |
| 185 policy::POLICY_LEVEL_MANDATORY, | 185 policy::POLICY_LEVEL_MANDATORY, |
| 186 policy::POLICY_SCOPE_USER, | 186 policy::POLICY_SCOPE_USER, |
| 187 policy::POLICY_SOURCE_CLOUD, | 187 policy::POLICY_SOURCE_CLOUD, |
| 188 forcelist.release(), | 188 forcelist.release(), |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 loader_->StopCache(shutdown_run_loop.QuitClosure()); | 313 loader_->StopCache(shutdown_run_loop.QuitClosure()); |
| 314 VerifyAndResetVisitorCallExpectations(); | 314 VerifyAndResetVisitorCallExpectations(); |
| 315 | 315 |
| 316 // Spin the loop until the cache shutdown callback is invoked. Verify that at | 316 // Spin the loop until the cache shutdown callback is invoked. Verify that at |
| 317 // that point, no further file I/O tasks are pending. | 317 // that point, no further file I/O tasks are pending. |
| 318 shutdown_run_loop.Run(); | 318 shutdown_run_loop.Run(); |
| 319 EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting()); | 319 EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting()); |
| 320 } | 320 } |
| 321 | 321 |
| 322 } // namespace chromeos | 322 } // namespace chromeos |
| OLD | NEW |