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 "components/ownership/owner_key_util_impl.h" | 5 #include "components/ownership/owner_key_util_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 0x41, 0x02, 0x03, 0x01, 0x00, 0x01, | 47 0x41, 0x02, 0x03, 0x01, 0x00, 0x01, |
48 }; | 48 }; |
49 | 49 |
50 class OwnerKeyUtilImplTest : public testing::Test { | 50 class OwnerKeyUtilImplTest : public testing::Test { |
51 protected: | 51 protected: |
52 OwnerKeyUtilImplTest() {} | 52 OwnerKeyUtilImplTest() {} |
53 ~OwnerKeyUtilImplTest() override {} | 53 ~OwnerKeyUtilImplTest() override {} |
54 | 54 |
55 void SetUp() override { | 55 void SetUp() override { |
56 ASSERT_TRUE(tmpdir_.CreateUniqueTempDir()); | 56 ASSERT_TRUE(tmpdir_.CreateUniqueTempDir()); |
57 key_file_ = tmpdir_.path().Append(FILE_PATH_LITERAL("key")); | 57 key_file_ = tmpdir_.GetPath().Append(FILE_PATH_LITERAL("key")); |
58 util_ = new OwnerKeyUtilImpl(key_file_); | 58 util_ = new OwnerKeyUtilImpl(key_file_); |
59 } | 59 } |
60 | 60 |
61 base::ScopedTempDir tmpdir_; | 61 base::ScopedTempDir tmpdir_; |
62 base::FilePath key_file_; | 62 base::FilePath key_file_; |
63 scoped_refptr<OwnerKeyUtil> util_; | 63 scoped_refptr<OwnerKeyUtil> util_; |
64 | 64 |
65 private: | 65 private: |
66 DISALLOW_COPY_AND_ASSIGN(OwnerKeyUtilImplTest); | 66 DISALLOW_COPY_AND_ASSIGN(OwnerKeyUtilImplTest); |
67 }; | 67 }; |
(...skipping 22 matching lines...) Expand all Loading... |
90 | 90 |
91 // Next try empty file. This should fail and the array should be empty. | 91 // Next try empty file. This should fail and the array should be empty. |
92 from_disk.resize(10); | 92 from_disk.resize(10); |
93 ASSERT_EQ(0, base::WriteFile(key_file_, "", 0)); | 93 ASSERT_EQ(0, base::WriteFile(key_file_, "", 0)); |
94 EXPECT_TRUE(util_->IsPublicKeyPresent()); | 94 EXPECT_TRUE(util_->IsPublicKeyPresent()); |
95 EXPECT_FALSE(util_->ImportPublicKey(&from_disk)); | 95 EXPECT_FALSE(util_->ImportPublicKey(&from_disk)); |
96 EXPECT_FALSE(from_disk.size()); | 96 EXPECT_FALSE(from_disk.size()); |
97 } | 97 } |
98 | 98 |
99 } // namespace ownership | 99 } // namespace ownership |
OLD | NEW |