| 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/settings/install_attributes.h" | 5 #include "chrome/browser/chromeos/settings/install_attributes.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 void CopyLockResult(base::RunLoop* loop, | 28 void CopyLockResult(base::RunLoop* loop, |
| 29 InstallAttributes::LockResult* out, | 29 InstallAttributes::LockResult* out, |
| 30 InstallAttributes::LockResult result) { | 30 InstallAttributes::LockResult result) { |
| 31 *out = result; | 31 *out = result; |
| 32 loop->Quit(); | 32 loop->Quit(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void OnSetBlockDevmode(chromeos::DBusMethodCallStatus* out_status, |
| 36 chromeos::DBusMethodCallStatus call_status, |
| 37 bool result, |
| 38 const cryptohome::BaseReply& reply) { |
| 39 *out_status = call_status; |
| 40 } |
| 41 |
| 35 } // namespace | 42 } // namespace |
| 36 | 43 |
| 37 static const char kTestDomain[] = "example.com"; | 44 static const char kTestDomain[] = "example.com"; |
| 38 static const char kTestRealm[] = "realm.example.com"; | 45 static const char kTestRealm[] = "realm.example.com"; |
| 39 static const char kTestDeviceId[] = "133750519"; | 46 static const char kTestDeviceId[] = "133750519"; |
| 40 static const char kTestUserDeprecated[] = "test@example.com"; | 47 static const char kTestUserDeprecated[] = "test@example.com"; |
| 41 | 48 |
| 42 class InstallAttributesTest : public testing::Test { | 49 class InstallAttributesTest : public testing::Test { |
| 43 protected: | 50 protected: |
| 44 InstallAttributesTest() {} | 51 InstallAttributesTest() {} |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 ASSERT_TRUE(cryptohome_util::InstallAttributesFinalize()); | 295 ASSERT_TRUE(cryptohome_util::InstallAttributesFinalize()); |
| 289 | 296 |
| 290 // Verify that InstallAttributes correctly decodes the stub cache file. | 297 // Verify that InstallAttributes correctly decodes the stub cache file. |
| 291 install_attributes_->Init(GetTempPath()); | 298 install_attributes_->Init(GetTempPath()); |
| 292 EXPECT_EQ(policy::DEVICE_MODE_ENTERPRISE, install_attributes_->GetMode()); | 299 EXPECT_EQ(policy::DEVICE_MODE_ENTERPRISE, install_attributes_->GetMode()); |
| 293 EXPECT_EQ(kTestDomain, install_attributes_->GetDomain()); | 300 EXPECT_EQ(kTestDomain, install_attributes_->GetDomain()); |
| 294 EXPECT_EQ(std::string(), install_attributes_->GetRealm()); | 301 EXPECT_EQ(std::string(), install_attributes_->GetRealm()); |
| 295 EXPECT_EQ(std::string(), install_attributes_->GetDeviceId()); | 302 EXPECT_EQ(std::string(), install_attributes_->GetDeviceId()); |
| 296 } | 303 } |
| 297 | 304 |
| 305 TEST_F(InstallAttributesTest, CheckSetBlockDevmodeInTpm) { |
| 306 chromeos::DBusMethodCallStatus status = |
| 307 chromeos::DBusMethodCallStatus::DBUS_METHOD_CALL_FAILURE; |
| 308 install_attributes_->SetBlockDevmodeInTpm( |
| 309 true, base::Bind(&OnSetBlockDevmode, &status)); |
| 310 base::RunLoop().RunUntilIdle(); |
| 311 |
| 312 EXPECT_EQ(chromeos::DBusMethodCallStatus::DBUS_METHOD_CALL_SUCCESS, status); |
| 313 } |
| 314 |
| 298 } // namespace chromeos | 315 } // namespace chromeos |
| OLD | NEW |