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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 MockRead(SYNCHRONOUS, OK), | 443 MockRead(SYNCHRONOUS, OK), |
444 }; | 444 }; |
445 SimpleGetHelperResult out = SimpleGetHelper(data_reads, | 445 SimpleGetHelperResult out = SimpleGetHelper(data_reads, |
446 arraysize(data_reads)); | 446 arraysize(data_reads)); |
447 EXPECT_EQ(OK, out.rv); | 447 EXPECT_EQ(OK, out.rv); |
448 EXPECT_EQ("HTTP/0.9 200 OK", out.status_line); | 448 EXPECT_EQ("HTTP/0.9 200 OK", out.status_line); |
449 EXPECT_EQ("hello world", out.response_data); | 449 EXPECT_EQ("hello world", out.response_data); |
450 } | 450 } |
451 | 451 |
452 // Allow up to 4 bytes of junk to precede status line. | 452 // Allow up to 4 bytes of junk to precede status line. |
453 TEST_F(HttpNetworkTransactionSpdy3Test, StatusLineJunk2Bytes) { | 453 TEST_F(HttpNetworkTransactionSpdy3Test, StatusLineJunk3Bytes) { |
454 MockRead data_reads[] = { | 454 MockRead data_reads[] = { |
455 MockRead("xxxHTTP/1.0 404 Not Found\nServer: blah\n\nDATA"), | 455 MockRead("xxxHTTP/1.0 404 Not Found\nServer: blah\n\nDATA"), |
456 MockRead(SYNCHRONOUS, OK), | 456 MockRead(SYNCHRONOUS, OK), |
457 }; | 457 }; |
458 SimpleGetHelperResult out = SimpleGetHelper(data_reads, | 458 SimpleGetHelperResult out = SimpleGetHelper(data_reads, |
459 arraysize(data_reads)); | 459 arraysize(data_reads)); |
460 EXPECT_EQ(OK, out.rv); | 460 EXPECT_EQ(OK, out.rv); |
461 EXPECT_EQ("HTTP/1.0 404 Not Found", out.status_line); | 461 EXPECT_EQ("HTTP/1.0 404 Not Found", out.status_line); |
462 EXPECT_EQ("DATA", out.response_data); | 462 EXPECT_EQ("DATA", out.response_data); |
463 } | 463 } |
(...skipping 9678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10142 trans2.Start(&request2, callback2.callback(), BoundNetLog())); | 10142 trans2.Start(&request2, callback2.callback(), BoundNetLog())); |
10143 MessageLoop::current()->RunUntilIdle(); | 10143 MessageLoop::current()->RunUntilIdle(); |
10144 data2->RunFor(3); | 10144 data2->RunFor(3); |
10145 | 10145 |
10146 ASSERT_TRUE(callback2.have_result()); | 10146 ASSERT_TRUE(callback2.have_result()); |
10147 EXPECT_EQ(OK, callback2.WaitForResult()); | 10147 EXPECT_EQ(OK, callback2.WaitForResult()); |
10148 EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); | 10148 EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); |
10149 } | 10149 } |
10150 | 10150 |
10151 } // namespace net | 10151 } // namespace net |
OLD | NEW |