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/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(base::RunLoop* loop, | |
| 36 chromeos::DBusMethodCallStatus* out_status, | |
| 37 chromeos::DBusMethodCallStatus call_status, | |
| 38 bool result, | |
| 39 const cryptohome::BaseReply& reply) { | |
| 40 *out_status = call_status; | |
| 41 loop->Quit(); | |
| 42 } | |
| 43 | |
| 35 } // namespace | 44 } // namespace |
| 36 | 45 |
| 37 static const char kTestDomain[] = "example.com"; | 46 static const char kTestDomain[] = "example.com"; |
| 38 static const char kTestRealm[] = "realm.example.com"; | 47 static const char kTestRealm[] = "realm.example.com"; |
| 39 static const char kTestDeviceId[] = "133750519"; | 48 static const char kTestDeviceId[] = "133750519"; |
| 40 static const char kTestUserDeprecated[] = "test@example.com"; | 49 static const char kTestUserDeprecated[] = "test@example.com"; |
| 41 | 50 |
| 42 class InstallAttributesTest : public testing::Test { | 51 class InstallAttributesTest : public testing::Test { |
| 43 protected: | 52 protected: |
| 44 InstallAttributesTest() {} | 53 InstallAttributesTest() {} |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 288 ASSERT_TRUE(cryptohome_util::InstallAttributesFinalize()); | 297 ASSERT_TRUE(cryptohome_util::InstallAttributesFinalize()); |
| 289 | 298 |
| 290 // Verify that InstallAttributes correctly decodes the stub cache file. | 299 // Verify that InstallAttributes correctly decodes the stub cache file. |
| 291 install_attributes_->Init(GetTempPath()); | 300 install_attributes_->Init(GetTempPath()); |
| 292 EXPECT_EQ(policy::DEVICE_MODE_ENTERPRISE, install_attributes_->GetMode()); | 301 EXPECT_EQ(policy::DEVICE_MODE_ENTERPRISE, install_attributes_->GetMode()); |
| 293 EXPECT_EQ(kTestDomain, install_attributes_->GetDomain()); | 302 EXPECT_EQ(kTestDomain, install_attributes_->GetDomain()); |
| 294 EXPECT_EQ(std::string(), install_attributes_->GetRealm()); | 303 EXPECT_EQ(std::string(), install_attributes_->GetRealm()); |
| 295 EXPECT_EQ(std::string(), install_attributes_->GetDeviceId()); | 304 EXPECT_EQ(std::string(), install_attributes_->GetDeviceId()); |
| 296 } | 305 } |
| 297 | 306 |
| 307 TEST_F(InstallAttributesTest, CheckSetBlockDevmodeInTpm) { | |
| 308 chromeos::DBusMethodCallStatus status; | |
| 309 base::RunLoop loop; | |
| 310 install_attributes_->SetBlockDevmodeInTpm( | |
| 311 true, base::Bind(&OnSetBlockDevmode, &loop, &status)); | |
| 312 loop.Run(); | |
|
Daniel Erat
2017/03/06 21:18:26
nit: just do:
base::RunLoop().Run();
?
igorcov
2017/03/09 12:22:57
Done.
| |
| 313 | |
| 314 EXPECT_EQ(chromeos::DBusMethodCallStatus::DBUS_METHOD_CALL_SUCCESS, status); | |
| 315 } | |
| 316 | |
| 298 } // namespace chromeos | 317 } // namespace chromeos |
| OLD | NEW |