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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 0xb4, 0xf0, 0x27, 0x4b, 0x15, 0x18, 0x5c, 0x95, 0xfe, 0x21, 0x04, 0x68, | 44 0xb4, 0xf0, 0x27, 0x4b, 0x15, 0x18, 0x5c, 0x95, 0xfe, 0x21, 0x04, 0x68, |
45 0xe7, 0xde, 0x16, 0x66, 0x60, 0xd7, 0xda, 0xc5, 0x5b, 0xda, 0x0f, 0xfa, | 45 0xe7, 0xde, 0x16, 0x66, 0x60, 0xd7, 0xda, 0xc5, 0x5b, 0xda, 0x0f, 0xfa, |
46 0x41, 0x02, 0x03, 0x01, 0x00, 0x01, | 46 0x41, 0x02, 0x03, 0x01, 0x00, 0x01, |
47 }; | 47 }; |
48 | 48 |
49 class OwnerKeyUtilImplTest : public testing::Test { | 49 class OwnerKeyUtilImplTest : public testing::Test { |
50 protected: | 50 protected: |
51 OwnerKeyUtilImplTest() {} | 51 OwnerKeyUtilImplTest() {} |
52 virtual ~OwnerKeyUtilImplTest() {} | 52 virtual ~OwnerKeyUtilImplTest() {} |
53 | 53 |
54 virtual void SetUp() OVERRIDE { | 54 virtual void SetUp() override { |
55 ASSERT_TRUE(tmpdir_.CreateUniqueTempDir()); | 55 ASSERT_TRUE(tmpdir_.CreateUniqueTempDir()); |
56 key_file_ = tmpdir_.path().Append(FILE_PATH_LITERAL("key")); | 56 key_file_ = tmpdir_.path().Append(FILE_PATH_LITERAL("key")); |
57 util_ = new OwnerKeyUtilImpl(key_file_); | 57 util_ = new OwnerKeyUtilImpl(key_file_); |
58 } | 58 } |
59 | 59 |
60 base::ScopedTempDir tmpdir_; | 60 base::ScopedTempDir tmpdir_; |
61 base::FilePath key_file_; | 61 base::FilePath key_file_; |
62 scoped_refptr<OwnerKeyUtil> util_; | 62 scoped_refptr<OwnerKeyUtil> util_; |
63 | 63 |
64 private: | 64 private: |
(...skipping 25 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 |