| 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 |
| 11 #include "base/base64.h" | 11 #include "base/base64.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/json/json_reader.h" | 13 #include "base/json/json_reader.h" |
| 14 #include "base/memory/ptr_util.h" |
| 14 #include "base/metrics/field_trial.h" | 15 #include "base/metrics/field_trial.h" |
| 15 #include "base/rand_util.h" | 16 #include "base/rand_util.h" |
| 16 #include "base/sha1.h" | 17 #include "base/sha1.h" |
| 17 #include "base/strings/string_piece.h" | 18 #include "base/strings/string_piece.h" |
| 18 #include "base/test/histogram_tester.h" | 19 #include "base/test/histogram_tester.h" |
| 19 #include "base/test/mock_entropy_provider.h" | 20 #include "base/test/mock_entropy_provider.h" |
| 20 #include "base/values.h" | 21 #include "base/values.h" |
| 21 #include "crypto/openssl_util.h" | 22 #include "crypto/openssl_util.h" |
| 22 #include "crypto/sha2.h" | 23 #include "crypto/sha2.h" |
| 23 #include "net/base/host_port_pair.h" | 24 #include "net/base/host_port_pair.h" |
| (...skipping 2284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2308 | 2309 |
| 2309 EXPECT_FALSE(state.ShouldRequireCT("www.example.com", before_cert.get(), | 2310 EXPECT_FALSE(state.ShouldRequireCT("www.example.com", before_cert.get(), |
| 2310 unrelated_hashes)); | 2311 unrelated_hashes)); |
| 2311 EXPECT_FALSE(state.ShouldRequireCT("www.example.com", after_cert.get(), | 2312 EXPECT_FALSE(state.ShouldRequireCT("www.example.com", after_cert.get(), |
| 2312 unrelated_hashes)); | 2313 unrelated_hashes)); |
| 2313 | 2314 |
| 2314 // And the emergency field trial should disable the requirement, if | 2315 // And the emergency field trial should disable the requirement, if |
| 2315 // necessary. | 2316 // necessary. |
| 2316 hashes.clear(); | 2317 hashes.clear(); |
| 2317 hashes.push_back(HashValue(symantec_hash_value)); | 2318 hashes.push_back(HashValue(symantec_hash_value)); |
| 2318 base::FieldTrialList field_trial_list(new base::MockEntropyProvider()); | 2319 base::FieldTrialList field_trial_list( |
| 2320 base::MakeUnique<base::MockEntropyProvider>()); |
| 2319 base::FieldTrialList::CreateFieldTrial("EnforceCTForProblematicRoots", | 2321 base::FieldTrialList::CreateFieldTrial("EnforceCTForProblematicRoots", |
| 2320 "disabled"); | 2322 "disabled"); |
| 2321 | 2323 |
| 2322 EXPECT_FALSE( | 2324 EXPECT_FALSE( |
| 2323 state.ShouldRequireCT("www.example.com", before_cert.get(), hashes)); | 2325 state.ShouldRequireCT("www.example.com", before_cert.get(), hashes)); |
| 2324 EXPECT_FALSE( | 2326 EXPECT_FALSE( |
| 2325 state.ShouldRequireCT("www.example.com", after_cert.get(), hashes)); | 2327 state.ShouldRequireCT("www.example.com", after_cert.get(), hashes)); |
| 2326 } | 2328 } |
| 2327 | 2329 |
| 2328 } // namespace net | 2330 } // namespace net |
| OLD | NEW |