OLD | NEW |
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 <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 // a JSONified list of headers as a single string. Uses single quotes instead | 105 // a JSONified list of headers as a single string. Uses single quotes instead |
106 // of double quotes for easier comparison. Returns false on failure. | 106 // of double quotes for easier comparison. Returns false on failure. |
107 bool GetHeaders(base::DictionaryValue* params, std::string* headers) { | 107 bool GetHeaders(base::DictionaryValue* params, std::string* headers) { |
108 if (!params) | 108 if (!params) |
109 return false; | 109 return false; |
110 base::ListValue* header_list; | 110 base::ListValue* header_list; |
111 if (!params->GetList("headers", &header_list)) | 111 if (!params->GetList("headers", &header_list)) |
112 return false; | 112 return false; |
113 std::string double_quote_headers; | 113 std::string double_quote_headers; |
114 base::JSONWriter::Write(header_list, &double_quote_headers); | 114 base::JSONWriter::Write(header_list, &double_quote_headers); |
115 ReplaceChars(double_quote_headers, "\"", "'", headers); | 115 base::ReplaceChars(double_quote_headers, "\"", "'", headers); |
116 return true; | 116 return true; |
117 } | 117 } |
118 | 118 |
119 // Tests LoadTimingInfo in the case a socket is reused and no PAC script is | 119 // Tests LoadTimingInfo in the case a socket is reused and no PAC script is |
120 // used. | 120 // used. |
121 void TestLoadTimingReused(const net::LoadTimingInfo& load_timing_info) { | 121 void TestLoadTimingReused(const net::LoadTimingInfo& load_timing_info) { |
122 EXPECT_TRUE(load_timing_info.socket_reused); | 122 EXPECT_TRUE(load_timing_info.socket_reused); |
123 EXPECT_NE(net::NetLog::Source::kInvalidId, load_timing_info.socket_log_id); | 123 EXPECT_NE(net::NetLog::Source::kInvalidId, load_timing_info.socket_log_id); |
124 | 124 |
125 EXPECT_TRUE(load_timing_info.proxy_resolve_start.is_null()); | 125 EXPECT_TRUE(load_timing_info.proxy_resolve_start.is_null()); |
(...skipping 12152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12278 // established, to let the HTTP request start. | 12278 // established, to let the HTTP request start. |
12279 ASSERT_EQ(OK, http_callback.WaitForResult()); | 12279 ASSERT_EQ(OK, http_callback.WaitForResult()); |
12280 std::string response_data; | 12280 std::string response_data; |
12281 ASSERT_EQ(OK, ReadTransaction(http_trans.get(), &response_data)); | 12281 ASSERT_EQ(OK, ReadTransaction(http_trans.get(), &response_data)); |
12282 EXPECT_EQ("falafel", response_data); | 12282 EXPECT_EQ("falafel", response_data); |
12283 | 12283 |
12284 EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session)); | 12284 EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session)); |
12285 } | 12285 } |
12286 | 12286 |
12287 } // namespace net | 12287 } // namespace net |
OLD | NEW |