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> | 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 ASSERT_TRUE(PathService::OverrideAndCreateIfNeeded( | 49 ASSERT_TRUE(PathService::OverrideAndCreateIfNeeded( |
50 chromeos::FILE_INSTALL_ATTRIBUTES, GetTempPath(), true, false)); | 50 chromeos::FILE_INSTALL_ATTRIBUTES, GetTempPath(), true, false)); |
51 chromeos::DBusThreadManager::Initialize(); | 51 chromeos::DBusThreadManager::Initialize(); |
52 install_attributes_.reset(new EnterpriseInstallAttributes( | 52 install_attributes_.reset(new EnterpriseInstallAttributes( |
53 chromeos::DBusThreadManager::Get()->GetCryptohomeClient())); | 53 chromeos::DBusThreadManager::Get()->GetCryptohomeClient())); |
54 } | 54 } |
55 | 55 |
56 void TearDown() override { chromeos::DBusThreadManager::Shutdown(); } | 56 void TearDown() override { chromeos::DBusThreadManager::Shutdown(); } |
57 | 57 |
58 base::FilePath GetTempPath() const { | 58 base::FilePath GetTempPath() const { |
59 base::FilePath temp_path = base::MakeAbsoluteFilePath(temp_dir_.path()); | 59 base::FilePath temp_path = base::MakeAbsoluteFilePath(temp_dir_.GetPath()); |
60 return temp_path.Append("install_attrs_test"); | 60 return temp_path.Append("install_attrs_test"); |
61 } | 61 } |
62 | 62 |
63 void SetAttribute( | 63 void SetAttribute( |
64 cryptohome::SerializedInstallAttributes* install_attrs_proto, | 64 cryptohome::SerializedInstallAttributes* install_attrs_proto, |
65 const std::string& name, | 65 const std::string& name, |
66 const std::string& value) { | 66 const std::string& value) { |
67 cryptohome::SerializedInstallAttributes::Attribute* attribute; | 67 cryptohome::SerializedInstallAttributes::Attribute* attribute; |
68 attribute = install_attrs_proto->add_attributes(); | 68 attribute = install_attrs_proto->add_attributes(); |
69 attribute->set_name(name); | 69 attribute->set_name(name); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 EnterpriseInstallAttributes::kAttrEnterpriseUser, kTestUser)); | 274 EnterpriseInstallAttributes::kAttrEnterpriseUser, kTestUser)); |
275 ASSERT_TRUE(cryptohome_util::InstallAttributesFinalize()); | 275 ASSERT_TRUE(cryptohome_util::InstallAttributesFinalize()); |
276 | 276 |
277 // Verify that EnterpriseInstallAttributes correctly decodes the stub | 277 // Verify that EnterpriseInstallAttributes correctly decodes the stub |
278 // cache file. | 278 // cache file. |
279 install_attributes_->Init(GetTempPath()); | 279 install_attributes_->Init(GetTempPath()); |
280 EXPECT_EQ(kTestUser, install_attributes_->GetRegistrationUser()); | 280 EXPECT_EQ(kTestUser, install_attributes_->GetRegistrationUser()); |
281 } | 281 } |
282 | 282 |
283 } // namespace policy | 283 } // namespace policy |
OLD | NEW |