| 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" | 8 #include "net/cert/signed_certificate_timestamp.h" |
| 9 #include "net/cert/signed_certificate_timestamp_and_status.h" | 9 #include "net/cert/signed_certificate_timestamp_and_status.h" |
| 10 #include "net/http/http_response_headers.h" | 10 #include "net/http/http_response_headers.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 EXPECT_TRUE(restored_response_info.ssl_info.pkp_bypassed); | 65 EXPECT_TRUE(restored_response_info.ssl_info.pkp_bypassed); |
| 66 } | 66 } |
| 67 | 67 |
| 68 TEST_F(HttpResponseInfoTest, PKPBypassPersistFalse) { | 68 TEST_F(HttpResponseInfoTest, PKPBypassPersistFalse) { |
| 69 response_info_.ssl_info.pkp_bypassed = false; | 69 response_info_.ssl_info.pkp_bypassed = false; |
| 70 HttpResponseInfo restored_response_info; | 70 HttpResponseInfo restored_response_info; |
| 71 PickleAndRestore(response_info_, &restored_response_info); | 71 PickleAndRestore(response_info_, &restored_response_info); |
| 72 EXPECT_FALSE(restored_response_info.ssl_info.pkp_bypassed); | 72 EXPECT_FALSE(restored_response_info.ssl_info.pkp_bypassed); |
| 73 } | 73 } |
| 74 | 74 |
| 75 TEST_F(HttpResponseInfoTest, AsyncRevalidationRequiredDefault) { | |
| 76 EXPECT_FALSE(response_info_.async_revalidation_required); | |
| 77 } | |
| 78 | |
| 79 TEST_F(HttpResponseInfoTest, AsyncRevalidationRequiredCopy) { | |
| 80 response_info_.async_revalidation_required = true; | |
| 81 net::HttpResponseInfo response_info_clone(response_info_); | |
| 82 EXPECT_TRUE(response_info_clone.async_revalidation_required); | |
| 83 } | |
| 84 | |
| 85 TEST_F(HttpResponseInfoTest, AsyncRevalidationRequiredAssign) { | |
| 86 response_info_.async_revalidation_required = true; | |
| 87 net::HttpResponseInfo response_info_clone; | |
| 88 response_info_clone = response_info_; | |
| 89 EXPECT_TRUE(response_info_clone.async_revalidation_required); | |
| 90 } | |
| 91 | |
| 92 TEST_F(HttpResponseInfoTest, AsyncRevalidationRequiredNotPersisted) { | |
| 93 response_info_.async_revalidation_required = true; | |
| 94 net::HttpResponseInfo restored_response_info; | |
| 95 PickleAndRestore(response_info_, &restored_response_info); | |
| 96 EXPECT_FALSE(restored_response_info.async_revalidation_required); | |
| 97 } | |
| 98 | |
| 99 TEST_F(HttpResponseInfoTest, FailsInitFromPickleWithInvalidSCTStatus) { | 75 TEST_F(HttpResponseInfoTest, FailsInitFromPickleWithInvalidSCTStatus) { |
| 100 // A valid certificate is needed for ssl_info.is_valid() to be true | 76 // A valid certificate is needed for ssl_info.is_valid() to be true |
| 101 // so that the SCTs would be serialized. | 77 // so that the SCTs would be serialized. |
| 102 response_info_.ssl_info.cert = | 78 response_info_.ssl_info.cert = |
| 103 ImportCertFromFile(GetTestCertsDirectory(), "ok_cert.pem"); | 79 ImportCertFromFile(GetTestCertsDirectory(), "ok_cert.pem"); |
| 104 | 80 |
| 105 scoped_refptr<ct::SignedCertificateTimestamp> sct; | 81 scoped_refptr<ct::SignedCertificateTimestamp> sct; |
| 106 ct::GetX509CertSCT(&sct); | 82 ct::GetX509CertSCT(&sct); |
| 107 | 83 |
| 108 response_info_.ssl_info.signed_certificate_timestamps.push_back( | 84 response_info_.ssl_info.signed_certificate_timestamps.push_back( |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 &response_info_.ssl_info.connection_status); | 159 &response_info_.ssl_info.connection_status); |
| 184 response_info_.ssl_info.key_exchange_group = 1024; | 160 response_info_.ssl_info.key_exchange_group = 1024; |
| 185 net::HttpResponseInfo restored_response_info; | 161 net::HttpResponseInfo restored_response_info; |
| 186 PickleAndRestore(response_info_, &restored_response_info); | 162 PickleAndRestore(response_info_, &restored_response_info); |
| 187 EXPECT_EQ(0, restored_response_info.ssl_info.key_exchange_group); | 163 EXPECT_EQ(0, restored_response_info.ssl_info.key_exchange_group); |
| 188 } | 164 } |
| 189 | 165 |
| 190 } // namespace | 166 } // namespace |
| 191 | 167 |
| 192 } // namespace net | 168 } // namespace net |
| OLD | NEW |