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 "chrome/browser/chromeos/policy/device_local_account_policy_service.h" | 5 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 // the caches for all existing accounts are running. | 542 // the caches for all existing accounts are running. |
543 TEST_F(DeviceLocalAccountPolicyExtensionCacheTest, Startup) { | 543 TEST_F(DeviceLocalAccountPolicyExtensionCacheTest, Startup) { |
544 base::FilePath test_data_dir; | 544 base::FilePath test_data_dir; |
545 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)); | 545 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)); |
546 const base::FilePath source_crx_file = | 546 const base::FilePath source_crx_file = |
547 test_data_dir.Append(kExtensionCRXPath); | 547 test_data_dir.Append(kExtensionCRXPath); |
548 const std::string target_crx_file_name = | 548 const std::string target_crx_file_name = |
549 base::StringPrintf("%s-%s.crx", kExtensionID, kExtensionVersion); | 549 base::StringPrintf("%s-%s.crx", kExtensionID, kExtensionVersion); |
550 | 550 |
551 // Create and pre-populate a cache directory for account 1. | 551 // Create and pre-populate a cache directory for account 1. |
552 EXPECT_TRUE(file_util::CreateDirectory(cache_dir_1_)); | 552 EXPECT_TRUE(base::CreateDirectory(cache_dir_1_)); |
553 EXPECT_TRUE(CopyFile(source_crx_file, | 553 EXPECT_TRUE(CopyFile(source_crx_file, |
554 cache_dir_1_.Append(target_crx_file_name))); | 554 cache_dir_1_.Append(target_crx_file_name))); |
555 | 555 |
556 // Create and pre-populate a cache directory for account 3. | 556 // Create and pre-populate a cache directory for account 3. |
557 EXPECT_TRUE(file_util::CreateDirectory(cache_dir_3_)); | 557 EXPECT_TRUE(base::CreateDirectory(cache_dir_3_)); |
558 EXPECT_TRUE(CopyFile(source_crx_file, | 558 EXPECT_TRUE(CopyFile(source_crx_file, |
559 cache_dir_3_.Append(target_crx_file_name))); | 559 cache_dir_3_.Append(target_crx_file_name))); |
560 | 560 |
561 // Add accounts 1 and 2 to device policy. | 561 // Add accounts 1 and 2 to device policy. |
562 InstallDeviceLocalAccountPolicy(kAccount1); | 562 InstallDeviceLocalAccountPolicy(kAccount1); |
563 InstallDeviceLocalAccountPolicy(kAccount2); | 563 InstallDeviceLocalAccountPolicy(kAccount2); |
564 AddDeviceLocalAccountToPolicy(kAccount1); | 564 AddDeviceLocalAccountToPolicy(kAccount1); |
565 AddDeviceLocalAccountToPolicy(kAccount2); | 565 AddDeviceLocalAccountToPolicy(kAccount2); |
566 InstallDevicePolicy(); | 566 InstallDevicePolicy(); |
567 | 567 |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
944 em::DeviceManagementResponse response; | 944 em::DeviceManagementResponse response; |
945 device_local_account_policy_.Build(); | 945 device_local_account_policy_.Build(); |
946 response.mutable_policy_response()->add_response()->CopyFrom( | 946 response.mutable_policy_response()->add_response()->CopyFrom( |
947 device_local_account_policy_.policy()); | 947 device_local_account_policy_.policy()); |
948 request_job->SendResponse(DM_STATUS_SUCCESS, response); | 948 request_job->SendResponse(DM_STATUS_SUCCESS, response); |
949 FlushDeviceSettings(); | 949 FlushDeviceSettings(); |
950 Mock::VerifyAndClearExpectations(&provider_observer_); | 950 Mock::VerifyAndClearExpectations(&provider_observer_); |
951 } | 951 } |
952 | 952 |
953 } // namespace policy | 953 } // namespace policy |
OLD | NEW |