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" |
pauljensen
2017/06/28 13:54:23
#include "build/buildflag.h"
mmenke
2017/06/28 17:58:48
Done. I just assumed since this one had a bunch o
| |
11 | 11 |
12 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
13 #include <windows.h> | 13 #include <windows.h> |
14 #include <objbase.h> | 14 #include <objbase.h> |
15 #include <shlobj.h> | 15 #include <shlobj.h> |
16 #endif | 16 #endif |
17 | 17 |
18 #include <stdint.h> | 18 #include <stdint.h> |
19 | 19 |
20 #include <algorithm> | 20 #include <algorithm> |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
86 #include "net/log/net_log_source.h" | 86 #include "net/log/net_log_source.h" |
87 #include "net/log/test_net_log.h" | 87 #include "net/log/test_net_log.h" |
88 #include "net/log/test_net_log_entry.h" | 88 #include "net/log/test_net_log_entry.h" |
89 #include "net/log/test_net_log_util.h" | 89 #include "net/log/test_net_log_util.h" |
90 #include "net/net_features.h" | 90 #include "net/net_features.h" |
91 #include "net/nqe/external_estimate_provider.h" | 91 #include "net/nqe/external_estimate_provider.h" |
92 #include "net/proxy/proxy_server.h" | 92 #include "net/proxy/proxy_server.h" |
93 #include "net/proxy/proxy_service.h" | 93 #include "net/proxy/proxy_service.h" |
94 #include "net/quic/chromium/mock_crypto_client_stream_factory.h" | 94 #include "net/quic/chromium/mock_crypto_client_stream_factory.h" |
95 #include "net/quic/chromium/quic_server_info.h" | 95 #include "net/quic/chromium/quic_server_info.h" |
96 #include "net/reporting/reporting_service.h" | |
97 #include "net/socket/socket_test_util.h" | 96 #include "net/socket/socket_test_util.h" |
98 #include "net/socket/ssl_client_socket.h" | 97 #include "net/socket/ssl_client_socket.h" |
99 #include "net/ssl/channel_id_service.h" | 98 #include "net/ssl/channel_id_service.h" |
100 #include "net/ssl/default_channel_id_store.h" | 99 #include "net/ssl/default_channel_id_store.h" |
101 #include "net/ssl/ssl_connection_status_flags.h" | 100 #include "net/ssl/ssl_connection_status_flags.h" |
102 #include "net/ssl/ssl_server_config.h" | 101 #include "net/ssl/ssl_server_config.h" |
103 #include "net/ssl/token_binding.h" | 102 #include "net/ssl/token_binding.h" |
104 #include "net/test/cert_test_util.h" | 103 #include "net/test/cert_test_util.h" |
105 #include "net/test/embedded_test_server/embedded_test_server.h" | 104 #include "net/test/embedded_test_server/embedded_test_server.h" |
106 #include "net/test/embedded_test_server/http_request.h" | 105 #include "net/test/embedded_test_server/http_request.h" |
(...skipping 27 matching lines...) Expand all Loading... | |
134 #if !BUILDFLAG(DISABLE_FTP_SUPPORT) && !defined(OS_ANDROID) | 133 #if !BUILDFLAG(DISABLE_FTP_SUPPORT) && !defined(OS_ANDROID) |
135 #include "net/ftp/ftp_network_layer.h" | 134 #include "net/ftp/ftp_network_layer.h" |
136 #include "net/url_request/ftp_protocol_handler.h" | 135 #include "net/url_request/ftp_protocol_handler.h" |
137 #endif | 136 #endif |
138 | 137 |
139 #if defined(OS_WIN) | 138 #if defined(OS_WIN) |
140 #include "base/win/scoped_com_initializer.h" | 139 #include "base/win/scoped_com_initializer.h" |
141 #include "base/win/scoped_comptr.h" | 140 #include "base/win/scoped_comptr.h" |
142 #endif | 141 #endif |
143 | 142 |
143 #if BUILDFLAG(ENABLE_REPORTING) | |
144 #include "net/reporting/reporting_service.h" | |
145 #endif // BUILDFLAG(ENABLE_REPORTING) | |
146 | |
144 using net::test::IsError; | 147 using net::test::IsError; |
145 using net::test::IsOk; | 148 using net::test::IsOk; |
146 | 149 |
147 using base::ASCIIToUTF16; | 150 using base::ASCIIToUTF16; |
148 using base::Time; | 151 using base::Time; |
149 using std::string; | 152 using std::string; |
150 | 153 |
151 namespace net { | 154 namespace net { |
152 | 155 |
153 namespace { | 156 namespace { |
(...skipping 6638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6792 GURL::Replacements replace_host; | 6795 GURL::Replacements replace_host; |
6793 replace_host.SetHostStr(kExpectCTStaticHostname); | 6796 replace_host.SetHostStr(kExpectCTStaticHostname); |
6794 url = url.ReplaceComponents(replace_host); | 6797 url = url.ReplaceComponents(replace_host); |
6795 std::unique_ptr<URLRequest> violating_request(context.CreateRequest( | 6798 std::unique_ptr<URLRequest> violating_request(context.CreateRequest( |
6796 url, DEFAULT_PRIORITY, &d, TRAFFIC_ANNOTATION_FOR_TESTS)); | 6799 url, DEFAULT_PRIORITY, &d, TRAFFIC_ANNOTATION_FOR_TESTS)); |
6797 violating_request->Start(); | 6800 violating_request->Start(); |
6798 base::RunLoop().Run(); | 6801 base::RunLoop().Run(); |
6799 | 6802 |
6800 EXPECT_EQ(1u, reporter.num_failures()); | 6803 EXPECT_EQ(1u, reporter.num_failures()); |
6801 } | 6804 } |
6805 #endif // !defined(OS_IOS) | |
6802 | 6806 |
6807 #if BUILDFLAG(ENABLE_REPORTING) | |
6803 namespace { | 6808 namespace { |
6804 | 6809 |
6805 class TestReportingService : public ReportingService { | 6810 class TestReportingService : public ReportingService { |
6806 public: | 6811 public: |
6807 struct Header { | 6812 struct Header { |
6808 GURL url; | 6813 GURL url; |
6809 std::string header_value; | 6814 std::string header_value; |
6810 }; | 6815 }; |
6811 | 6816 |
6812 const std::vector<Header>& headers() { return headers_; } | 6817 const std::vector<Header>& headers() { return headers_; } |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6929 d.set_allow_certificate_errors(true); | 6934 d.set_allow_certificate_errors(true); |
6930 std::unique_ptr<URLRequest> request(context.CreateRequest( | 6935 std::unique_ptr<URLRequest> request(context.CreateRequest( |
6931 request_url, DEFAULT_PRIORITY, &d, TRAFFIC_ANNOTATION_FOR_TESTS)); | 6936 request_url, DEFAULT_PRIORITY, &d, TRAFFIC_ANNOTATION_FOR_TESTS)); |
6932 request->Start(); | 6937 request->Start(); |
6933 base::RunLoop().Run(); | 6938 base::RunLoop().Run(); |
6934 | 6939 |
6935 EXPECT_TRUE(d.have_certificate_errors()); | 6940 EXPECT_TRUE(d.have_certificate_errors()); |
6936 EXPECT_TRUE(IsCertStatusError(request->ssl_info().cert_status)); | 6941 EXPECT_TRUE(IsCertStatusError(request->ssl_info().cert_status)); |
6937 EXPECT_TRUE(reporting_service.headers().empty()); | 6942 EXPECT_TRUE(reporting_service.headers().empty()); |
6938 } | 6943 } |
6939 | 6944 #endif // BUILDFLAG(ENABLE_REPORTING) |
6940 #endif // !defined(OS_IOS) | |
6941 | 6945 |
6942 TEST_F(URLRequestTestHTTP, ContentTypeNormalizationTest) { | 6946 TEST_F(URLRequestTestHTTP, ContentTypeNormalizationTest) { |
6943 ASSERT_TRUE(http_test_server()->Start()); | 6947 ASSERT_TRUE(http_test_server()->Start()); |
6944 | 6948 |
6945 TestDelegate d; | 6949 TestDelegate d; |
6946 std::unique_ptr<URLRequest> req(default_context_.CreateRequest( | 6950 std::unique_ptr<URLRequest> req(default_context_.CreateRequest( |
6947 http_test_server()->GetURL("/content-type-normalization.html"), | 6951 http_test_server()->GetURL("/content-type-normalization.html"), |
6948 DEFAULT_PRIORITY, &d, TRAFFIC_ANNOTATION_FOR_TESTS)); | 6952 DEFAULT_PRIORITY, &d, TRAFFIC_ANNOTATION_FOR_TESTS)); |
6949 req->Start(); | 6953 req->Start(); |
6950 base::RunLoop().Run(); | 6954 base::RunLoop().Run(); |
(...skipping 4394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11345 AddTestInterceptor()->set_main_intercept_job(std::move(job)); | 11349 AddTestInterceptor()->set_main_intercept_job(std::move(job)); |
11346 | 11350 |
11347 req->Start(); | 11351 req->Start(); |
11348 req->Cancel(); | 11352 req->Cancel(); |
11349 base::RunLoop().RunUntilIdle(); | 11353 base::RunLoop().RunUntilIdle(); |
11350 EXPECT_EQ(ERR_ABORTED, d.request_status()); | 11354 EXPECT_EQ(ERR_ABORTED, d.request_status()); |
11351 EXPECT_EQ(0, d.received_redirect_count()); | 11355 EXPECT_EQ(0, d.received_redirect_count()); |
11352 } | 11356 } |
11353 | 11357 |
11354 } // namespace net | 11358 } // namespace net |
OLD | NEW |