OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/net/packed_ct_ev_whitelist.h" | 5 #include "chrome/browser/net/packed_ct_ev_whitelist.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/big_endian.h" | 10 #include "base/big_endian.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 HashToUint64(GetSecondHash())) != res.end()); | 112 HashToUint64(GetSecondHash())) != res.end()); |
113 // Ensure last hash is found | 113 // Ensure last hash is found |
114 EXPECT_TRUE(std::find(res.begin(), res.end(), HashToUint64(GetThirdHash())) != | 114 EXPECT_TRUE(std::find(res.begin(), res.end(), HashToUint64(GetThirdHash())) != |
115 res.end()); | 115 res.end()); |
116 // Ensure that there are exactly 3 hashes. | 116 // Ensure that there are exactly 3 hashes. |
117 EXPECT_EQ(3u, res.size()); | 117 EXPECT_EQ(3u, res.size()); |
118 } | 118 } |
119 | 119 |
120 TEST(PackedEVCertsWhitelistTest, CanFindHashInSetList) { | 120 TEST(PackedEVCertsWhitelistTest, CanFindHashInSetList) { |
121 scoped_refptr<PackedEVCertsWhitelist> whitelist( | 121 scoped_refptr<PackedEVCertsWhitelist> whitelist( |
122 new PackedEVCertsWhitelist(GetAllWhitelistData())); | 122 new PackedEVCertsWhitelist(GetAllWhitelistData(), base::Version())); |
123 | 123 |
124 EXPECT_TRUE(whitelist->IsValid()); | 124 EXPECT_TRUE(whitelist->IsValid()); |
125 EXPECT_TRUE(whitelist->ContainsCertificateHash(GetFirstHash())); | 125 EXPECT_TRUE(whitelist->ContainsCertificateHash(GetFirstHash())); |
126 EXPECT_TRUE(whitelist->ContainsCertificateHash(GetSecondHash())); | 126 EXPECT_TRUE(whitelist->ContainsCertificateHash(GetSecondHash())); |
127 EXPECT_TRUE(whitelist->ContainsCertificateHash(GetThirdHash())); | 127 EXPECT_TRUE(whitelist->ContainsCertificateHash(GetThirdHash())); |
128 } | 128 } |
129 | 129 |
130 TEST(PackedEVCertsWhitelistTest, CorrectlyIdentifiesEmptyWhitelistIsInvalid) { | 130 TEST(PackedEVCertsWhitelistTest, CorrectlyIdentifiesEmptyWhitelistIsInvalid) { |
131 scoped_refptr<PackedEVCertsWhitelist> whitelist( | 131 scoped_refptr<PackedEVCertsWhitelist> whitelist( |
132 new PackedEVCertsWhitelist("")); | 132 new PackedEVCertsWhitelist("", base::Version())); |
Ryan Sleevi
2014/12/16 21:35:01
s/""/std::string/ ;)
Eran Messeri
2014/12/17 16:19:31
Done.
| |
133 | 133 |
134 EXPECT_FALSE(whitelist->IsValid()); | 134 EXPECT_FALSE(whitelist->IsValid()); |
135 } | 135 } |
136 | 136 |
137 TEST(PackedEVCertsWhitelistTest, CorrectlyIdentifiesPartialWhitelistIsInvalid) { | 137 TEST(PackedEVCertsWhitelistTest, CorrectlyIdentifiesPartialWhitelistIsInvalid) { |
138 scoped_refptr<PackedEVCertsWhitelist> whitelist( | 138 scoped_refptr<PackedEVCertsWhitelist> whitelist( |
139 new PackedEVCertsWhitelist(GetPartialWhitelistData(14))); | 139 new PackedEVCertsWhitelist(GetPartialWhitelistData(14), base::Version())); |
140 | 140 |
141 EXPECT_FALSE(whitelist->IsValid()); | 141 EXPECT_FALSE(whitelist->IsValid()); |
142 } | 142 } |
143 | 143 |
144 TEST(PackedEVCertsWhitelistTest, CorrectlyIdentifiesWhitelistIsValid) { | 144 TEST(PackedEVCertsWhitelistTest, CorrectlyIdentifiesWhitelistIsValid) { |
145 scoped_refptr<PackedEVCertsWhitelist> whitelist( | 145 scoped_refptr<PackedEVCertsWhitelist> whitelist( |
146 new PackedEVCertsWhitelist(GetAllWhitelistData())); | 146 new PackedEVCertsWhitelist(GetAllWhitelistData(), base::Version())); |
147 | 147 |
148 EXPECT_TRUE(whitelist->IsValid()); | 148 EXPECT_TRUE(whitelist->IsValid()); |
149 } | 149 } |
OLD | NEW |