| 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/http/transport_security_state.h" | 5 #include "net/http/transport_security_state.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 void CheckHPKPReport( | 192 void CheckHPKPReport( |
| 193 const std::string& report, | 193 const std::string& report, |
| 194 const HostPortPair& host_port_pair, | 194 const HostPortPair& host_port_pair, |
| 195 bool include_subdomains, | 195 bool include_subdomains, |
| 196 const std::string& noted_hostname, | 196 const std::string& noted_hostname, |
| 197 const scoped_refptr<X509Certificate>& served_certificate_chain, | 197 const scoped_refptr<X509Certificate>& served_certificate_chain, |
| 198 const scoped_refptr<X509Certificate>& validated_certificate_chain, | 198 const scoped_refptr<X509Certificate>& validated_certificate_chain, |
| 199 const HashValueVector& known_pins) { | 199 const HashValueVector& known_pins) { |
| 200 std::unique_ptr<base::Value> value(base::JSONReader::Read(report)); | 200 std::unique_ptr<base::Value> value(base::JSONReader::Read(report)); |
| 201 ASSERT_TRUE(value); | 201 ASSERT_TRUE(value); |
| 202 ASSERT_TRUE(value->IsType(base::Value::TYPE_DICTIONARY)); | 202 ASSERT_TRUE(value->IsType(base::Value::Type::DICTIONARY)); |
| 203 | 203 |
| 204 base::DictionaryValue* report_dict; | 204 base::DictionaryValue* report_dict; |
| 205 ASSERT_TRUE(value->GetAsDictionary(&report_dict)); | 205 ASSERT_TRUE(value->GetAsDictionary(&report_dict)); |
| 206 | 206 |
| 207 std::string report_hostname; | 207 std::string report_hostname; |
| 208 EXPECT_TRUE(report_dict->GetString("hostname", &report_hostname)); | 208 EXPECT_TRUE(report_dict->GetString("hostname", &report_hostname)); |
| 209 EXPECT_EQ(host_port_pair.host(), report_hostname); | 209 EXPECT_EQ(host_port_pair.host(), report_hostname); |
| 210 | 210 |
| 211 int report_port; | 211 int report_port; |
| 212 EXPECT_TRUE(report_dict->GetInteger("port", &report_port)); | 212 EXPECT_TRUE(report_dict->GetInteger("port", &report_port)); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 // 6. The "validated-chain" and "serverd-chain" fields match those in | 257 // 6. The "validated-chain" and "serverd-chain" fields match those in |
| 258 // |ssl_info|. | 258 // |ssl_info|. |
| 259 void CheckSerializedExpectStapleReport(const std::string& report, | 259 void CheckSerializedExpectStapleReport(const std::string& report, |
| 260 const HostPortPair& host_port_pair, | 260 const HostPortPair& host_port_pair, |
| 261 const SSLInfo& ssl_info, | 261 const SSLInfo& ssl_info, |
| 262 const std::string& ocsp_response, | 262 const std::string& ocsp_response, |
| 263 const std::string& response_status, | 263 const std::string& response_status, |
| 264 const std::string& cert_status) { | 264 const std::string& cert_status) { |
| 265 std::unique_ptr<base::Value> value(base::JSONReader::Read(report)); | 265 std::unique_ptr<base::Value> value(base::JSONReader::Read(report)); |
| 266 ASSERT_TRUE(value); | 266 ASSERT_TRUE(value); |
| 267 ASSERT_TRUE(value->IsType(base::Value::TYPE_DICTIONARY)); | 267 ASSERT_TRUE(value->IsType(base::Value::Type::DICTIONARY)); |
| 268 | 268 |
| 269 base::DictionaryValue* report_dict; | 269 base::DictionaryValue* report_dict; |
| 270 ASSERT_TRUE(value->GetAsDictionary(&report_dict)); | 270 ASSERT_TRUE(value->GetAsDictionary(&report_dict)); |
| 271 | 271 |
| 272 std::string report_hostname; | 272 std::string report_hostname; |
| 273 EXPECT_TRUE(report_dict->GetString("hostname", &report_hostname)); | 273 EXPECT_TRUE(report_dict->GetString("hostname", &report_hostname)); |
| 274 EXPECT_EQ(host_port_pair.host(), report_hostname); | 274 EXPECT_EQ(host_port_pair.host(), report_hostname); |
| 275 | 275 |
| 276 int report_port; | 276 int report_port; |
| 277 EXPECT_TRUE(report_dict->GetInteger("port", &report_port)); | 277 EXPECT_TRUE(report_dict->GetInteger("port", &report_port)); |
| (...skipping 2054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2332 base::FieldTrialList::CreateFieldTrial("EnforceCTForProblematicRoots", | 2332 base::FieldTrialList::CreateFieldTrial("EnforceCTForProblematicRoots", |
| 2333 "disabled"); | 2333 "disabled"); |
| 2334 | 2334 |
| 2335 EXPECT_FALSE( | 2335 EXPECT_FALSE( |
| 2336 state.ShouldRequireCT("www.example.com", before_cert.get(), hashes)); | 2336 state.ShouldRequireCT("www.example.com", before_cert.get(), hashes)); |
| 2337 EXPECT_FALSE( | 2337 EXPECT_FALSE( |
| 2338 state.ShouldRequireCT("www.example.com", after_cert.get(), hashes)); | 2338 state.ShouldRequireCT("www.example.com", after_cert.get(), hashes)); |
| 2339 } | 2339 } |
| 2340 | 2340 |
| 2341 } // namespace net | 2341 } // namespace net |
| OLD | NEW |