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" | |
9 #include "base/run_loop.h" | |
10 #include "build/build_config.h" | |
11 | |
12 #if defined(OS_WIN) | 8 #if defined(OS_WIN) |
13 #include <windows.h> | 9 #include <windows.h> |
14 #include <objbase.h> | 10 #include <objbase.h> |
15 #include <shlobj.h> | 11 #include <shlobj.h> |
16 #endif | 12 #endif |
17 | 13 |
18 #include <stdint.h> | 14 #include <stdint.h> |
19 | 15 |
20 #include <algorithm> | 16 #include <algorithm> |
21 #include <limits> | 17 #include <limits> |
(...skipping 18 matching lines...) Expand all Loading... |
40 #include "base/single_thread_task_runner.h" | 36 #include "base/single_thread_task_runner.h" |
41 #include "base/strings/string_number_conversions.h" | 37 #include "base/strings/string_number_conversions.h" |
42 #include "base/strings/string_piece.h" | 38 #include "base/strings/string_piece.h" |
43 #include "base/strings/string_split.h" | 39 #include "base/strings/string_split.h" |
44 #include "base/strings/string_util.h" | 40 #include "base/strings/string_util.h" |
45 #include "base/strings/stringprintf.h" | 41 #include "base/strings/stringprintf.h" |
46 #include "base/strings/utf_string_conversions.h" | 42 #include "base/strings/utf_string_conversions.h" |
47 #include "base/test/histogram_tester.h" | 43 #include "base/test/histogram_tester.h" |
48 #include "base/threading/thread_task_runner_handle.h" | 44 #include "base/threading/thread_task_runner_handle.h" |
49 #include "base/values.h" | 45 #include "base/values.h" |
| 46 #include "build/build_config.h" |
| 47 #include "build/buildflag.h" |
50 #include "net/base/chunked_upload_data_stream.h" | 48 #include "net/base/chunked_upload_data_stream.h" |
51 #include "net/base/directory_listing.h" | 49 #include "net/base/directory_listing.h" |
52 #include "net/base/elements_upload_data_stream.h" | 50 #include "net/base/elements_upload_data_stream.h" |
53 #include "net/base/load_flags.h" | 51 #include "net/base/load_flags.h" |
54 #include "net/base/load_timing_info.h" | 52 #include "net/base/load_timing_info.h" |
55 #include "net/base/load_timing_info_test_util.h" | 53 #include "net/base/load_timing_info_test_util.h" |
56 #include "net/base/net_errors.h" | 54 #include "net/base/net_errors.h" |
57 #include "net/base/net_module.h" | 55 #include "net/base/net_module.h" |
58 #include "net/base/request_priority.h" | 56 #include "net/base/request_priority.h" |
59 #include "net/base/test_completion_callback.h" | 57 #include "net/base/test_completion_callback.h" |
(...skipping 26 matching lines...) Expand all Loading... |
86 #include "net/log/net_log_source.h" | 84 #include "net/log/net_log_source.h" |
87 #include "net/log/test_net_log.h" | 85 #include "net/log/test_net_log.h" |
88 #include "net/log/test_net_log_entry.h" | 86 #include "net/log/test_net_log_entry.h" |
89 #include "net/log/test_net_log_util.h" | 87 #include "net/log/test_net_log_util.h" |
90 #include "net/net_features.h" | 88 #include "net/net_features.h" |
91 #include "net/nqe/external_estimate_provider.h" | 89 #include "net/nqe/external_estimate_provider.h" |
92 #include "net/proxy/proxy_server.h" | 90 #include "net/proxy/proxy_server.h" |
93 #include "net/proxy/proxy_service.h" | 91 #include "net/proxy/proxy_service.h" |
94 #include "net/quic/chromium/mock_crypto_client_stream_factory.h" | 92 #include "net/quic/chromium/mock_crypto_client_stream_factory.h" |
95 #include "net/quic/chromium/quic_server_info.h" | 93 #include "net/quic/chromium/quic_server_info.h" |
96 #include "net/reporting/reporting_service.h" | |
97 #include "net/socket/socket_test_util.h" | 94 #include "net/socket/socket_test_util.h" |
98 #include "net/socket/ssl_client_socket.h" | 95 #include "net/socket/ssl_client_socket.h" |
99 #include "net/ssl/channel_id_service.h" | 96 #include "net/ssl/channel_id_service.h" |
100 #include "net/ssl/default_channel_id_store.h" | 97 #include "net/ssl/default_channel_id_store.h" |
101 #include "net/ssl/ssl_connection_status_flags.h" | 98 #include "net/ssl/ssl_connection_status_flags.h" |
102 #include "net/ssl/ssl_server_config.h" | 99 #include "net/ssl/ssl_server_config.h" |
103 #include "net/ssl/token_binding.h" | 100 #include "net/ssl/token_binding.h" |
104 #include "net/test/cert_test_util.h" | 101 #include "net/test/cert_test_util.h" |
105 #include "net/test/embedded_test_server/embedded_test_server.h" | 102 #include "net/test/embedded_test_server/embedded_test_server.h" |
106 #include "net/test/embedded_test_server/http_request.h" | 103 #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) | 131 #if !BUILDFLAG(DISABLE_FTP_SUPPORT) && !defined(OS_ANDROID) |
135 #include "net/ftp/ftp_network_layer.h" | 132 #include "net/ftp/ftp_network_layer.h" |
136 #include "net/url_request/ftp_protocol_handler.h" | 133 #include "net/url_request/ftp_protocol_handler.h" |
137 #endif | 134 #endif |
138 | 135 |
139 #if defined(OS_WIN) | 136 #if defined(OS_WIN) |
140 #include "base/win/scoped_com_initializer.h" | 137 #include "base/win/scoped_com_initializer.h" |
141 #include "base/win/scoped_comptr.h" | 138 #include "base/win/scoped_comptr.h" |
142 #endif | 139 #endif |
143 | 140 |
| 141 #if BUILDFLAG(ENABLE_REPORTING) |
| 142 #include "net/reporting/reporting_service.h" |
| 143 #endif // BUILDFLAG(ENABLE_REPORTING) |
| 144 |
144 using net::test::IsError; | 145 using net::test::IsError; |
145 using net::test::IsOk; | 146 using net::test::IsOk; |
146 | 147 |
147 using base::ASCIIToUTF16; | 148 using base::ASCIIToUTF16; |
148 using base::Time; | 149 using base::Time; |
149 using std::string; | 150 using std::string; |
150 | 151 |
151 namespace net { | 152 namespace net { |
152 | 153 |
153 namespace { | 154 namespace { |
(...skipping 6638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6792 GURL::Replacements replace_host; | 6793 GURL::Replacements replace_host; |
6793 replace_host.SetHostStr(kExpectCTStaticHostname); | 6794 replace_host.SetHostStr(kExpectCTStaticHostname); |
6794 url = url.ReplaceComponents(replace_host); | 6795 url = url.ReplaceComponents(replace_host); |
6795 std::unique_ptr<URLRequest> violating_request(context.CreateRequest( | 6796 std::unique_ptr<URLRequest> violating_request(context.CreateRequest( |
6796 url, DEFAULT_PRIORITY, &d, TRAFFIC_ANNOTATION_FOR_TESTS)); | 6797 url, DEFAULT_PRIORITY, &d, TRAFFIC_ANNOTATION_FOR_TESTS)); |
6797 violating_request->Start(); | 6798 violating_request->Start(); |
6798 base::RunLoop().Run(); | 6799 base::RunLoop().Run(); |
6799 | 6800 |
6800 EXPECT_EQ(1u, reporter.num_failures()); | 6801 EXPECT_EQ(1u, reporter.num_failures()); |
6801 } | 6802 } |
| 6803 #endif // !defined(OS_IOS) |
6802 | 6804 |
| 6805 #if BUILDFLAG(ENABLE_REPORTING) |
6803 namespace { | 6806 namespace { |
6804 | 6807 |
6805 class TestReportingService : public ReportingService { | 6808 class TestReportingService : public ReportingService { |
6806 public: | 6809 public: |
6807 struct Header { | 6810 struct Header { |
6808 GURL url; | 6811 GURL url; |
6809 std::string header_value; | 6812 std::string header_value; |
6810 }; | 6813 }; |
6811 | 6814 |
6812 const std::vector<Header>& headers() { return headers_; } | 6815 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); | 6932 d.set_allow_certificate_errors(true); |
6930 std::unique_ptr<URLRequest> request(context.CreateRequest( | 6933 std::unique_ptr<URLRequest> request(context.CreateRequest( |
6931 request_url, DEFAULT_PRIORITY, &d, TRAFFIC_ANNOTATION_FOR_TESTS)); | 6934 request_url, DEFAULT_PRIORITY, &d, TRAFFIC_ANNOTATION_FOR_TESTS)); |
6932 request->Start(); | 6935 request->Start(); |
6933 base::RunLoop().Run(); | 6936 base::RunLoop().Run(); |
6934 | 6937 |
6935 EXPECT_TRUE(d.have_certificate_errors()); | 6938 EXPECT_TRUE(d.have_certificate_errors()); |
6936 EXPECT_TRUE(IsCertStatusError(request->ssl_info().cert_status)); | 6939 EXPECT_TRUE(IsCertStatusError(request->ssl_info().cert_status)); |
6937 EXPECT_TRUE(reporting_service.headers().empty()); | 6940 EXPECT_TRUE(reporting_service.headers().empty()); |
6938 } | 6941 } |
6939 | 6942 #endif // BUILDFLAG(ENABLE_REPORTING) |
6940 #endif // !defined(OS_IOS) | |
6941 | 6943 |
6942 TEST_F(URLRequestTestHTTP, ContentTypeNormalizationTest) { | 6944 TEST_F(URLRequestTestHTTP, ContentTypeNormalizationTest) { |
6943 ASSERT_TRUE(http_test_server()->Start()); | 6945 ASSERT_TRUE(http_test_server()->Start()); |
6944 | 6946 |
6945 TestDelegate d; | 6947 TestDelegate d; |
6946 std::unique_ptr<URLRequest> req(default_context_.CreateRequest( | 6948 std::unique_ptr<URLRequest> req(default_context_.CreateRequest( |
6947 http_test_server()->GetURL("/content-type-normalization.html"), | 6949 http_test_server()->GetURL("/content-type-normalization.html"), |
6948 DEFAULT_PRIORITY, &d, TRAFFIC_ANNOTATION_FOR_TESTS)); | 6950 DEFAULT_PRIORITY, &d, TRAFFIC_ANNOTATION_FOR_TESTS)); |
6949 req->Start(); | 6951 req->Start(); |
6950 base::RunLoop().Run(); | 6952 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)); | 11347 AddTestInterceptor()->set_main_intercept_job(std::move(job)); |
11346 | 11348 |
11347 req->Start(); | 11349 req->Start(); |
11348 req->Cancel(); | 11350 req->Cancel(); |
11349 base::RunLoop().RunUntilIdle(); | 11351 base::RunLoop().RunUntilIdle(); |
11350 EXPECT_EQ(ERR_ABORTED, d.request_status()); | 11352 EXPECT_EQ(ERR_ABORTED, d.request_status()); |
11351 EXPECT_EQ(0, d.received_redirect_count()); | 11353 EXPECT_EQ(0, d.received_redirect_count()); |
11352 } | 11354 } |
11353 | 11355 |
11354 } // namespace net | 11356 } // namespace net |
OLD | NEW |