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(HttpNetworkTransactionSpdy2Test, StatusLineJunk2Bytes) { | 453 TEST_F(HttpNetworkTransactionSpdy2Test, 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 9715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10179 trans2.Start(&request2, callback2.callback(), BoundNetLog())); | 10179 trans2.Start(&request2, callback2.callback(), BoundNetLog())); |
10180 MessageLoop::current()->RunUntilIdle(); | 10180 MessageLoop::current()->RunUntilIdle(); |
10181 data2->RunFor(3); | 10181 data2->RunFor(3); |
10182 | 10182 |
10183 ASSERT_TRUE(callback2.have_result()); | 10183 ASSERT_TRUE(callback2.have_result()); |
10184 EXPECT_EQ(OK, callback2.WaitForResult()); | 10184 EXPECT_EQ(OK, callback2.WaitForResult()); |
10185 EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); | 10185 EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); |
10186 } | 10186 } |
10187 | 10187 |
10188 } // namespace net | 10188 } // namespace net |
OLD | NEW |