| 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 <memory> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 9 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 13 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
| 14 #include "chrome/browser/chromeos/policy/proto/install_attributes.pb.h" | 15 #include "chrome/browser/chromeos/policy/proto/install_attributes.pb.h" |
| 15 #include "chromeos/chromeos_paths.h" | 16 #include "chromeos/chromeos_paths.h" |
| 16 #include "chromeos/cryptohome/cryptohome_util.h" | 17 #include "chromeos/cryptohome/cryptohome_util.h" |
| 17 #include "chromeos/dbus/cryptohome_client.h" | 18 #include "chromeos/dbus/cryptohome_client.h" |
| 18 #include "chromeos/dbus/dbus_thread_manager.h" | 19 #include "chromeos/dbus/dbus_thread_manager.h" |
| 19 #include "google_apis/gaia/gaia_auth_util.h" | 20 #include "google_apis/gaia/gaia_auth_util.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 22 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 const std::string& name, | 65 const std::string& name, |
| 65 const std::string& value) { | 66 const std::string& value) { |
| 66 cryptohome::SerializedInstallAttributes::Attribute* attribute; | 67 cryptohome::SerializedInstallAttributes::Attribute* attribute; |
| 67 attribute = install_attrs_proto->add_attributes(); | 68 attribute = install_attrs_proto->add_attributes(); |
| 68 attribute->set_name(name); | 69 attribute->set_name(name); |
| 69 attribute->set_value(value); | 70 attribute->set_value(value); |
| 70 } | 71 } |
| 71 | 72 |
| 72 base::MessageLoopForUI message_loop_; | 73 base::MessageLoopForUI message_loop_; |
| 73 base::ScopedTempDir temp_dir_; | 74 base::ScopedTempDir temp_dir_; |
| 74 scoped_ptr<EnterpriseInstallAttributes> install_attributes_; | 75 std::unique_ptr<EnterpriseInstallAttributes> install_attributes_; |
| 75 | 76 |
| 76 EnterpriseInstallAttributes::LockResult LockDeviceAndWaitForResult( | 77 EnterpriseInstallAttributes::LockResult LockDeviceAndWaitForResult( |
| 77 const std::string& user, | 78 const std::string& user, |
| 78 DeviceMode device_mode, | 79 DeviceMode device_mode, |
| 79 const std::string& device_id) { | 80 const std::string& device_id) { |
| 80 base::RunLoop loop; | 81 base::RunLoop loop; |
| 81 EnterpriseInstallAttributes::LockResult result; | 82 EnterpriseInstallAttributes::LockResult result; |
| 82 install_attributes_->LockDevice( | 83 install_attributes_->LockDevice( |
| 83 user, | 84 user, |
| 84 device_mode, | 85 device_mode, |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 EnterpriseInstallAttributes::kAttrEnterpriseUser, kTestUser)); | 274 EnterpriseInstallAttributes::kAttrEnterpriseUser, kTestUser)); |
| 274 ASSERT_TRUE(cryptohome_util::InstallAttributesFinalize()); | 275 ASSERT_TRUE(cryptohome_util::InstallAttributesFinalize()); |
| 275 | 276 |
| 276 // Verify that EnterpriseInstallAttributes correctly decodes the stub | 277 // Verify that EnterpriseInstallAttributes correctly decodes the stub |
| 277 // cache file. | 278 // cache file. |
| 278 install_attributes_->Init(GetTempPath()); | 279 install_attributes_->Init(GetTempPath()); |
| 279 EXPECT_EQ(kTestUser, install_attributes_->GetRegistrationUser()); | 280 EXPECT_EQ(kTestUser, install_attributes_->GetRegistrationUser()); |
| 280 } | 281 } |
| 281 | 282 |
| 282 } // namespace policy | 283 } // namespace policy |
| OLD | NEW |