OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/http/http_response_info.h" | 5 #include "net/http/http_response_info.h" |
6 | 6 |
7 #include "base/pickle.h" | 7 #include "base/pickle.h" |
8 #include "net/cert/signed_certificate_timestamp.h" | |
9 #include "net/cert/signed_certificate_timestamp_and_status.h" | |
8 #include "net/http/http_response_headers.h" | 10 #include "net/http/http_response_headers.h" |
11 #include "net/test/ct_test_util.h" | |
9 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
10 | 13 |
11 namespace net { | 14 namespace net { |
12 | 15 |
13 namespace { | 16 namespace { |
14 | 17 |
15 class HttpResponseInfoTest : public testing::Test { | 18 class HttpResponseInfoTest : public testing::Test { |
16 protected: | 19 protected: |
17 void SetUp() override { | 20 void SetUp() override { |
18 response_info_.headers = new HttpResponseHeaders(""); | 21 response_info_.headers = new HttpResponseHeaders(""); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 EXPECT_TRUE(response_info_clone.async_revalidation_required); | 86 EXPECT_TRUE(response_info_clone.async_revalidation_required); |
84 } | 87 } |
85 | 88 |
86 TEST_F(HttpResponseInfoTest, AsyncRevalidationRequiredNotPersisted) { | 89 TEST_F(HttpResponseInfoTest, AsyncRevalidationRequiredNotPersisted) { |
87 response_info_.async_revalidation_required = true; | 90 response_info_.async_revalidation_required = true; |
88 net::HttpResponseInfo restored_response_info; | 91 net::HttpResponseInfo restored_response_info; |
89 PickleAndRestore(response_info_, &restored_response_info); | 92 PickleAndRestore(response_info_, &restored_response_info); |
90 EXPECT_FALSE(restored_response_info.async_revalidation_required); | 93 EXPECT_FALSE(restored_response_info.async_revalidation_required); |
91 } | 94 } |
92 | 95 |
96 TEST_F(HttpResponseInfoTest, FailsInitFromPickleWithInvalidSCTStatus) { | |
97 scoped_refptr<ct::SignedCertificateTimestamp> sct; | |
98 ct::GetX509CertSCT(&sct); | |
99 | |
100 response_info_.ssl_info.signed_certificate_timestamps.push_back( | |
101 SignedCertificateTimestampAndStatus(sct, | |
102 static_cast<ct::SCTVerifyStatus>(2))); | |
103 | |
104 base::Pickle pickle; | |
105 response_info_.Persist(&pickle, false, false); | |
106 bool truncated = false; | |
107 net::HttpResponseInfo restored_response_info; | |
108 EXPECT_FALSE(restored_response_info.InitFromPickle(pickle, &truncated)); | |
estark
2016/08/31 22:03:33
I would find this test slightly more comforting if
Ryan Sleevi
2016/09/01 00:01:29
+1
Eran Messeri
2016/09/01 14:16:34
Good catch, thanks - turns out SCTs aren't seriali
| |
109 } | |
110 | |
93 } // namespace | 111 } // namespace |
94 | 112 |
95 } // namespace net | 113 } // namespace net |
OLD | NEW |