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_cloud_policy_manager_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
11 #include "base/prefs/testing_pref_service.h" | 11 #include "base/prefs/testing_pref_service.h" |
12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
13 #include "chrome/browser/chromeos/cros/cryptohome_library.h" | 13 #include "chrome/browser/chromeos/cros/cryptohome_library.h" |
14 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" | 14 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" |
15 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" | 15 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
16 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" | 16 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
| 17 #include "chrome/browser/chromeos/settings/cros_settings.h" |
17 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" | 18 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" |
18 #include "chrome/browser/policy/cloud/cloud_policy_client.h" | 19 #include "chrome/browser/policy/cloud/cloud_policy_client.h" |
19 #include "chrome/browser/policy/cloud/mock_device_management_service.h" | 20 #include "chrome/browser/policy/cloud/mock_device_management_service.h" |
20 #include "chrome/browser/policy/cloud/proto/device_management_backend.pb.h" | 21 #include "chrome/browser/policy/cloud/proto/device_management_backend.pb.h" |
21 #include "chrome/browser/prefs/browser_prefs.h" | 22 #include "chrome/browser/prefs/browser_prefs.h" |
22 #include "chromeos/dbus/cryptohome_client.h" | 23 #include "chromeos/dbus/cryptohome_client.h" |
23 #include "chromeos/dbus/dbus_client_implementation_type.h" | 24 #include "chromeos/dbus/dbus_client_implementation_type.h" |
24 #include "policy/policy_constants.h" | 25 #include "policy/policy_constants.h" |
25 #include "testing/gmock/include/gmock/gmock.h" | 26 #include "testing/gmock/include/gmock/gmock.h" |
26 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 manager_.Shutdown(); | 68 manager_.Shutdown(); |
68 DeviceSettingsTestBase::TearDown(); | 69 DeviceSettingsTestBase::TearDown(); |
69 } | 70 } |
70 | 71 |
71 scoped_ptr<chromeos::CryptohomeLibrary> cryptohome_library_; | 72 scoped_ptr<chromeos::CryptohomeLibrary> cryptohome_library_; |
72 scoped_ptr<chromeos::CryptohomeClient> stub_cryptohome_client_; | 73 scoped_ptr<chromeos::CryptohomeClient> stub_cryptohome_client_; |
73 EnterpriseInstallAttributes install_attributes_; | 74 EnterpriseInstallAttributes install_attributes_; |
74 | 75 |
75 TestingPrefServiceSimple local_state_; | 76 TestingPrefServiceSimple local_state_; |
76 MockDeviceManagementService device_management_service_; | 77 MockDeviceManagementService device_management_service_; |
| 78 chromeos::ScopedTestCrosSettings test_cros_settings_; |
77 | 79 |
78 DeviceCloudPolicyStoreChromeOS* store_; | 80 DeviceCloudPolicyStoreChromeOS* store_; |
79 DeviceCloudPolicyManagerChromeOS manager_; | 81 DeviceCloudPolicyManagerChromeOS manager_; |
80 | 82 |
81 private: | 83 private: |
82 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerChromeOSTest); | 84 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerChromeOSTest); |
83 }; | 85 }; |
84 | 86 |
85 TEST_F(DeviceCloudPolicyManagerChromeOSTest, FreshDevice) { | 87 TEST_F(DeviceCloudPolicyManagerChromeOSTest, FreshDevice) { |
86 owner_key_util_->Clear(); | 88 owner_key_util_->Clear(); |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, LoadError) { | 363 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, LoadError) { |
362 loaded_blob_.clear(); | 364 loaded_blob_.clear(); |
363 RunTest(); | 365 RunTest(); |
364 ExpectFailedEnrollment(EnrollmentStatus::STATUS_STORE_ERROR); | 366 ExpectFailedEnrollment(EnrollmentStatus::STATUS_STORE_ERROR); |
365 EXPECT_EQ(CloudPolicyStore::STATUS_LOAD_ERROR, | 367 EXPECT_EQ(CloudPolicyStore::STATUS_LOAD_ERROR, |
366 status_.store_status()); | 368 status_.store_status()); |
367 } | 369 } |
368 | 370 |
369 } // namespace | 371 } // namespace |
370 } // namespace policy | 372 } // namespace policy |
OLD | NEW |