Chromium Code Reviews| 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/enterprise_install_attributes.h" | 5 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.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/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 install_attributes_->ReadCacheFile(GetTempPath()); | 164 install_attributes_->ReadCacheFile(GetTempPath()); |
| 165 EXPECT_EQ(std::string(), install_attributes_->GetDeviceId()); | 165 EXPECT_EQ(std::string(), install_attributes_->GetDeviceId()); |
| 166 ASSERT_EQ(EnterpriseInstallAttributes::LOCK_SUCCESS, | 166 ASSERT_EQ(EnterpriseInstallAttributes::LOCK_SUCCESS, |
| 167 LockDeviceAndWaitForResult( | 167 LockDeviceAndWaitForResult( |
| 168 kTestUser, | 168 kTestUser, |
| 169 DEVICE_MODE_ENTERPRISE, | 169 DEVICE_MODE_ENTERPRISE, |
| 170 kTestDeviceId)); | 170 kTestDeviceId)); |
| 171 EXPECT_EQ(kTestDeviceId, install_attributes_->GetDeviceId()); | 171 EXPECT_EQ(kTestDeviceId, install_attributes_->GetDeviceId()); |
| 172 } | 172 } |
| 173 | 173 |
| 174 TEST_F(EnterpriseInstallAttributesTest, GetMode) { | 174 TEST_F(EnterpriseInstallAttributesTest, GetMode) { |
|
bartfab (slow)
2014/11/27 16:25:47
Nit: Can you switch this test to another, non-depr
rkc
2014/12/01 19:15:04
Done.
| |
| 175 install_attributes_->ReadCacheFile(GetTempPath()); | 175 install_attributes_->ReadCacheFile(GetTempPath()); |
| 176 EXPECT_EQ(DEVICE_MODE_PENDING, install_attributes_->GetMode()); | 176 EXPECT_EQ(DEVICE_MODE_PENDING, install_attributes_->GetMode()); |
| 177 ASSERT_EQ(EnterpriseInstallAttributes::LOCK_SUCCESS, | 177 ASSERT_EQ(EnterpriseInstallAttributes::LOCK_SUCCESS, |
| 178 LockDeviceAndWaitForResult( | 178 LockDeviceAndWaitForResult( |
| 179 kTestUser, | 179 kTestUser, DEVICE_MODE_LEGACY_RETAIL_MODE, kTestDeviceId)); |
| 180 DEVICE_MODE_RETAIL_KIOSK, | 180 EXPECT_EQ(DEVICE_MODE_LEGACY_RETAIL_MODE, install_attributes_->GetMode()); |
| 181 kTestDeviceId)); | |
| 182 EXPECT_EQ(DEVICE_MODE_RETAIL_KIOSK, | |
| 183 install_attributes_->GetMode()); | |
| 184 } | 181 } |
| 185 | 182 |
| 186 TEST_F(EnterpriseInstallAttributesTest, ConsumerDevice) { | 183 TEST_F(EnterpriseInstallAttributesTest, ConsumerDevice) { |
| 187 install_attributes_->ReadCacheFile(GetTempPath()); | 184 install_attributes_->ReadCacheFile(GetTempPath()); |
| 188 EXPECT_EQ(DEVICE_MODE_PENDING, install_attributes_->GetMode()); | 185 EXPECT_EQ(DEVICE_MODE_PENDING, install_attributes_->GetMode()); |
| 189 // Lock the attributes empty. | 186 // Lock the attributes empty. |
| 190 ASSERT_TRUE(cryptohome_util::InstallAttributesFinalize()); | 187 ASSERT_TRUE(cryptohome_util::InstallAttributesFinalize()); |
| 191 base::RunLoop loop; | 188 base::RunLoop loop; |
| 192 install_attributes_->ReadImmutableAttributes(loop.QuitClosure()); | 189 install_attributes_->ReadImmutableAttributes(loop.QuitClosure()); |
| 193 loop.Run(); | 190 loop.Run(); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 278 EnterpriseInstallAttributes::kAttrEnterpriseUser, kTestUser)); | 275 EnterpriseInstallAttributes::kAttrEnterpriseUser, kTestUser)); |
| 279 ASSERT_TRUE(cryptohome_util::InstallAttributesFinalize()); | 276 ASSERT_TRUE(cryptohome_util::InstallAttributesFinalize()); |
| 280 | 277 |
| 281 // Verify that EnterpriseInstallAttributes correctly decodes the stub | 278 // Verify that EnterpriseInstallAttributes correctly decodes the stub |
| 282 // cache file. | 279 // cache file. |
| 283 install_attributes_->ReadCacheFile(GetTempPath()); | 280 install_attributes_->ReadCacheFile(GetTempPath()); |
| 284 EXPECT_EQ(kTestUser, install_attributes_->GetRegistrationUser()); | 281 EXPECT_EQ(kTestUser, install_attributes_->GetRegistrationUser()); |
| 285 } | 282 } |
| 286 | 283 |
| 287 } // namespace policy | 284 } // namespace policy |
| OLD | NEW |