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 "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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 145 |
146 class HttpNetworkTransactionSpdy2Test : public PlatformTest { | 146 class HttpNetworkTransactionSpdy2Test : public PlatformTest { |
147 protected: | 147 protected: |
148 struct SimpleGetHelperResult { | 148 struct SimpleGetHelperResult { |
149 int rv; | 149 int rv; |
150 std::string status_line; | 150 std::string status_line; |
151 std::string response_data; | 151 std::string response_data; |
152 }; | 152 }; |
153 | 153 |
154 virtual void SetUp() { | 154 virtual void SetUp() { |
155 SpdySession::set_default_protocol(kProtoSPDY2); | |
156 NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); | 155 NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); |
157 MessageLoop::current()->RunUntilIdle(); | 156 MessageLoop::current()->RunUntilIdle(); |
158 } | 157 } |
159 | 158 |
160 virtual void TearDown() { | 159 virtual void TearDown() { |
161 NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); | 160 NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); |
162 MessageLoop::current()->RunUntilIdle(); | 161 MessageLoop::current()->RunUntilIdle(); |
163 // Empty the current queue. | 162 // Empty the current queue. |
164 MessageLoop::current()->RunUntilIdle(); | 163 MessageLoop::current()->RunUntilIdle(); |
165 PlatformTest::TearDown(); | 164 PlatformTest::TearDown(); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 size_t reads_count) { | 241 size_t reads_count) { |
243 StaticSocketDataProvider reads(data_reads, reads_count, NULL, 0); | 242 StaticSocketDataProvider reads(data_reads, reads_count, NULL, 0); |
244 StaticSocketDataProvider* data[] = { &reads }; | 243 StaticSocketDataProvider* data[] = { &reads }; |
245 return SimpleGetHelperForData(data, 1); | 244 return SimpleGetHelperForData(data, 1); |
246 } | 245 } |
247 | 246 |
248 void ConnectStatusHelperWithExpectedStatus(const MockRead& status, | 247 void ConnectStatusHelperWithExpectedStatus(const MockRead& status, |
249 int expected_status); | 248 int expected_status); |
250 | 249 |
251 void ConnectStatusHelper(const MockRead& status); | 250 void ConnectStatusHelper(const MockRead& status); |
252 | |
253 private: | |
254 SpdyTestStateHelper spdy_state_; | |
255 }; | 251 }; |
256 | 252 |
257 namespace { | 253 namespace { |
258 | 254 |
259 // Fill |str| with a long header list that consumes >= |size| bytes. | 255 // Fill |str| with a long header list that consumes >= |size| bytes. |
260 void FillLargeHeadersString(std::string* str, int size) { | 256 void FillLargeHeadersString(std::string* str, int size) { |
261 const char* row = | 257 const char* row = |
262 "SomeHeaderName: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\r\n"; | 258 "SomeHeaderName: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\r\n"; |
263 const int sizeof_row = strlen(row); | 259 const int sizeof_row = strlen(row); |
264 const int num_rows = static_cast<int>( | 260 const int num_rows = static_cast<int>( |
(...skipping 9915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10180 trans2.Start(&request2, callback2.callback(), BoundNetLog())); | 10176 trans2.Start(&request2, callback2.callback(), BoundNetLog())); |
10181 MessageLoop::current()->RunUntilIdle(); | 10177 MessageLoop::current()->RunUntilIdle(); |
10182 data2->RunFor(3); | 10178 data2->RunFor(3); |
10183 | 10179 |
10184 ASSERT_TRUE(callback2.have_result()); | 10180 ASSERT_TRUE(callback2.have_result()); |
10185 EXPECT_EQ(OK, callback2.WaitForResult()); | 10181 EXPECT_EQ(OK, callback2.WaitForResult()); |
10186 EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); | 10182 EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); |
10187 } | 10183 } |
10188 | 10184 |
10189 } // namespace net | 10185 } // namespace net |
OLD | NEW |