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

Side by Side Diff: net/http/http_network_transaction_unittest.cc

Issue 2315613002: Extracted NetLog class's inner enum types into their own enum classes and (Closed)
Patch Set: Ran "git cl format" on code. Much formatting ensued. Created 4 years, 3 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/http/http_network_transaction.cc ('k') | net/http/http_proxy_client_socket.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/http_network_transaction.h" 5 #include "net/http/http_network_transaction.h"
6 6
7 #include <math.h> // ceil 7 #include <math.h> // ceil
8 #include <stdarg.h> 8 #include <stdarg.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "net/http/http_network_session.h" 53 #include "net/http/http_network_session.h"
54 #include "net/http/http_network_session_peer.h" 54 #include "net/http/http_network_session_peer.h"
55 #include "net/http/http_request_headers.h" 55 #include "net/http/http_request_headers.h"
56 #include "net/http/http_response_info.h" 56 #include "net/http/http_response_info.h"
57 #include "net/http/http_server_properties_impl.h" 57 #include "net/http/http_server_properties_impl.h"
58 #include "net/http/http_stream.h" 58 #include "net/http/http_stream.h"
59 #include "net/http/http_stream_factory.h" 59 #include "net/http/http_stream_factory.h"
60 #include "net/http/http_stream_parser.h" 60 #include "net/http/http_stream_parser.h"
61 #include "net/http/http_transaction_test_util.h" 61 #include "net/http/http_transaction_test_util.h"
62 #include "net/log/net_log.h" 62 #include "net/log/net_log.h"
63 #include "net/log/net_log_event_type.h"
63 #include "net/log/test_net_log.h" 64 #include "net/log/test_net_log.h"
64 #include "net/log/test_net_log_entry.h" 65 #include "net/log/test_net_log_entry.h"
65 #include "net/log/test_net_log_util.h" 66 #include "net/log/test_net_log_util.h"
66 #include "net/proxy/mock_proxy_resolver.h" 67 #include "net/proxy/mock_proxy_resolver.h"
67 #include "net/proxy/proxy_config_service_fixed.h" 68 #include "net/proxy/proxy_config_service_fixed.h"
68 #include "net/proxy/proxy_info.h" 69 #include "net/proxy/proxy_info.h"
69 #include "net/proxy/proxy_resolver.h" 70 #include "net/proxy/proxy_resolver.h"
70 #include "net/proxy/proxy_server.h" 71 #include "net/proxy/proxy_server.h"
71 #include "net/proxy/proxy_service.h" 72 #include "net/proxy/proxy_service.h"
72 #include "net/socket/client_socket_factory.h" 73 #include "net/socket/client_socket_factory.h"
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 trans.GetRemoteEndpoint(&out.remote_endpoint_after_start); 371 trans.GetRemoteEndpoint(&out.remote_endpoint_after_start);
371 EXPECT_EQ(got_endpoint, 372 EXPECT_EQ(got_endpoint,
372 out.remote_endpoint_after_start.address().size() > 0); 373 out.remote_endpoint_after_start.address().size() > 0);
373 374
374 rv = ReadTransaction(&trans, &out.response_data); 375 rv = ReadTransaction(&trans, &out.response_data);
375 EXPECT_THAT(rv, IsOk()); 376 EXPECT_THAT(rv, IsOk());
376 377
377 TestNetLogEntry::List entries; 378 TestNetLogEntry::List entries;
378 log.GetEntries(&entries); 379 log.GetEntries(&entries);
379 size_t pos = ExpectLogContainsSomewhere( 380 size_t pos = ExpectLogContainsSomewhere(
380 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS, 381 entries, 0, NetLogEventType::HTTP_TRANSACTION_SEND_REQUEST_HEADERS,
381 NetLog::PHASE_NONE); 382 NetLogEventPhase::NONE);
382 ExpectLogContainsSomewhere( 383 ExpectLogContainsSomewhere(
383 entries, pos, 384 entries, pos, NetLogEventType::HTTP_TRANSACTION_READ_RESPONSE_HEADERS,
384 NetLog::TYPE_HTTP_TRANSACTION_READ_RESPONSE_HEADERS, 385 NetLogEventPhase::NONE);
385 NetLog::PHASE_NONE);
386 386
387 std::string line; 387 std::string line;
388 EXPECT_TRUE(entries[pos].GetStringValue("line", &line)); 388 EXPECT_TRUE(entries[pos].GetStringValue("line", &line));
389 EXPECT_EQ("GET / HTTP/1.1\r\n", line); 389 EXPECT_EQ("GET / HTTP/1.1\r\n", line);
390 390
391 HttpRequestHeaders request_headers; 391 HttpRequestHeaders request_headers;
392 EXPECT_TRUE(trans.GetFullRequestHeaders(&request_headers)); 392 EXPECT_TRUE(trans.GetFullRequestHeaders(&request_headers));
393 std::string value; 393 std::string value;
394 EXPECT_TRUE(request_headers.GetHeader("Host", &value)); 394 EXPECT_TRUE(request_headers.GetHeader("Host", &value));
395 EXPECT_EQ("www.example.org", value); 395 EXPECT_EQ("www.example.org", value);
(...skipping 2448 matching lines...) Expand 10 before | Expand all | Expand 10 after
2844 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 2844 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
2845 2845
2846 int rv = trans->Start(&request, callback1.callback(), log.bound()); 2846 int rv = trans->Start(&request, callback1.callback(), log.bound());
2847 EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); 2847 EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
2848 2848
2849 rv = callback1.WaitForResult(); 2849 rv = callback1.WaitForResult();
2850 EXPECT_THAT(rv, IsOk()); 2850 EXPECT_THAT(rv, IsOk());
2851 TestNetLogEntry::List entries; 2851 TestNetLogEntry::List entries;
2852 log.GetEntries(&entries); 2852 log.GetEntries(&entries);
2853 size_t pos = ExpectLogContainsSomewhere( 2853 size_t pos = ExpectLogContainsSomewhere(
2854 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, 2854 entries, 0, NetLogEventType::HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
2855 NetLog::PHASE_NONE); 2855 NetLogEventPhase::NONE);
2856 ExpectLogContainsSomewhere( 2856 ExpectLogContainsSomewhere(
2857 entries, pos, NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, 2857 entries, pos,
2858 NetLog::PHASE_NONE); 2858 NetLogEventType::HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
2859 NetLogEventPhase::NONE);
2859 2860
2860 const HttpResponseInfo* response = trans->GetResponseInfo(); 2861 const HttpResponseInfo* response = trans->GetResponseInfo();
2861 ASSERT_TRUE(response); 2862 ASSERT_TRUE(response);
2862 EXPECT_FALSE(response->headers->IsKeepAlive()); 2863 EXPECT_FALSE(response->headers->IsKeepAlive());
2863 ASSERT_TRUE(response->headers); 2864 ASSERT_TRUE(response->headers);
2864 EXPECT_EQ(407, response->headers->response_code()); 2865 EXPECT_EQ(407, response->headers->response_code());
2865 EXPECT_TRUE(HttpVersion(1, 0) == response->headers->GetHttpVersion()); 2866 EXPECT_TRUE(HttpVersion(1, 0) == response->headers->GetHttpVersion());
2866 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); 2867 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get()));
2867 2868
2868 LoadTimingInfo load_timing_info; 2869 LoadTimingInfo load_timing_info;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
2967 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 2968 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
2968 2969
2969 int rv = trans->Start(&request, callback1.callback(), log.bound()); 2970 int rv = trans->Start(&request, callback1.callback(), log.bound());
2970 EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); 2971 EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
2971 2972
2972 rv = callback1.WaitForResult(); 2973 rv = callback1.WaitForResult();
2973 EXPECT_THAT(rv, IsOk()); 2974 EXPECT_THAT(rv, IsOk());
2974 TestNetLogEntry::List entries; 2975 TestNetLogEntry::List entries;
2975 log.GetEntries(&entries); 2976 log.GetEntries(&entries);
2976 size_t pos = ExpectLogContainsSomewhere( 2977 size_t pos = ExpectLogContainsSomewhere(
2977 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, 2978 entries, 0, NetLogEventType::HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
2978 NetLog::PHASE_NONE); 2979 NetLogEventPhase::NONE);
2979 ExpectLogContainsSomewhere( 2980 ExpectLogContainsSomewhere(
2980 entries, pos, 2981 entries, pos,
2981 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, 2982 NetLogEventType::HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
2982 NetLog::PHASE_NONE); 2983 NetLogEventPhase::NONE);
2983 2984
2984 const HttpResponseInfo* response = trans->GetResponseInfo(); 2985 const HttpResponseInfo* response = trans->GetResponseInfo();
2985 ASSERT_TRUE(response); 2986 ASSERT_TRUE(response);
2986 EXPECT_FALSE(response->headers->IsKeepAlive()); 2987 EXPECT_FALSE(response->headers->IsKeepAlive());
2987 ASSERT_TRUE(response->headers); 2988 ASSERT_TRUE(response->headers);
2988 EXPECT_EQ(407, response->headers->response_code()); 2989 EXPECT_EQ(407, response->headers->response_code());
2989 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); 2990 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion());
2990 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); 2991 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get()));
2991 2992
2992 LoadTimingInfo load_timing_info; 2993 LoadTimingInfo load_timing_info;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
3087 session_deps_.socket_factory->AddSocketDataProvider(&data1); 3088 session_deps_.socket_factory->AddSocketDataProvider(&data1);
3088 3089
3089 TestCompletionCallback callback1; 3090 TestCompletionCallback callback1;
3090 3091
3091 int rv = trans.Start(&request, callback1.callback(), log.bound()); 3092 int rv = trans.Start(&request, callback1.callback(), log.bound());
3092 EXPECT_THAT(callback1.GetResult(rv), IsOk()); 3093 EXPECT_THAT(callback1.GetResult(rv), IsOk());
3093 3094
3094 TestNetLogEntry::List entries; 3095 TestNetLogEntry::List entries;
3095 log.GetEntries(&entries); 3096 log.GetEntries(&entries);
3096 size_t pos = ExpectLogContainsSomewhere( 3097 size_t pos = ExpectLogContainsSomewhere(
3097 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, 3098 entries, 0, NetLogEventType::HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
3098 NetLog::PHASE_NONE); 3099 NetLogEventPhase::NONE);
3099 ExpectLogContainsSomewhere( 3100 ExpectLogContainsSomewhere(
3100 entries, pos, 3101 entries, pos,
3101 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, 3102 NetLogEventType::HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
3102 NetLog::PHASE_NONE); 3103 NetLogEventPhase::NONE);
3103 3104
3104 const HttpResponseInfo* response = trans.GetResponseInfo(); 3105 const HttpResponseInfo* response = trans.GetResponseInfo();
3105 ASSERT_TRUE(response); 3106 ASSERT_TRUE(response);
3106 ASSERT_TRUE(response->headers); 3107 ASSERT_TRUE(response->headers);
3107 EXPECT_TRUE(response->headers->IsKeepAlive()); 3108 EXPECT_TRUE(response->headers->IsKeepAlive());
3108 EXPECT_EQ(407, response->headers->response_code()); 3109 EXPECT_EQ(407, response->headers->response_code());
3109 EXPECT_EQ(10, response->headers->GetContentLength()); 3110 EXPECT_EQ(10, response->headers->GetContentLength());
3110 EXPECT_TRUE(HttpVersion(1, 0) == response->headers->GetHttpVersion()); 3111 EXPECT_TRUE(HttpVersion(1, 0) == response->headers->GetHttpVersion());
3111 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); 3112 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get()));
3112 3113
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
3195 session_deps_.socket_factory->AddSocketDataProvider(&data1); 3196 session_deps_.socket_factory->AddSocketDataProvider(&data1);
3196 3197
3197 TestCompletionCallback callback1; 3198 TestCompletionCallback callback1;
3198 3199
3199 int rv = trans.Start(&request, callback1.callback(), log.bound()); 3200 int rv = trans.Start(&request, callback1.callback(), log.bound());
3200 EXPECT_THAT(callback1.GetResult(rv), IsOk()); 3201 EXPECT_THAT(callback1.GetResult(rv), IsOk());
3201 3202
3202 TestNetLogEntry::List entries; 3203 TestNetLogEntry::List entries;
3203 log.GetEntries(&entries); 3204 log.GetEntries(&entries);
3204 size_t pos = ExpectLogContainsSomewhere( 3205 size_t pos = ExpectLogContainsSomewhere(
3205 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, 3206 entries, 0, NetLogEventType::HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
3206 NetLog::PHASE_NONE); 3207 NetLogEventPhase::NONE);
3207 ExpectLogContainsSomewhere( 3208 ExpectLogContainsSomewhere(
3208 entries, pos, 3209 entries, pos,
3209 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, 3210 NetLogEventType::HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
3210 NetLog::PHASE_NONE); 3211 NetLogEventPhase::NONE);
3211 3212
3212 const HttpResponseInfo* response = trans.GetResponseInfo(); 3213 const HttpResponseInfo* response = trans.GetResponseInfo();
3213 ASSERT_TRUE(response); 3214 ASSERT_TRUE(response);
3214 ASSERT_TRUE(response->headers); 3215 ASSERT_TRUE(response->headers);
3215 EXPECT_TRUE(response->headers->IsKeepAlive()); 3216 EXPECT_TRUE(response->headers->IsKeepAlive());
3216 EXPECT_EQ(407, response->headers->response_code()); 3217 EXPECT_EQ(407, response->headers->response_code());
3217 EXPECT_EQ(10, response->headers->GetContentLength()); 3218 EXPECT_EQ(10, response->headers->GetContentLength());
3218 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); 3219 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion());
3219 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); 3220 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get()));
3220 3221
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
3318 3319
3319 std::unique_ptr<HttpNetworkTransaction> trans( 3320 std::unique_ptr<HttpNetworkTransaction> trans(
3320 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 3321 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
3321 3322
3322 int rv = trans->Start(&request, callback1.callback(), log.bound()); 3323 int rv = trans->Start(&request, callback1.callback(), log.bound());
3323 EXPECT_THAT(callback1.GetResult(rv), IsOk()); 3324 EXPECT_THAT(callback1.GetResult(rv), IsOk());
3324 3325
3325 TestNetLogEntry::List entries; 3326 TestNetLogEntry::List entries;
3326 log.GetEntries(&entries); 3327 log.GetEntries(&entries);
3327 size_t pos = ExpectLogContainsSomewhere( 3328 size_t pos = ExpectLogContainsSomewhere(
3328 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, 3329 entries, 0, NetLogEventType::HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
3329 NetLog::PHASE_NONE); 3330 NetLogEventPhase::NONE);
3330 ExpectLogContainsSomewhere( 3331 ExpectLogContainsSomewhere(
3331 entries, pos, 3332 entries, pos,
3332 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, 3333 NetLogEventType::HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
3333 NetLog::PHASE_NONE); 3334 NetLogEventPhase::NONE);
3334 3335
3335 const HttpResponseInfo* response = trans->GetResponseInfo(); 3336 const HttpResponseInfo* response = trans->GetResponseInfo();
3336 ASSERT_TRUE(response); 3337 ASSERT_TRUE(response);
3337 ASSERT_TRUE(response->headers); 3338 ASSERT_TRUE(response->headers);
3338 EXPECT_TRUE(response->headers->IsKeepAlive()); 3339 EXPECT_TRUE(response->headers->IsKeepAlive());
3339 EXPECT_EQ(407, response->headers->response_code()); 3340 EXPECT_EQ(407, response->headers->response_code());
3340 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); 3341 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion());
3341 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); 3342 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get()));
3342 3343
3343 LoadTimingInfo load_timing_info; 3344 LoadTimingInfo load_timing_info;
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
3664 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); 3665 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get());
3665 3666
3666 int rv = trans.Start(&request, callback1.callback(), log.bound()); 3667 int rv = trans.Start(&request, callback1.callback(), log.bound());
3667 EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); 3668 EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
3668 3669
3669 rv = callback1.WaitForResult(); 3670 rv = callback1.WaitForResult();
3670 EXPECT_THAT(rv, IsError(ERR_UNEXPECTED_PROXY_AUTH)); 3671 EXPECT_THAT(rv, IsError(ERR_UNEXPECTED_PROXY_AUTH));
3671 TestNetLogEntry::List entries; 3672 TestNetLogEntry::List entries;
3672 log.GetEntries(&entries); 3673 log.GetEntries(&entries);
3673 size_t pos = ExpectLogContainsSomewhere( 3674 size_t pos = ExpectLogContainsSomewhere(
3674 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, 3675 entries, 0, NetLogEventType::HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
3675 NetLog::PHASE_NONE); 3676 NetLogEventPhase::NONE);
3676 ExpectLogContainsSomewhere( 3677 ExpectLogContainsSomewhere(
3677 entries, pos, 3678 entries, pos,
3678 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, 3679 NetLogEventType::HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
3679 NetLog::PHASE_NONE); 3680 NetLogEventPhase::NONE);
3680 } 3681 }
3681 3682
3682 // Test a proxy auth scheme that allows default credentials and a proxy server 3683 // Test a proxy auth scheme that allows default credentials and a proxy server
3683 // that uses non-persistent connections. 3684 // that uses non-persistent connections.
3684 TEST_F(HttpNetworkTransactionTest, 3685 TEST_F(HttpNetworkTransactionTest,
3685 AuthAllowsDefaultCredentialsTunnelConnectionClose) { 3686 AuthAllowsDefaultCredentialsTunnelConnectionClose) {
3686 HttpRequestInfo request; 3687 HttpRequestInfo request;
3687 request.method = "GET"; 3688 request.method = "GET";
3688 request.url = GURL("https://www.example.org/"); 3689 request.url = GURL("https://www.example.org/");
3689 3690
(...skipping 4174 matching lines...) Expand 10 before | Expand all | Expand 10 after
7864 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 7865 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
7865 7866
7866 int rv = trans->Start(&request, callback1.callback(), log.bound()); 7867 int rv = trans->Start(&request, callback1.callback(), log.bound());
7867 EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); 7868 EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
7868 7869
7869 rv = callback1.WaitForResult(); 7870 rv = callback1.WaitForResult();
7870 EXPECT_THAT(rv, IsOk()); 7871 EXPECT_THAT(rv, IsOk());
7871 TestNetLogEntry::List entries; 7872 TestNetLogEntry::List entries;
7872 log.GetEntries(&entries); 7873 log.GetEntries(&entries);
7873 size_t pos = ExpectLogContainsSomewhere( 7874 size_t pos = ExpectLogContainsSomewhere(
7874 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, 7875 entries, 0, NetLogEventType::HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
7875 NetLog::PHASE_NONE); 7876 NetLogEventPhase::NONE);
7876 ExpectLogContainsSomewhere( 7877 ExpectLogContainsSomewhere(
7877 entries, pos, 7878 entries, pos,
7878 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, 7879 NetLogEventType::HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
7879 NetLog::PHASE_NONE); 7880 NetLogEventPhase::NONE);
7880 7881
7881 const HttpResponseInfo* response = trans->GetResponseInfo(); 7882 const HttpResponseInfo* response = trans->GetResponseInfo();
7882 ASSERT_TRUE(response); 7883 ASSERT_TRUE(response);
7883 ASSERT_TRUE(response->headers); 7884 ASSERT_TRUE(response->headers);
7884 EXPECT_EQ(407, response->headers->response_code()); 7885 EXPECT_EQ(407, response->headers->response_code());
7885 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); 7886 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion());
7886 EXPECT_TRUE(response->auth_challenge); 7887 EXPECT_TRUE(response->auth_challenge);
7887 EXPECT_TRUE(CheckBasicSecureProxyAuth(response->auth_challenge.get())); 7888 EXPECT_TRUE(CheckBasicSecureProxyAuth(response->auth_challenge.get()));
7888 7889
7889 TestCompletionCallback callback2; 7890 TestCompletionCallback callback2;
(...skipping 4297 matching lines...) Expand 10 before | Expand all | Expand 10 after
12187 base::Unretained(&headers_handler))); 12188 base::Unretained(&headers_handler)));
12188 12189
12189 int rv = trans.Start(&request, callback1.callback(), log.bound()); 12190 int rv = trans.Start(&request, callback1.callback(), log.bound());
12190 EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); 12191 EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
12191 12192
12192 rv = callback1.WaitForResult(); 12193 rv = callback1.WaitForResult();
12193 EXPECT_THAT(rv, IsOk()); 12194 EXPECT_THAT(rv, IsOk());
12194 TestNetLogEntry::List entries; 12195 TestNetLogEntry::List entries;
12195 log.GetEntries(&entries); 12196 log.GetEntries(&entries);
12196 size_t pos = ExpectLogContainsSomewhere( 12197 size_t pos = ExpectLogContainsSomewhere(
12197 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, 12198 entries, 0, NetLogEventType::HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
12198 NetLog::PHASE_NONE); 12199 NetLogEventPhase::NONE);
12199 ExpectLogContainsSomewhere( 12200 ExpectLogContainsSomewhere(
12200 entries, pos, 12201 entries, pos,
12201 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, 12202 NetLogEventType::HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
12202 NetLog::PHASE_NONE); 12203 NetLogEventPhase::NONE);
12203 12204
12204 const HttpResponseInfo* response = trans.GetResponseInfo(); 12205 const HttpResponseInfo* response = trans.GetResponseInfo();
12205 ASSERT_TRUE(response); 12206 ASSERT_TRUE(response);
12206 12207
12207 EXPECT_TRUE(response->headers->IsKeepAlive()); 12208 EXPECT_TRUE(response->headers->IsKeepAlive());
12208 EXPECT_EQ(200, response->headers->response_code()); 12209 EXPECT_EQ(200, response->headers->response_code());
12209 EXPECT_EQ(100, response->headers->GetContentLength()); 12210 EXPECT_EQ(100, response->headers->GetContentLength());
12210 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); 12211 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion());
12211 EXPECT_TRUE(response->was_fetched_via_proxy); 12212 EXPECT_TRUE(response->was_fetched_via_proxy);
12212 EXPECT_TRUE( 12213 EXPECT_TRUE(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
12265 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); 12266 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get());
12266 12267
12267 int rv = trans.Start(&request, callback1.callback(), log.bound()); 12268 int rv = trans.Start(&request, callback1.callback(), log.bound());
12268 EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); 12269 EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
12269 12270
12270 rv = callback1.WaitForResult(); 12271 rv = callback1.WaitForResult();
12271 EXPECT_THAT(rv, IsOk()); 12272 EXPECT_THAT(rv, IsOk());
12272 TestNetLogEntry::List entries; 12273 TestNetLogEntry::List entries;
12273 log.GetEntries(&entries); 12274 log.GetEntries(&entries);
12274 size_t pos = ExpectLogContainsSomewhere( 12275 size_t pos = ExpectLogContainsSomewhere(
12275 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, 12276 entries, 0, NetLogEventType::HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
12276 NetLog::PHASE_NONE); 12277 NetLogEventPhase::NONE);
12277 ExpectLogContainsSomewhere( 12278 ExpectLogContainsSomewhere(
12278 entries, pos, NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, 12279 entries, pos,
12279 NetLog::PHASE_NONE); 12280 NetLogEventType::HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
12281 NetLogEventPhase::NONE);
12280 12282
12281 const HttpResponseInfo* response = trans.GetResponseInfo(); 12283 const HttpResponseInfo* response = trans.GetResponseInfo();
12282 ASSERT_TRUE(response); 12284 ASSERT_TRUE(response);
12283 12285
12284 EXPECT_TRUE(response->headers->IsKeepAlive()); 12286 EXPECT_TRUE(response->headers->IsKeepAlive());
12285 EXPECT_EQ(200, response->headers->response_code()); 12287 EXPECT_EQ(200, response->headers->response_code());
12286 EXPECT_EQ(100, response->headers->GetContentLength()); 12288 EXPECT_EQ(100, response->headers->GetContentLength());
12287 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); 12289 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion());
12288 EXPECT_TRUE(response->was_fetched_via_proxy); 12290 EXPECT_TRUE(response->was_fetched_via_proxy);
12289 EXPECT_TRUE( 12291 EXPECT_TRUE(
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
12335 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); 12337 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get());
12336 12338
12337 int rv = trans.Start(&request, callback1.callback(), log.bound()); 12339 int rv = trans.Start(&request, callback1.callback(), log.bound());
12338 EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); 12340 EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
12339 12341
12340 rv = callback1.WaitForResult(); 12342 rv = callback1.WaitForResult();
12341 EXPECT_THAT(rv, IsError(ERR_EMPTY_RESPONSE)); 12343 EXPECT_THAT(rv, IsError(ERR_EMPTY_RESPONSE));
12342 TestNetLogEntry::List entries; 12344 TestNetLogEntry::List entries;
12343 log.GetEntries(&entries); 12345 log.GetEntries(&entries);
12344 size_t pos = ExpectLogContainsSomewhere( 12346 size_t pos = ExpectLogContainsSomewhere(
12345 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, 12347 entries, 0, NetLogEventType::HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
12346 NetLog::PHASE_NONE); 12348 NetLogEventPhase::NONE);
12347 ExpectLogContainsSomewhere( 12349 ExpectLogContainsSomewhere(
12348 entries, pos, 12350 entries, pos,
12349 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, 12351 NetLogEventType::HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
12350 NetLog::PHASE_NONE); 12352 NetLogEventPhase::NONE);
12351 } 12353 }
12352 12354
12353 // Test for crbug.com/55424. 12355 // Test for crbug.com/55424.
12354 TEST_F(HttpNetworkTransactionTest, PreconnectWithExistingSpdySession) { 12356 TEST_F(HttpNetworkTransactionTest, PreconnectWithExistingSpdySession) {
12355 SpdySerializedFrame req( 12357 SpdySerializedFrame req(
12356 spdy_util_.ConstructSpdyGet("https://www.example.org", 1, LOWEST)); 12358 spdy_util_.ConstructSpdyGet("https://www.example.org", 1, LOWEST));
12357 MockWrite spdy_writes[] = {CreateMockWrite(req, 0)}; 12359 MockWrite spdy_writes[] = {CreateMockWrite(req, 0)};
12358 12360
12359 SpdySerializedFrame resp(spdy_util_.ConstructSpdyGetReply(NULL, 0, 1)); 12361 SpdySerializedFrame resp(spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
12360 SpdySerializedFrame data(spdy_util_.ConstructSpdyDataFrame(1, true)); 12362 SpdySerializedFrame data(spdy_util_.ConstructSpdyDataFrame(1, true));
(...skipping 3212 matching lines...) Expand 10 before | Expand all | Expand 10 after
15573 base::RunLoop().RunUntilIdle(); 15575 base::RunLoop().RunUntilIdle();
15574 15576
15575 EXPECT_TRUE(trans.GetResponseInfo()->was_fetched_via_spdy); 15577 EXPECT_TRUE(trans.GetResponseInfo()->was_fetched_via_spdy);
15576 HttpRequestHeaders headers; 15578 HttpRequestHeaders headers;
15577 ASSERT_TRUE(trans.GetFullRequestHeaders(&headers)); 15579 ASSERT_TRUE(trans.GetFullRequestHeaders(&headers));
15578 EXPECT_TRUE(headers.HasHeader(HttpRequestHeaders::kTokenBinding)); 15580 EXPECT_TRUE(headers.HasHeader(HttpRequestHeaders::kTokenBinding));
15579 } 15581 }
15580 #endif // !defined(OS_IOS) 15582 #endif // !defined(OS_IOS)
15581 15583
15582 } // namespace net 15584 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_transaction.cc ('k') | net/http/http_proxy_client_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698