| 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 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 static const char kTestUser[] = "test@example.com"; | 37 static const char kTestUser[] = "test@example.com"; |
| 38 static const char kTestUserCanonicalize[] = "UPPER.CASE@example.com"; | 38 static const char kTestUserCanonicalize[] = "UPPER.CASE@example.com"; |
| 39 static const char kTestDomain[] = "example.com"; | 39 static const char kTestDomain[] = "example.com"; |
| 40 static const char kTestDeviceId[] = "133750519"; | 40 static const char kTestDeviceId[] = "133750519"; |
| 41 | 41 |
| 42 class EnterpriseInstallAttributesTest : public testing::Test { | 42 class EnterpriseInstallAttributesTest : public testing::Test { |
| 43 protected: | 43 protected: |
| 44 EnterpriseInstallAttributesTest() {} | 44 EnterpriseInstallAttributesTest() {} |
| 45 | 45 |
| 46 virtual void SetUp() OVERRIDE { | 46 virtual void SetUp() override { |
| 47 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 47 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 48 ASSERT_TRUE(PathService::OverrideAndCreateIfNeeded( | 48 ASSERT_TRUE(PathService::OverrideAndCreateIfNeeded( |
| 49 chromeos::FILE_INSTALL_ATTRIBUTES, GetTempPath(), true, false)); | 49 chromeos::FILE_INSTALL_ATTRIBUTES, GetTempPath(), true, false)); |
| 50 chromeos::DBusThreadManager::Initialize(); | 50 chromeos::DBusThreadManager::Initialize(); |
| 51 install_attributes_.reset(new EnterpriseInstallAttributes( | 51 install_attributes_.reset(new EnterpriseInstallAttributes( |
| 52 chromeos::DBusThreadManager::Get()->GetCryptohomeClient())); | 52 chromeos::DBusThreadManager::Get()->GetCryptohomeClient())); |
| 53 } | 53 } |
| 54 | 54 |
| 55 virtual void TearDown() OVERRIDE { | 55 virtual void TearDown() override { |
| 56 chromeos::DBusThreadManager::Shutdown(); | 56 chromeos::DBusThreadManager::Shutdown(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 base::FilePath GetTempPath() const { | 59 base::FilePath GetTempPath() const { |
| 60 base::FilePath temp_path = base::MakeAbsoluteFilePath(temp_dir_.path()); | 60 base::FilePath temp_path = base::MakeAbsoluteFilePath(temp_dir_.path()); |
| 61 return temp_path.Append("install_attrs_test"); | 61 return temp_path.Append("install_attrs_test"); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void SetAttribute( | 64 void SetAttribute( |
| 65 cryptohome::SerializedInstallAttributes* install_attrs_proto, | 65 cryptohome::SerializedInstallAttributes* install_attrs_proto, |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 EnterpriseInstallAttributes::kAttrEnterpriseUser, kTestUser)); | 278 EnterpriseInstallAttributes::kAttrEnterpriseUser, kTestUser)); |
| 279 ASSERT_TRUE(cryptohome_util::InstallAttributesFinalize()); | 279 ASSERT_TRUE(cryptohome_util::InstallAttributesFinalize()); |
| 280 | 280 |
| 281 // Verify that EnterpriseInstallAttributes correctly decodes the stub | 281 // Verify that EnterpriseInstallAttributes correctly decodes the stub |
| 282 // cache file. | 282 // cache file. |
| 283 install_attributes_->ReadCacheFile(GetTempPath()); | 283 install_attributes_->ReadCacheFile(GetTempPath()); |
| 284 EXPECT_EQ(kTestUser, install_attributes_->GetRegistrationUser()); | 284 EXPECT_EQ(kTestUser, install_attributes_->GetRegistrationUser()); |
| 285 } | 285 } |
| 286 | 286 |
| 287 } // namespace policy | 287 } // namespace policy |
| OLD | NEW |