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

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

Issue 9817014: Created a new class SpdyTestStateHelper to serve as a helper to manage the state of a number of SPD… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add TODO Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « net/base/run_all_unittests.cc ('k') | net/http/http_network_transaction_spdy2_unittest.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 (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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 struct SimpleGetHelperResult { 170 struct SimpleGetHelperResult {
171 int rv; 171 int rv;
172 std::string status_line; 172 std::string status_line;
173 std::string response_data; 173 std::string response_data;
174 }; 174 };
175 175
176 virtual void SetUp() { 176 virtual void SetUp() {
177 SpdySession::set_default_protocol(SSLClientSocket::kProtoSPDY21); 177 SpdySession::set_default_protocol(SSLClientSocket::kProtoSPDY21);
178 NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); 178 NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests();
179 MessageLoop::current()->RunAllPending(); 179 MessageLoop::current()->RunAllPending();
180 spdy::SpdyFramer::set_enable_compression_default(false);
181 } 180 }
182 181
183 virtual void TearDown() { 182 virtual void TearDown() {
184 NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); 183 NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests();
185 MessageLoop::current()->RunAllPending(); 184 MessageLoop::current()->RunAllPending();
186 spdy::SpdyFramer::set_enable_compression_default(true);
187 // Empty the current queue. 185 // Empty the current queue.
188 MessageLoop::current()->RunAllPending(); 186 MessageLoop::current()->RunAllPending();
189 PlatformTest::TearDown(); 187 PlatformTest::TearDown();
190 NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); 188 NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests();
191 MessageLoop::current()->RunAllPending(); 189 MessageLoop::current()->RunAllPending();
192 } 190 }
193 191
194 // Either |write_failure| specifies a write failure or |read_failure| 192 // Either |write_failure| specifies a write failure or |read_failure|
195 // specifies a read failure when using a reused socket. In either case, the 193 // specifies a read failure when using a reused socket. In either case, the
196 // failure should cause the network transaction to resend the request, and the 194 // failure should cause the network transaction to resend the request, and the
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 size_t reads_count) { 264 size_t reads_count) {
267 StaticSocketDataProvider reads(data_reads, reads_count, NULL, 0); 265 StaticSocketDataProvider reads(data_reads, reads_count, NULL, 0);
268 StaticSocketDataProvider* data[] = { &reads }; 266 StaticSocketDataProvider* data[] = { &reads };
269 return SimpleGetHelperForData(data, 1); 267 return SimpleGetHelperForData(data, 1);
270 } 268 }
271 269
272 void ConnectStatusHelperWithExpectedStatus(const MockRead& status, 270 void ConnectStatusHelperWithExpectedStatus(const MockRead& status,
273 int expected_status); 271 int expected_status);
274 272
275 void ConnectStatusHelper(const MockRead& status); 273 void ConnectStatusHelper(const MockRead& status);
274
275 private:
276 SpdyTestStateHelper spdy_state_;
276 }; 277 };
277 278
278 namespace { 279 namespace {
279 280
280 // Fill |str| with a long header list that consumes >= |size| bytes. 281 // Fill |str| with a long header list that consumes >= |size| bytes.
281 void FillLargeHeadersString(std::string* str, int size) { 282 void FillLargeHeadersString(std::string* str, int size) {
282 const char* row = 283 const char* row =
283 "SomeHeaderName: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\r\n"; 284 "SomeHeaderName: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\r\n";
284 const int sizeof_row = strlen(row); 285 const int sizeof_row = strlen(row);
285 const int num_rows = static_cast<int>( 286 const int num_rows = static_cast<int>(
(...skipping 9095 matching lines...) Expand 10 before | Expand all | Expand 10 after
9381 StaticSocketDataProvider* data[] = { &data1, &data2 }; 9382 StaticSocketDataProvider* data[] = { &data1, &data2 };
9382 9383
9383 SimpleGetHelperResult out = SimpleGetHelperForData(data, arraysize(data)); 9384 SimpleGetHelperResult out = SimpleGetHelperForData(data, arraysize(data));
9384 9385
9385 EXPECT_EQ(OK, out.rv); 9386 EXPECT_EQ(OK, out.rv);
9386 EXPECT_EQ("HTTP/1.0 200 OK", out.status_line); 9387 EXPECT_EQ("HTTP/1.0 200 OK", out.status_line);
9387 EXPECT_EQ("hello world", out.response_data); 9388 EXPECT_EQ("hello world", out.response_data);
9388 } 9389 }
9389 9390
9390 } // namespace net 9391 } // namespace net
OLDNEW
« no previous file with comments | « net/base/run_all_unittests.cc ('k') | net/http/http_network_transaction_spdy2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698