| 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 "net/base/crl_set.h" | 5 #include "net/base/crl_set.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 | 7 |
| 8 // These data blocks were generated using a lot of code that is still in | 8 // These data blocks were generated using a lot of code that is still in |
| 9 // development. For now, if you need to update them, you have to contact agl. | 9 // development. For now, if you need to update them, you have to contact agl. |
| 10 static const uint8 kGIACRLSet[] = { | 10 static const uint8 kGIACRLSet[] = { |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 201 |
| 202 const std::string gia_spki_hash( | 202 const std::string gia_spki_hash( |
| 203 reinterpret_cast<const char*>(kGIASPKISHA256), | 203 reinterpret_cast<const char*>(kGIASPKISHA256), |
| 204 sizeof(kGIASPKISHA256)); | 204 sizeof(kGIASPKISHA256)); |
| 205 EXPECT_EQ(net::CRLSet::REVOKED, set->CheckSerial( | 205 EXPECT_EQ(net::CRLSet::REVOKED, set->CheckSerial( |
| 206 std::string("\x16\x7D\x75\x9D\x00\x03\x00\x00\x14\x55", 10), | 206 std::string("\x16\x7D\x75\x9D\x00\x03\x00\x00\x14\x55", 10), |
| 207 gia_spki_hash)); | 207 gia_spki_hash)); |
| 208 EXPECT_EQ(net::CRLSet::GOOD, set->CheckSerial( | 208 EXPECT_EQ(net::CRLSet::GOOD, set->CheckSerial( |
| 209 std::string("\x47\x54\x3E\x79\x00\x03\x00\x00\x14\xF5", 10), | 209 std::string("\x47\x54\x3E\x79\x00\x03\x00\x00\x14\xF5", 10), |
| 210 gia_spki_hash)); | 210 gia_spki_hash)); |
| 211 |
| 212 EXPECT_FALSE(set->IsExpired()); |
| 211 } | 213 } |
| 212 | 214 |
| 213 TEST(CRLSetTest, NoOpDeltaUpdate) { | 215 TEST(CRLSetTest, NoOpDeltaUpdate) { |
| 214 base::StringPiece s(reinterpret_cast<const char*>(kGIACRLSet), | 216 base::StringPiece s(reinterpret_cast<const char*>(kGIACRLSet), |
| 215 sizeof(kGIACRLSet)); | 217 sizeof(kGIACRLSet)); |
| 216 scoped_refptr<net::CRLSet> set; | 218 scoped_refptr<net::CRLSet> set; |
| 217 EXPECT_TRUE(net::CRLSet::Parse(s, &set)); | 219 EXPECT_TRUE(net::CRLSet::Parse(s, &set)); |
| 218 ASSERT_TRUE(set.get() != NULL); | 220 ASSERT_TRUE(set.get() != NULL); |
| 219 | 221 |
| 220 scoped_refptr<net::CRLSet> delta_set; | 222 scoped_refptr<net::CRLSet> delta_set; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 227, 176, 196, 66, 152, 252, 28, 20, 154, 251, 244, 200, 153, 111, 185, 36, | 306 227, 176, 196, 66, 152, 252, 28, 20, 154, 251, 244, 200, 153, 111, 185, 36, |
| 305 39, 174, 65, 228, 100, 155, 147, 76, 164, 149, 153, 27, 120, 82, 184, 85, | 307 39, 174, 65, 228, 100, 155, 147, 76, 164, 149, 153, 27, 120, 82, 184, 85, |
| 306 0, | 308 0, |
| 307 }; | 309 }; |
| 308 | 310 |
| 309 EXPECT_EQ(net::CRLSet::GOOD, set->CheckSPKI("")); | 311 EXPECT_EQ(net::CRLSet::GOOD, set->CheckSPKI("")); |
| 310 EXPECT_EQ(net::CRLSet::REVOKED, set->CheckSPKI( | 312 EXPECT_EQ(net::CRLSet::REVOKED, set->CheckSPKI( |
| 311 reinterpret_cast<const char*>(spki_hash))); | 313 reinterpret_cast<const char*>(spki_hash))); |
| 312 } | 314 } |
| 313 | 315 |
| 314 TEST(CRLSetTest, Expires) { | 316 TEST(CRLSetTest, Expired) { |
| 315 // This CRLSet has an expiry value set to one second past midnight, 1st Jan, | 317 // This CRLSet has an expiry value set to one second past midnight, 1st Jan, |
| 316 // 1970. | 318 // 1970. |
| 317 base::StringPiece s(reinterpret_cast<const char*>(kExpiredCRLSet), | 319 base::StringPiece s(reinterpret_cast<const char*>(kExpiredCRLSet), |
| 318 sizeof(kExpiredCRLSet)); | 320 sizeof(kExpiredCRLSet)); |
| 319 scoped_refptr<net::CRLSet> set; | 321 scoped_refptr<net::CRLSet> set; |
| 320 EXPECT_TRUE(net::CRLSet::Parse(s, &set)); | 322 EXPECT_TRUE(net::CRLSet::Parse(s, &set)); |
| 321 ASSERT_TRUE(set.get() != NULL); | 323 ASSERT_TRUE(set.get() != NULL); |
| 322 | 324 |
| 323 EXPECT_EQ(net::CRLSet::CRL_SET_EXPIRED, set->CheckSerial( | 325 EXPECT_TRUE(set->IsExpired()); |
| 324 std::string("\x01", 1), "")); | |
| 325 } | 326 } |
| OLD | NEW |