Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: net/url_request/url_request_unittest.cc

Issue 16901013: Expose receive header end time for URLRequestRedirectJob (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: set send_start and send_end Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/url_request/url_request_redirect_job.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 #endif 10 #endif
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 ExpectConnectTimingHasNoTimes(load_timing_info.connect_timing); 169 ExpectConnectTimingHasNoTimes(load_timing_info.connect_timing);
170 EXPECT_LE(load_timing_info.request_start, load_timing_info.send_start); 170 EXPECT_LE(load_timing_info.request_start, load_timing_info.send_start);
171 EXPECT_LE(load_timing_info.send_start, load_timing_info.send_end); 171 EXPECT_LE(load_timing_info.send_start, load_timing_info.send_end);
172 EXPECT_LE(load_timing_info.send_end, load_timing_info.receive_headers_end); 172 EXPECT_LE(load_timing_info.send_end, load_timing_info.receive_headers_end);
173 173
174 EXPECT_TRUE(load_timing_info.proxy_resolve_start.is_null()); 174 EXPECT_TRUE(load_timing_info.proxy_resolve_start.is_null());
175 EXPECT_TRUE(load_timing_info.proxy_resolve_end.is_null()); 175 EXPECT_TRUE(load_timing_info.proxy_resolve_end.is_null());
176 } 176 }
177 177
178 // Tests load timing information in the case of a HSTS redirect occurred.
179 void TestLoadTimingHSTSRedirectOccured(
180 const net::LoadTimingInfo& load_timing_info) {
181 EXPECT_FALSE(load_timing_info.socket_reused);
182 EXPECT_EQ(net::NetLog::Source::kInvalidId, load_timing_info.socket_log_id);
183
184 EXPECT_FALSE(load_timing_info.request_start_time.is_null());
185 EXPECT_FALSE(load_timing_info.request_start.is_null());
186
187 ExpectConnectTimingHasNoTimes(load_timing_info.connect_timing);
188 EXPECT_TRUE(load_timing_info.proxy_resolve_start.is_null());
189 EXPECT_TRUE(load_timing_info.proxy_resolve_end.is_null());
190 EXPECT_EQ(load_timing_info.send_start, load_timing_info.receive_headers_end);
191 EXPECT_EQ(load_timing_info.send_end, load_timing_info.receive_headers_end);
192
193 EXPECT_FALSE(load_timing_info.receive_headers_end.is_null());
mmenke 2013/06/26 19:55:40 This is basically equivalent to TestLoadTimingCach
194 }
195
178 // Tests load timing in the case that there is no HTTP response. This can be 196 // Tests load timing in the case that there is no HTTP response. This can be
179 // used to test in the case of errors or non-HTTP requests. 197 // used to test in the case of errors or non-HTTP requests.
180 void TestLoadTimingNoHttpResponse( 198 void TestLoadTimingNoHttpResponse(
181 const net::LoadTimingInfo& load_timing_info) { 199 const net::LoadTimingInfo& load_timing_info) {
182 EXPECT_FALSE(load_timing_info.socket_reused); 200 EXPECT_FALSE(load_timing_info.socket_reused);
183 EXPECT_EQ(net::NetLog::Source::kInvalidId, load_timing_info.socket_log_id); 201 EXPECT_EQ(net::NetLog::Source::kInvalidId, load_timing_info.socket_log_id);
184 202
185 // Only the request times should be non-null. 203 // Only the request times should be non-null.
186 EXPECT_FALSE(load_timing_info.request_start_time.is_null()); 204 EXPECT_FALSE(load_timing_info.request_start_time.is_null());
187 EXPECT_FALSE(load_timing_info.request_start.is_null()); 205 EXPECT_FALSE(load_timing_info.request_start.is_null());
(...skipping 4709 matching lines...) Expand 10 before | Expand all | Expand 10 after
4897 &context); 4915 &context);
4898 req.set_method("POST"); 4916 req.set_method("POST");
4899 req.set_upload(make_scoped_ptr(CreateSimpleUploadData(kData))); 4917 req.set_upload(make_scoped_ptr(CreateSimpleUploadData(kData)));
4900 4918
4901 req.Start(); 4919 req.Start();
4902 base::MessageLoop::current()->Run(); 4920 base::MessageLoop::current()->Run();
4903 4921
4904 EXPECT_EQ("https", req.url().scheme()); 4922 EXPECT_EQ("https", req.url().scheme());
4905 EXPECT_EQ("POST", req.method()); 4923 EXPECT_EQ("POST", req.method());
4906 EXPECT_EQ(kData, d.data_received()); 4924 EXPECT_EQ(kData, d.data_received());
4925
4926 LoadTimingInfo load_timing_info;
4927 network_delegate.GetLoadTimingInfoBeforeRedirect(&load_timing_info);
4928 TestLoadTimingHSTSRedirectOccured(load_timing_info);
4907 } 4929 }
4908 4930
4909 TEST_F(HTTPSRequestTest, SSLv3Fallback) { 4931 TEST_F(HTTPSRequestTest, SSLv3Fallback) {
4910 SpawnedTestServer::SSLOptions ssl_options( 4932 SpawnedTestServer::SSLOptions ssl_options(
4911 SpawnedTestServer::SSLOptions::CERT_OK); 4933 SpawnedTestServer::SSLOptions::CERT_OK);
4912 ssl_options.tls_intolerant = 4934 ssl_options.tls_intolerant =
4913 SpawnedTestServer::SSLOptions::TLS_INTOLERANT_ALL; 4935 SpawnedTestServer::SSLOptions::TLS_INTOLERANT_ALL;
4914 SpawnedTestServer test_server( 4936 SpawnedTestServer test_server(
4915 SpawnedTestServer::TYPE_HTTPS, 4937 SpawnedTestServer::TYPE_HTTPS,
4916 ssl_options, 4938 ssl_options,
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after
5852 5874
5853 EXPECT_FALSE(r.is_pending()); 5875 EXPECT_FALSE(r.is_pending());
5854 EXPECT_EQ(1, d->response_started_count()); 5876 EXPECT_EQ(1, d->response_started_count());
5855 EXPECT_FALSE(d->received_data_before_response()); 5877 EXPECT_FALSE(d->received_data_before_response());
5856 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); 5878 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size));
5857 } 5879 }
5858 } 5880 }
5859 #endif // !defined(DISABLE_FTP_SUPPORT) 5881 #endif // !defined(DISABLE_FTP_SUPPORT)
5860 5882
5861 } // namespace net 5883 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_redirect_job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698