| 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 <memory> | 5 #include <memory> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 6764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6775 // Use a MockHostResolver (which by default maps all hosts to | 6775 // Use a MockHostResolver (which by default maps all hosts to |
| 6776 // 127.0.0.1) so that the request can be sent to a site on the Expect | 6776 // 127.0.0.1) so that the request can be sent to a site on the Expect |
| 6777 // CT preload list. | 6777 // CT preload list. |
| 6778 MockHostResolver host_resolver; | 6778 MockHostResolver host_resolver; |
| 6779 TestURLRequestContext context(true); | 6779 TestURLRequestContext context(true); |
| 6780 context.set_host_resolver(&host_resolver); | 6780 context.set_host_resolver(&host_resolver); |
| 6781 context.set_transport_security_state(&transport_security_state); | 6781 context.set_transport_security_state(&transport_security_state); |
| 6782 context.set_network_delegate(&network_delegate); | 6782 context.set_network_delegate(&network_delegate); |
| 6783 context.set_cert_verifier(&cert_verifier); | 6783 context.set_cert_verifier(&cert_verifier); |
| 6784 context.set_cert_transparency_verifier(&ct_verifier); | 6784 context.set_cert_transparency_verifier(&ct_verifier); |
| 6785 context.set_ct_policy_enforcer(std::move(&ct_policy_enforcer)); | 6785 context.set_ct_policy_enforcer(&ct_policy_enforcer); |
| 6786 context.Init(); | 6786 context.Init(); |
| 6787 | 6787 |
| 6788 // Now send a request to trigger the violation. | 6788 // Now send a request to trigger the violation. |
| 6789 TestDelegate d; | 6789 TestDelegate d; |
| 6790 GURL url = https_test_server.GetURL("/expect-ct-header.html"); | 6790 GURL url = https_test_server.GetURL("/expect-ct-header.html"); |
| 6791 GURL::Replacements replace_host; | 6791 GURL::Replacements replace_host; |
| 6792 replace_host.SetHostStr(kExpectCTStaticHostname); | 6792 replace_host.SetHostStr(kExpectCTStaticHostname); |
| 6793 url = url.ReplaceComponents(replace_host); | 6793 url = url.ReplaceComponents(replace_host); |
| 6794 std::unique_ptr<URLRequest> violating_request(context.CreateRequest( | 6794 std::unique_ptr<URLRequest> violating_request(context.CreateRequest( |
| 6795 url, DEFAULT_PRIORITY, &d, TRAFFIC_ANNOTATION_FOR_TESTS)); | 6795 url, DEFAULT_PRIORITY, &d, TRAFFIC_ANNOTATION_FOR_TESTS)); |
| (...skipping 4437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11233 AddTestInterceptor()->set_main_intercept_job(std::move(job)); | 11233 AddTestInterceptor()->set_main_intercept_job(std::move(job)); |
| 11234 | 11234 |
| 11235 req->Start(); | 11235 req->Start(); |
| 11236 req->Cancel(); | 11236 req->Cancel(); |
| 11237 base::RunLoop().RunUntilIdle(); | 11237 base::RunLoop().RunUntilIdle(); |
| 11238 EXPECT_EQ(ERR_ABORTED, d.request_status()); | 11238 EXPECT_EQ(ERR_ABORTED, d.request_status()); |
| 11239 EXPECT_EQ(0, d.received_redirect_count()); | 11239 EXPECT_EQ(0, d.received_redirect_count()); |
| 11240 } | 11240 } |
| 11241 | 11241 |
| 11242 } // namespace net | 11242 } // namespace net |
| OLD | NEW |