| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <math.h> // ceil | 5 #include <math.h> // ceil |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 HttpRequestInfo request; | 114 HttpRequestInfo request; |
| 115 request.method = "GET"; | 115 request.method = "GET"; |
| 116 request.url = GURL("http://www.google.com/"); | 116 request.url = GURL("http://www.google.com/"); |
| 117 request.load_flags = 0; | 117 request.load_flags = 0; |
| 118 | 118 |
| 119 StaticSocketDataProvider data(data_reads, reads_count, NULL, 0); | 119 StaticSocketDataProvider data(data_reads, reads_count, NULL, 0); |
| 120 session_deps.socket_factory.AddSocketDataProvider(&data); | 120 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 121 | 121 |
| 122 TestCompletionCallback callback; | 122 TestCompletionCallback callback; |
| 123 | 123 |
| 124 int rv = trans->Start(&request, &callback, NULL); | 124 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 125 EXPECT_EQ(ERR_IO_PENDING, rv); | 125 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 126 | 126 |
| 127 out.rv = callback.WaitForResult(); | 127 out.rv = callback.WaitForResult(); |
| 128 if (out.rv != OK) | 128 if (out.rv != OK) |
| 129 return out; | 129 return out; |
| 130 | 130 |
| 131 const HttpResponseInfo* response = trans->GetResponseInfo(); | 131 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 132 EXPECT_TRUE(response != NULL); | 132 EXPECT_TRUE(response != NULL); |
| 133 | 133 |
| 134 EXPECT_TRUE(response->headers != NULL); | 134 EXPECT_TRUE(response->headers != NULL); |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 // No response body because the test stops reading here. | 405 // No response body because the test stops reading here. |
| 406 MockRead(false, ERR_UNEXPECTED), // Should not be reached. | 406 MockRead(false, ERR_UNEXPECTED), // Should not be reached. |
| 407 }; | 407 }; |
| 408 | 408 |
| 409 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), | 409 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), |
| 410 data_writes1, arraysize(data_writes1)); | 410 data_writes1, arraysize(data_writes1)); |
| 411 session_deps.socket_factory.AddSocketDataProvider(&data1); | 411 session_deps.socket_factory.AddSocketDataProvider(&data1); |
| 412 | 412 |
| 413 TestCompletionCallback callback1; | 413 TestCompletionCallback callback1; |
| 414 | 414 |
| 415 int rv = trans->Start(&request, &callback1, NULL); | 415 int rv = trans->Start(&request, &callback1, BoundNetLog()); |
| 416 EXPECT_EQ(ERR_IO_PENDING, rv); | 416 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 417 | 417 |
| 418 rv = callback1.WaitForResult(); | 418 rv = callback1.WaitForResult(); |
| 419 EXPECT_EQ(OK, rv); | 419 EXPECT_EQ(OK, rv); |
| 420 | 420 |
| 421 const HttpResponseInfo* response = trans->GetResponseInfo(); | 421 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 422 EXPECT_FALSE(response == NULL); | 422 EXPECT_FALSE(response == NULL); |
| 423 | 423 |
| 424 // Check that the headers got parsed. | 424 // Check that the headers got parsed. |
| 425 EXPECT_TRUE(response->headers != NULL); | 425 EXPECT_TRUE(response->headers != NULL); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 for (int i = 0; i < 2; ++i) { | 462 for (int i = 0; i < 2; ++i) { |
| 463 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); | 463 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
| 464 | 464 |
| 465 HttpRequestInfo request; | 465 HttpRequestInfo request; |
| 466 request.method = "GET"; | 466 request.method = "GET"; |
| 467 request.url = GURL("http://www.google.com/"); | 467 request.url = GURL("http://www.google.com/"); |
| 468 request.load_flags = 0; | 468 request.load_flags = 0; |
| 469 | 469 |
| 470 TestCompletionCallback callback; | 470 TestCompletionCallback callback; |
| 471 | 471 |
| 472 int rv = trans->Start(&request, &callback, NULL); | 472 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 473 EXPECT_EQ(ERR_IO_PENDING, rv); | 473 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 474 | 474 |
| 475 rv = callback.WaitForResult(); | 475 rv = callback.WaitForResult(); |
| 476 EXPECT_EQ(OK, rv); | 476 EXPECT_EQ(OK, rv); |
| 477 | 477 |
| 478 const HttpResponseInfo* response = trans->GetResponseInfo(); | 478 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 479 EXPECT_TRUE(response != NULL); | 479 EXPECT_TRUE(response != NULL); |
| 480 | 480 |
| 481 EXPECT_TRUE(response->headers != NULL); | 481 EXPECT_TRUE(response->headers != NULL); |
| 482 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 482 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 504 MockRead("HTTP/1.0 100 Continue\r\n\r\n"), | 504 MockRead("HTTP/1.0 100 Continue\r\n\r\n"), |
| 505 MockRead("HTTP/1.0 200 OK\r\n\r\n"), | 505 MockRead("HTTP/1.0 200 OK\r\n\r\n"), |
| 506 MockRead("hello world"), | 506 MockRead("hello world"), |
| 507 MockRead(false, OK), | 507 MockRead(false, OK), |
| 508 }; | 508 }; |
| 509 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 509 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 510 session_deps.socket_factory.AddSocketDataProvider(&data); | 510 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 511 | 511 |
| 512 TestCompletionCallback callback; | 512 TestCompletionCallback callback; |
| 513 | 513 |
| 514 int rv = trans->Start(&request, &callback, NULL); | 514 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 515 EXPECT_EQ(ERR_IO_PENDING, rv); | 515 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 516 | 516 |
| 517 rv = callback.WaitForResult(); | 517 rv = callback.WaitForResult(); |
| 518 EXPECT_EQ(OK, rv); | 518 EXPECT_EQ(OK, rv); |
| 519 | 519 |
| 520 const HttpResponseInfo* response = trans->GetResponseInfo(); | 520 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 521 EXPECT_TRUE(response != NULL); | 521 EXPECT_TRUE(response != NULL); |
| 522 | 522 |
| 523 EXPECT_TRUE(response->headers != NULL); | 523 EXPECT_TRUE(response->headers != NULL); |
| 524 EXPECT_EQ("HTTP/1.0 200 OK", response->headers->GetStatusLine()); | 524 EXPECT_EQ("HTTP/1.0 200 OK", response->headers->GetStatusLine()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 546 MockRead("HTTP/1.1 102 Unspecified status code\r\n\r\n" | 546 MockRead("HTTP/1.1 102 Unspecified status code\r\n\r\n" |
| 547 "HTTP/1.1 200 OK\r\n\r\n"), | 547 "HTTP/1.1 200 OK\r\n\r\n"), |
| 548 MockRead("hello world"), | 548 MockRead("hello world"), |
| 549 MockRead(false, OK), | 549 MockRead(false, OK), |
| 550 }; | 550 }; |
| 551 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 551 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 552 session_deps.socket_factory.AddSocketDataProvider(&data); | 552 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 553 | 553 |
| 554 TestCompletionCallback callback; | 554 TestCompletionCallback callback; |
| 555 | 555 |
| 556 int rv = trans->Start(&request, &callback, NULL); | 556 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 557 EXPECT_EQ(ERR_IO_PENDING, rv); | 557 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 558 | 558 |
| 559 rv = callback.WaitForResult(); | 559 rv = callback.WaitForResult(); |
| 560 EXPECT_EQ(OK, rv); | 560 EXPECT_EQ(OK, rv); |
| 561 | 561 |
| 562 const HttpResponseInfo* response = trans->GetResponseInfo(); | 562 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 563 EXPECT_TRUE(response != NULL); | 563 EXPECT_TRUE(response != NULL); |
| 564 | 564 |
| 565 EXPECT_TRUE(response->headers != NULL); | 565 EXPECT_TRUE(response->headers != NULL); |
| 566 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 566 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 583 | 583 |
| 584 MockRead data_reads[] = { | 584 MockRead data_reads[] = { |
| 585 MockRead(false, "HTTP/1.0 100 Continue\r\n"), | 585 MockRead(false, "HTTP/1.0 100 Continue\r\n"), |
| 586 MockRead(true, 0), | 586 MockRead(true, 0), |
| 587 }; | 587 }; |
| 588 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 588 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 589 session_deps.socket_factory.AddSocketDataProvider(&data); | 589 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 590 | 590 |
| 591 TestCompletionCallback callback; | 591 TestCompletionCallback callback; |
| 592 | 592 |
| 593 int rv = trans->Start(&request, &callback, NULL); | 593 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 594 EXPECT_EQ(ERR_IO_PENDING, rv); | 594 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 595 | 595 |
| 596 rv = callback.WaitForResult(); | 596 rv = callback.WaitForResult(); |
| 597 EXPECT_EQ(OK, rv); | 597 EXPECT_EQ(OK, rv); |
| 598 | 598 |
| 599 std::string response_data; | 599 std::string response_data; |
| 600 rv = ReadTransaction(trans.get(), &response_data); | 600 rv = ReadTransaction(trans.get(), &response_data); |
| 601 EXPECT_EQ(OK, rv); | 601 EXPECT_EQ(OK, rv); |
| 602 EXPECT_EQ("", response_data); | 602 EXPECT_EQ("", response_data); |
| 603 } | 603 } |
| 604 | 604 |
| 605 TEST_F(HttpNetworkTransactionTest, EmptyResponse) { | 605 TEST_F(HttpNetworkTransactionTest, EmptyResponse) { |
| 606 SessionDependencies session_deps; | 606 SessionDependencies session_deps; |
| 607 scoped_ptr<HttpTransaction> trans( | 607 scoped_ptr<HttpTransaction> trans( |
| 608 new HttpNetworkTransaction(CreateSession(&session_deps))); | 608 new HttpNetworkTransaction(CreateSession(&session_deps))); |
| 609 | 609 |
| 610 HttpRequestInfo request; | 610 HttpRequestInfo request; |
| 611 request.method = "POST"; | 611 request.method = "POST"; |
| 612 request.url = GURL("http://www.foo.com/"); | 612 request.url = GURL("http://www.foo.com/"); |
| 613 request.load_flags = 0; | 613 request.load_flags = 0; |
| 614 | 614 |
| 615 MockRead data_reads[] = { | 615 MockRead data_reads[] = { |
| 616 MockRead(true, 0), | 616 MockRead(true, 0), |
| 617 }; | 617 }; |
| 618 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 618 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 619 session_deps.socket_factory.AddSocketDataProvider(&data); | 619 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 620 | 620 |
| 621 TestCompletionCallback callback; | 621 TestCompletionCallback callback; |
| 622 | 622 |
| 623 int rv = trans->Start(&request, &callback, NULL); | 623 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 624 EXPECT_EQ(ERR_IO_PENDING, rv); | 624 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 625 | 625 |
| 626 rv = callback.WaitForResult(); | 626 rv = callback.WaitForResult(); |
| 627 EXPECT_EQ(ERR_EMPTY_RESPONSE, rv); | 627 EXPECT_EQ(ERR_EMPTY_RESPONSE, rv); |
| 628 } | 628 } |
| 629 | 629 |
| 630 // read_failure specifies a read failure that should cause the network | 630 // read_failure specifies a read failure that should cause the network |
| 631 // transaction to resend the request. | 631 // transaction to resend the request. |
| 632 void HttpNetworkTransactionTest::KeepAliveConnectionResendRequestTest( | 632 void HttpNetworkTransactionTest::KeepAliveConnectionResendRequestTest( |
| 633 const MockRead& read_failure) { | 633 const MockRead& read_failure) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 657 | 657 |
| 658 const char* kExpectedResponseData[] = { | 658 const char* kExpectedResponseData[] = { |
| 659 "hello", "world" | 659 "hello", "world" |
| 660 }; | 660 }; |
| 661 | 661 |
| 662 for (int i = 0; i < 2; ++i) { | 662 for (int i = 0; i < 2; ++i) { |
| 663 TestCompletionCallback callback; | 663 TestCompletionCallback callback; |
| 664 | 664 |
| 665 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); | 665 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
| 666 | 666 |
| 667 int rv = trans->Start(&request, &callback, NULL); | 667 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 668 EXPECT_EQ(ERR_IO_PENDING, rv); | 668 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 669 | 669 |
| 670 rv = callback.WaitForResult(); | 670 rv = callback.WaitForResult(); |
| 671 EXPECT_EQ(OK, rv); | 671 EXPECT_EQ(OK, rv); |
| 672 | 672 |
| 673 const HttpResponseInfo* response = trans->GetResponseInfo(); | 673 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 674 EXPECT_TRUE(response != NULL); | 674 EXPECT_TRUE(response != NULL); |
| 675 | 675 |
| 676 EXPECT_TRUE(response->headers != NULL); | 676 EXPECT_TRUE(response->headers != NULL); |
| 677 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 677 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 707 MockRead(true, ERR_CONNECTION_RESET), | 707 MockRead(true, ERR_CONNECTION_RESET), |
| 708 MockRead("HTTP/1.0 200 OK\r\n\r\n"), // Should not be used | 708 MockRead("HTTP/1.0 200 OK\r\n\r\n"), // Should not be used |
| 709 MockRead("hello world"), | 709 MockRead("hello world"), |
| 710 MockRead(false, OK), | 710 MockRead(false, OK), |
| 711 }; | 711 }; |
| 712 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 712 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 713 session_deps.socket_factory.AddSocketDataProvider(&data); | 713 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 714 | 714 |
| 715 TestCompletionCallback callback; | 715 TestCompletionCallback callback; |
| 716 | 716 |
| 717 int rv = trans->Start(&request, &callback, NULL); | 717 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 718 EXPECT_EQ(ERR_IO_PENDING, rv); | 718 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 719 | 719 |
| 720 rv = callback.WaitForResult(); | 720 rv = callback.WaitForResult(); |
| 721 EXPECT_EQ(ERR_CONNECTION_RESET, rv); | 721 EXPECT_EQ(ERR_CONNECTION_RESET, rv); |
| 722 | 722 |
| 723 const HttpResponseInfo* response = trans->GetResponseInfo(); | 723 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 724 EXPECT_TRUE(response == NULL); | 724 EXPECT_TRUE(response == NULL); |
| 725 } | 725 } |
| 726 | 726 |
| 727 // What do various browsers do when the server closes a non-keepalive | 727 // What do various browsers do when the server closes a non-keepalive |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 | 795 |
| 796 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), | 796 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), |
| 797 data_writes1, arraysize(data_writes1)); | 797 data_writes1, arraysize(data_writes1)); |
| 798 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), | 798 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), |
| 799 data_writes2, arraysize(data_writes2)); | 799 data_writes2, arraysize(data_writes2)); |
| 800 session_deps.socket_factory.AddSocketDataProvider(&data1); | 800 session_deps.socket_factory.AddSocketDataProvider(&data1); |
| 801 session_deps.socket_factory.AddSocketDataProvider(&data2); | 801 session_deps.socket_factory.AddSocketDataProvider(&data2); |
| 802 | 802 |
| 803 TestCompletionCallback callback1; | 803 TestCompletionCallback callback1; |
| 804 | 804 |
| 805 int rv = trans->Start(&request, &callback1, NULL); | 805 int rv = trans->Start(&request, &callback1, BoundNetLog()); |
| 806 EXPECT_EQ(ERR_IO_PENDING, rv); | 806 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 807 | 807 |
| 808 rv = callback1.WaitForResult(); | 808 rv = callback1.WaitForResult(); |
| 809 EXPECT_EQ(OK, rv); | 809 EXPECT_EQ(OK, rv); |
| 810 | 810 |
| 811 const HttpResponseInfo* response = trans->GetResponseInfo(); | 811 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 812 EXPECT_FALSE(response == NULL); | 812 EXPECT_FALSE(response == NULL); |
| 813 | 813 |
| 814 // The password prompt info should have been set in response->auth_challenge. | 814 // The password prompt info should have been set in response->auth_challenge. |
| 815 EXPECT_FALSE(response->auth_challenge.get() == NULL); | 815 EXPECT_FALSE(response->auth_challenge.get() == NULL); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 // Large content-length -- won't matter, as connection will be reset. | 855 // Large content-length -- won't matter, as connection will be reset. |
| 856 MockRead("Content-Length: 10000\r\n\r\n"), | 856 MockRead("Content-Length: 10000\r\n\r\n"), |
| 857 MockRead(false, ERR_FAILED), | 857 MockRead(false, ERR_FAILED), |
| 858 }; | 858 }; |
| 859 | 859 |
| 860 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 860 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 861 data_writes, arraysize(data_writes)); | 861 data_writes, arraysize(data_writes)); |
| 862 session_deps.socket_factory.AddSocketDataProvider(&data); | 862 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 863 TestCompletionCallback callback; | 863 TestCompletionCallback callback; |
| 864 | 864 |
| 865 int rv = trans->Start(&request, &callback, NULL); | 865 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 866 EXPECT_EQ(ERR_IO_PENDING, rv); | 866 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 867 | 867 |
| 868 rv = callback.WaitForResult(); | 868 rv = callback.WaitForResult(); |
| 869 EXPECT_EQ(0, rv); | 869 EXPECT_EQ(0, rv); |
| 870 | 870 |
| 871 const HttpResponseInfo* response = trans->GetResponseInfo(); | 871 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 872 ASSERT_FALSE(response == NULL); | 872 ASSERT_FALSE(response == NULL); |
| 873 EXPECT_TRUE(response->auth_challenge.get() == NULL); | 873 EXPECT_TRUE(response->auth_challenge.get() == NULL); |
| 874 } | 874 } |
| 875 | 875 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 MockRead("Content-Length: 100\r\n\r\n"), | 911 MockRead("Content-Length: 100\r\n\r\n"), |
| 912 MockRead(false, OK), | 912 MockRead(false, OK), |
| 913 }; | 913 }; |
| 914 | 914 |
| 915 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), | 915 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), |
| 916 data_writes1, arraysize(data_writes1)); | 916 data_writes1, arraysize(data_writes1)); |
| 917 session_deps.socket_factory.AddSocketDataProvider(&data1); | 917 session_deps.socket_factory.AddSocketDataProvider(&data1); |
| 918 | 918 |
| 919 TestCompletionCallback callback1; | 919 TestCompletionCallback callback1; |
| 920 | 920 |
| 921 int rv = trans->Start(&request, &callback1, NULL); | 921 int rv = trans->Start(&request, &callback1, BoundNetLog()); |
| 922 EXPECT_EQ(ERR_IO_PENDING, rv); | 922 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 923 | 923 |
| 924 rv = callback1.WaitForResult(); | 924 rv = callback1.WaitForResult(); |
| 925 EXPECT_EQ(OK, rv); | 925 EXPECT_EQ(OK, rv); |
| 926 | 926 |
| 927 const HttpResponseInfo* response = trans->GetResponseInfo(); | 927 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 928 EXPECT_FALSE(response == NULL); | 928 EXPECT_FALSE(response == NULL); |
| 929 | 929 |
| 930 // The password prompt info should have been set in response->auth_challenge. | 930 // The password prompt info should have been set in response->auth_challenge. |
| 931 EXPECT_FALSE(response->auth_challenge.get() == NULL); | 931 EXPECT_FALSE(response->auth_challenge.get() == NULL); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 MockRead("Content-Length: 100\r\n\r\n"), | 984 MockRead("Content-Length: 100\r\n\r\n"), |
| 985 MockRead(false, OK), | 985 MockRead(false, OK), |
| 986 }; | 986 }; |
| 987 | 987 |
| 988 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), | 988 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), |
| 989 data_writes1, arraysize(data_writes1)); | 989 data_writes1, arraysize(data_writes1)); |
| 990 session_deps.socket_factory.AddSocketDataProvider(&data1); | 990 session_deps.socket_factory.AddSocketDataProvider(&data1); |
| 991 | 991 |
| 992 TestCompletionCallback callback1; | 992 TestCompletionCallback callback1; |
| 993 | 993 |
| 994 int rv = trans->Start(&request, &callback1, NULL); | 994 int rv = trans->Start(&request, &callback1, BoundNetLog()); |
| 995 EXPECT_EQ(ERR_IO_PENDING, rv); | 995 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 996 | 996 |
| 997 rv = callback1.WaitForResult(); | 997 rv = callback1.WaitForResult(); |
| 998 EXPECT_EQ(OK, rv); | 998 EXPECT_EQ(OK, rv); |
| 999 | 999 |
| 1000 const HttpResponseInfo* response = trans->GetResponseInfo(); | 1000 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 1001 EXPECT_FALSE(response == NULL); | 1001 EXPECT_FALSE(response == NULL); |
| 1002 | 1002 |
| 1003 // The password prompt info should have been set in response->auth_challenge. | 1003 // The password prompt info should have been set in response->auth_challenge. |
| 1004 EXPECT_FALSE(response->auth_challenge.get() == NULL); | 1004 EXPECT_FALSE(response->auth_challenge.get() == NULL); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1065 MockRead("Content-Length: 100\r\n\r\n"), | 1065 MockRead("Content-Length: 100\r\n\r\n"), |
| 1066 MockRead(false, OK), | 1066 MockRead(false, OK), |
| 1067 }; | 1067 }; |
| 1068 | 1068 |
| 1069 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), | 1069 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), |
| 1070 data_writes1, arraysize(data_writes1)); | 1070 data_writes1, arraysize(data_writes1)); |
| 1071 session_deps.socket_factory.AddSocketDataProvider(&data1); | 1071 session_deps.socket_factory.AddSocketDataProvider(&data1); |
| 1072 | 1072 |
| 1073 TestCompletionCallback callback1; | 1073 TestCompletionCallback callback1; |
| 1074 | 1074 |
| 1075 int rv = trans->Start(&request, &callback1, NULL); | 1075 int rv = trans->Start(&request, &callback1, BoundNetLog()); |
| 1076 EXPECT_EQ(ERR_IO_PENDING, rv); | 1076 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 1077 | 1077 |
| 1078 rv = callback1.WaitForResult(); | 1078 rv = callback1.WaitForResult(); |
| 1079 EXPECT_EQ(OK, rv); | 1079 EXPECT_EQ(OK, rv); |
| 1080 | 1080 |
| 1081 const HttpResponseInfo* response = trans->GetResponseInfo(); | 1081 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 1082 EXPECT_FALSE(response == NULL); | 1082 EXPECT_FALSE(response == NULL); |
| 1083 | 1083 |
| 1084 // The password prompt info should have been set in response->auth_challenge. | 1084 // The password prompt info should have been set in response->auth_challenge. |
| 1085 EXPECT_FALSE(response->auth_challenge.get() == NULL); | 1085 EXPECT_FALSE(response->auth_challenge.get() == NULL); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1156 | 1156 |
| 1157 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), | 1157 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), |
| 1158 data_writes1, arraysize(data_writes1)); | 1158 data_writes1, arraysize(data_writes1)); |
| 1159 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), | 1159 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), |
| 1160 data_writes2, arraysize(data_writes2)); | 1160 data_writes2, arraysize(data_writes2)); |
| 1161 session_deps.socket_factory.AddSocketDataProvider(&data1); | 1161 session_deps.socket_factory.AddSocketDataProvider(&data1); |
| 1162 session_deps.socket_factory.AddSocketDataProvider(&data2); | 1162 session_deps.socket_factory.AddSocketDataProvider(&data2); |
| 1163 | 1163 |
| 1164 TestCompletionCallback callback1; | 1164 TestCompletionCallback callback1; |
| 1165 | 1165 |
| 1166 int rv = trans->Start(&request, &callback1, NULL); | 1166 int rv = trans->Start(&request, &callback1, BoundNetLog()); |
| 1167 EXPECT_EQ(ERR_IO_PENDING, rv); | 1167 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 1168 | 1168 |
| 1169 rv = callback1.WaitForResult(); | 1169 rv = callback1.WaitForResult(); |
| 1170 EXPECT_EQ(OK, rv); | 1170 EXPECT_EQ(OK, rv); |
| 1171 | 1171 |
| 1172 const HttpResponseInfo* response = trans->GetResponseInfo(); | 1172 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 1173 EXPECT_FALSE(response == NULL); | 1173 EXPECT_FALSE(response == NULL); |
| 1174 | 1174 |
| 1175 // The password prompt info should have been set in response->auth_challenge. | 1175 // The password prompt info should have been set in response->auth_challenge. |
| 1176 EXPECT_FALSE(response->auth_challenge.get() == NULL); | 1176 EXPECT_FALSE(response->auth_challenge.get() == NULL); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 // No response body because the test stops reading here. | 1239 // No response body because the test stops reading here. |
| 1240 MockRead(false, ERR_UNEXPECTED), // Should not be reached. | 1240 MockRead(false, ERR_UNEXPECTED), // Should not be reached. |
| 1241 }; | 1241 }; |
| 1242 | 1242 |
| 1243 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), | 1243 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), |
| 1244 data_writes1, arraysize(data_writes1)); | 1244 data_writes1, arraysize(data_writes1)); |
| 1245 session_deps.socket_factory.AddSocketDataProvider(&data1); | 1245 session_deps.socket_factory.AddSocketDataProvider(&data1); |
| 1246 | 1246 |
| 1247 TestCompletionCallback callback1; | 1247 TestCompletionCallback callback1; |
| 1248 | 1248 |
| 1249 int rv = trans->Start(&request, &callback1, NULL); | 1249 int rv = trans->Start(&request, &callback1, BoundNetLog()); |
| 1250 EXPECT_EQ(ERR_IO_PENDING, rv); | 1250 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 1251 | 1251 |
| 1252 rv = callback1.WaitForResult(); | 1252 rv = callback1.WaitForResult(); |
| 1253 EXPECT_EQ(OK, rv); | 1253 EXPECT_EQ(OK, rv); |
| 1254 | 1254 |
| 1255 const HttpResponseInfo* response = trans->GetResponseInfo(); | 1255 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 1256 EXPECT_FALSE(response == NULL); | 1256 EXPECT_FALSE(response == NULL); |
| 1257 | 1257 |
| 1258 EXPECT_TRUE(response->headers->IsKeepAlive()); | 1258 EXPECT_TRUE(response->headers->IsKeepAlive()); |
| 1259 EXPECT_EQ(407, response->headers->response_code()); | 1259 EXPECT_EQ(407, response->headers->response_code()); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1321 MockRead("Content-Length: 10\r\n\r\n"), | 1321 MockRead("Content-Length: 10\r\n\r\n"), |
| 1322 MockRead(false, ERR_UNEXPECTED), // Should not be reached. | 1322 MockRead(false, ERR_UNEXPECTED), // Should not be reached. |
| 1323 }; | 1323 }; |
| 1324 | 1324 |
| 1325 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 1325 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 1326 data_writes, arraysize(data_writes)); | 1326 data_writes, arraysize(data_writes)); |
| 1327 session_deps.socket_factory.AddSocketDataProvider(&data); | 1327 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 1328 | 1328 |
| 1329 TestCompletionCallback callback; | 1329 TestCompletionCallback callback; |
| 1330 | 1330 |
| 1331 int rv = trans->Start(&request, &callback, NULL); | 1331 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 1332 EXPECT_EQ(ERR_IO_PENDING, rv); | 1332 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 1333 | 1333 |
| 1334 rv = callback.WaitForResult(); | 1334 rv = callback.WaitForResult(); |
| 1335 EXPECT_EQ(OK, rv); | 1335 EXPECT_EQ(OK, rv); |
| 1336 | 1336 |
| 1337 const HttpResponseInfo* response = trans->GetResponseInfo(); | 1337 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 1338 EXPECT_FALSE(response == NULL); | 1338 EXPECT_FALSE(response == NULL); |
| 1339 | 1339 |
| 1340 EXPECT_TRUE(response->headers->IsKeepAlive()); | 1340 EXPECT_TRUE(response->headers->IsKeepAlive()); |
| 1341 EXPECT_EQ(407, response->headers->response_code()); | 1341 EXPECT_EQ(407, response->headers->response_code()); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1374 // No response body because the test stops reading here. | 1374 // No response body because the test stops reading here. |
| 1375 MockRead(false, ERR_UNEXPECTED), // Should not be reached. | 1375 MockRead(false, ERR_UNEXPECTED), // Should not be reached. |
| 1376 }; | 1376 }; |
| 1377 | 1377 |
| 1378 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 1378 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 1379 data_writes, arraysize(data_writes)); | 1379 data_writes, arraysize(data_writes)); |
| 1380 session_deps.socket_factory.AddSocketDataProvider(&data); | 1380 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 1381 | 1381 |
| 1382 TestCompletionCallback callback; | 1382 TestCompletionCallback callback; |
| 1383 | 1383 |
| 1384 int rv = trans->Start(&request, &callback, NULL); | 1384 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 1385 EXPECT_EQ(ERR_IO_PENDING, rv); | 1385 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 1386 | 1386 |
| 1387 rv = callback.WaitForResult(); | 1387 rv = callback.WaitForResult(); |
| 1388 EXPECT_EQ(expected_status, rv); | 1388 EXPECT_EQ(expected_status, rv); |
| 1389 } | 1389 } |
| 1390 | 1390 |
| 1391 void HttpNetworkTransactionTest::ConnectStatusHelper(const MockRead& status) { | 1391 void HttpNetworkTransactionTest::ConnectStatusHelper(const MockRead& status) { |
| 1392 ConnectStatusHelperWithExpectedStatus( | 1392 ConnectStatusHelperWithExpectedStatus( |
| 1393 status, ERR_TUNNEL_CONNECTION_FAILED); | 1393 status, ERR_TUNNEL_CONNECTION_FAILED); |
| 1394 } | 1394 } |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1636 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), | 1636 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), |
| 1637 data_writes2, arraysize(data_writes2)); | 1637 data_writes2, arraysize(data_writes2)); |
| 1638 StaticSocketDataProvider data3(data_reads3, arraysize(data_reads3), | 1638 StaticSocketDataProvider data3(data_reads3, arraysize(data_reads3), |
| 1639 data_writes3, arraysize(data_writes3)); | 1639 data_writes3, arraysize(data_writes3)); |
| 1640 session_deps.socket_factory.AddSocketDataProvider(&data1); | 1640 session_deps.socket_factory.AddSocketDataProvider(&data1); |
| 1641 session_deps.socket_factory.AddSocketDataProvider(&data2); | 1641 session_deps.socket_factory.AddSocketDataProvider(&data2); |
| 1642 session_deps.socket_factory.AddSocketDataProvider(&data3); | 1642 session_deps.socket_factory.AddSocketDataProvider(&data3); |
| 1643 | 1643 |
| 1644 TestCompletionCallback callback1; | 1644 TestCompletionCallback callback1; |
| 1645 | 1645 |
| 1646 int rv = trans->Start(&request, &callback1, NULL); | 1646 int rv = trans->Start(&request, &callback1, BoundNetLog()); |
| 1647 EXPECT_EQ(ERR_IO_PENDING, rv); | 1647 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 1648 | 1648 |
| 1649 rv = callback1.WaitForResult(); | 1649 rv = callback1.WaitForResult(); |
| 1650 EXPECT_EQ(OK, rv); | 1650 EXPECT_EQ(OK, rv); |
| 1651 | 1651 |
| 1652 const HttpResponseInfo* response = trans->GetResponseInfo(); | 1652 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 1653 EXPECT_FALSE(response == NULL); | 1653 EXPECT_FALSE(response == NULL); |
| 1654 | 1654 |
| 1655 // The password prompt info should have been set in response->auth_challenge. | 1655 // The password prompt info should have been set in response->auth_challenge. |
| 1656 EXPECT_FALSE(response->auth_challenge.get() == NULL); | 1656 EXPECT_FALSE(response->auth_challenge.get() == NULL); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1775 | 1775 |
| 1776 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), | 1776 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), |
| 1777 data_writes1, arraysize(data_writes1)); | 1777 data_writes1, arraysize(data_writes1)); |
| 1778 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), | 1778 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), |
| 1779 data_writes2, arraysize(data_writes2)); | 1779 data_writes2, arraysize(data_writes2)); |
| 1780 session_deps.socket_factory.AddSocketDataProvider(&data1); | 1780 session_deps.socket_factory.AddSocketDataProvider(&data1); |
| 1781 session_deps.socket_factory.AddSocketDataProvider(&data2); | 1781 session_deps.socket_factory.AddSocketDataProvider(&data2); |
| 1782 | 1782 |
| 1783 TestCompletionCallback callback1; | 1783 TestCompletionCallback callback1; |
| 1784 | 1784 |
| 1785 int rv = trans->Start(&request, &callback1, NULL); | 1785 int rv = trans->Start(&request, &callback1, BoundNetLog()); |
| 1786 EXPECT_EQ(ERR_IO_PENDING, rv); | 1786 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 1787 | 1787 |
| 1788 rv = callback1.WaitForResult(); | 1788 rv = callback1.WaitForResult(); |
| 1789 EXPECT_EQ(OK, rv); | 1789 EXPECT_EQ(OK, rv); |
| 1790 | 1790 |
| 1791 EXPECT_TRUE(trans->IsReadyToRestartForAuth()); | 1791 EXPECT_TRUE(trans->IsReadyToRestartForAuth()); |
| 1792 TestCompletionCallback callback2; | 1792 TestCompletionCallback callback2; |
| 1793 rv = trans->RestartWithAuth(std::wstring(), std::wstring(), &callback2); | 1793 rv = trans->RestartWithAuth(std::wstring(), std::wstring(), &callback2); |
| 1794 EXPECT_EQ(ERR_IO_PENDING, rv); | 1794 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 1795 rv = callback2.WaitForResult(); | 1795 rv = callback2.WaitForResult(); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1950 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), | 1950 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), |
| 1951 data_writes2, arraysize(data_writes2)); | 1951 data_writes2, arraysize(data_writes2)); |
| 1952 StaticSocketDataProvider data3(data_reads3, arraysize(data_reads3), | 1952 StaticSocketDataProvider data3(data_reads3, arraysize(data_reads3), |
| 1953 data_writes3, arraysize(data_writes3)); | 1953 data_writes3, arraysize(data_writes3)); |
| 1954 session_deps.socket_factory.AddSocketDataProvider(&data1); | 1954 session_deps.socket_factory.AddSocketDataProvider(&data1); |
| 1955 session_deps.socket_factory.AddSocketDataProvider(&data2); | 1955 session_deps.socket_factory.AddSocketDataProvider(&data2); |
| 1956 session_deps.socket_factory.AddSocketDataProvider(&data3); | 1956 session_deps.socket_factory.AddSocketDataProvider(&data3); |
| 1957 | 1957 |
| 1958 TestCompletionCallback callback1; | 1958 TestCompletionCallback callback1; |
| 1959 | 1959 |
| 1960 int rv = trans->Start(&request, &callback1, NULL); | 1960 int rv = trans->Start(&request, &callback1, BoundNetLog()); |
| 1961 EXPECT_EQ(ERR_IO_PENDING, rv); | 1961 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 1962 | 1962 |
| 1963 rv = callback1.WaitForResult(); | 1963 rv = callback1.WaitForResult(); |
| 1964 EXPECT_EQ(OK, rv); | 1964 EXPECT_EQ(OK, rv); |
| 1965 | 1965 |
| 1966 EXPECT_TRUE(trans->IsReadyToRestartForAuth()); | 1966 EXPECT_TRUE(trans->IsReadyToRestartForAuth()); |
| 1967 TestCompletionCallback callback2; | 1967 TestCompletionCallback callback2; |
| 1968 rv = trans->RestartWithAuth(std::wstring(), std::wstring(), &callback2); | 1968 rv = trans->RestartWithAuth(std::wstring(), std::wstring(), &callback2); |
| 1969 EXPECT_EQ(ERR_IO_PENDING, rv); | 1969 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 1970 rv = callback2.WaitForResult(); | 1970 rv = callback2.WaitForResult(); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2044 MockRead("HTTP/1.0 200 OK\r\n"), | 2044 MockRead("HTTP/1.0 200 OK\r\n"), |
| 2045 MockRead(true, large_headers_string.data(), large_headers_string.size()), | 2045 MockRead(true, large_headers_string.data(), large_headers_string.size()), |
| 2046 MockRead("\r\nBODY"), | 2046 MockRead("\r\nBODY"), |
| 2047 MockRead(false, OK), | 2047 MockRead(false, OK), |
| 2048 }; | 2048 }; |
| 2049 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 2049 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 2050 session_deps.socket_factory.AddSocketDataProvider(&data); | 2050 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 2051 | 2051 |
| 2052 TestCompletionCallback callback; | 2052 TestCompletionCallback callback; |
| 2053 | 2053 |
| 2054 int rv = trans->Start(&request, &callback, NULL); | 2054 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 2055 EXPECT_EQ(ERR_IO_PENDING, rv); | 2055 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2056 | 2056 |
| 2057 rv = callback.WaitForResult(); | 2057 rv = callback.WaitForResult(); |
| 2058 EXPECT_EQ(ERR_RESPONSE_HEADERS_TOO_BIG, rv); | 2058 EXPECT_EQ(ERR_RESPONSE_HEADERS_TOO_BIG, rv); |
| 2059 | 2059 |
| 2060 const HttpResponseInfo* response = trans->GetResponseInfo(); | 2060 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 2061 EXPECT_TRUE(response == NULL); | 2061 EXPECT_TRUE(response == NULL); |
| 2062 } | 2062 } |
| 2063 | 2063 |
| 2064 // Make sure that we don't try to reuse a TCPClientSocket when failing to | 2064 // Make sure that we don't try to reuse a TCPClientSocket when failing to |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2092 MockRead("Content-Length: 10\r\n\r\n"), | 2092 MockRead("Content-Length: 10\r\n\r\n"), |
| 2093 MockRead(false, ERR_UNEXPECTED), // Should not be reached. | 2093 MockRead(false, ERR_UNEXPECTED), // Should not be reached. |
| 2094 }; | 2094 }; |
| 2095 | 2095 |
| 2096 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), | 2096 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), |
| 2097 data_writes1, arraysize(data_writes1)); | 2097 data_writes1, arraysize(data_writes1)); |
| 2098 session_deps.socket_factory.AddSocketDataProvider(&data1); | 2098 session_deps.socket_factory.AddSocketDataProvider(&data1); |
| 2099 | 2099 |
| 2100 TestCompletionCallback callback1; | 2100 TestCompletionCallback callback1; |
| 2101 | 2101 |
| 2102 int rv = trans->Start(&request, &callback1, NULL); | 2102 int rv = trans->Start(&request, &callback1, BoundNetLog()); |
| 2103 EXPECT_EQ(ERR_IO_PENDING, rv); | 2103 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2104 | 2104 |
| 2105 rv = callback1.WaitForResult(); | 2105 rv = callback1.WaitForResult(); |
| 2106 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); | 2106 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); |
| 2107 | 2107 |
| 2108 const HttpResponseInfo* response = trans->GetResponseInfo(); | 2108 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 2109 EXPECT_TRUE(response == NULL); | 2109 EXPECT_TRUE(response == NULL); |
| 2110 | 2110 |
| 2111 // Empty the current queue. This is necessary because idle sockets are | 2111 // Empty the current queue. This is necessary because idle sockets are |
| 2112 // added to the connection pool asynchronously with a PostTask. | 2112 // added to the connection pool asynchronously with a PostTask. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2141 MockRead(" world"), | 2141 MockRead(" world"), |
| 2142 MockRead("junk"), // Should not be read!! | 2142 MockRead("junk"), // Should not be read!! |
| 2143 MockRead(false, OK), | 2143 MockRead(false, OK), |
| 2144 }; | 2144 }; |
| 2145 | 2145 |
| 2146 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 2146 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 2147 session_deps.socket_factory.AddSocketDataProvider(&data); | 2147 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 2148 | 2148 |
| 2149 TestCompletionCallback callback; | 2149 TestCompletionCallback callback; |
| 2150 | 2150 |
| 2151 int rv = trans->Start(&request, &callback, NULL); | 2151 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 2152 EXPECT_EQ(ERR_IO_PENDING, rv); | 2152 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2153 | 2153 |
| 2154 rv = callback.WaitForResult(); | 2154 rv = callback.WaitForResult(); |
| 2155 EXPECT_EQ(OK, rv); | 2155 EXPECT_EQ(OK, rv); |
| 2156 | 2156 |
| 2157 const HttpResponseInfo* response = trans->GetResponseInfo(); | 2157 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 2158 EXPECT_TRUE(response != NULL); | 2158 EXPECT_TRUE(response != NULL); |
| 2159 | 2159 |
| 2160 EXPECT_TRUE(response->headers != NULL); | 2160 EXPECT_TRUE(response->headers != NULL); |
| 2161 std::string status_line = response->headers->GetStatusLine(); | 2161 std::string status_line = response->headers->GetStatusLine(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2198 "Content-Type: text/html\r\n\r\n"), | 2198 "Content-Type: text/html\r\n\r\n"), |
| 2199 MockRead("junk"), // Should not be read!! | 2199 MockRead("junk"), // Should not be read!! |
| 2200 MockRead(false, OK), | 2200 MockRead(false, OK), |
| 2201 }; | 2201 }; |
| 2202 | 2202 |
| 2203 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 2203 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 2204 session_deps.socket_factory.AddSocketDataProvider(&data); | 2204 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 2205 | 2205 |
| 2206 TestCompletionCallback callback; | 2206 TestCompletionCallback callback; |
| 2207 | 2207 |
| 2208 int rv = trans->Start(&request, &callback, NULL); | 2208 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 2209 EXPECT_EQ(ERR_IO_PENDING, rv); | 2209 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2210 | 2210 |
| 2211 rv = callback.WaitForResult(); | 2211 rv = callback.WaitForResult(); |
| 2212 EXPECT_EQ(OK, rv); | 2212 EXPECT_EQ(OK, rv); |
| 2213 | 2213 |
| 2214 const HttpResponseInfo* response = trans->GetResponseInfo(); | 2214 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 2215 EXPECT_TRUE(response != NULL); | 2215 EXPECT_TRUE(response != NULL); |
| 2216 | 2216 |
| 2217 EXPECT_TRUE(response->headers != NULL); | 2217 EXPECT_TRUE(response->headers != NULL); |
| 2218 std::string status_line = response->headers->GetStatusLine(); | 2218 std::string status_line = response->headers->GetStatusLine(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2294 const char* kExpectedResponseData[] = { | 2294 const char* kExpectedResponseData[] = { |
| 2295 "hello world", "welcome" | 2295 "hello world", "welcome" |
| 2296 }; | 2296 }; |
| 2297 | 2297 |
| 2298 for (int i = 0; i < 2; ++i) { | 2298 for (int i = 0; i < 2; ++i) { |
| 2299 scoped_ptr<HttpTransaction> trans( | 2299 scoped_ptr<HttpTransaction> trans( |
| 2300 new HttpNetworkTransaction(session)); | 2300 new HttpNetworkTransaction(session)); |
| 2301 | 2301 |
| 2302 TestCompletionCallback callback; | 2302 TestCompletionCallback callback; |
| 2303 | 2303 |
| 2304 int rv = trans->Start(&request[i], &callback, NULL); | 2304 int rv = trans->Start(&request[i], &callback, BoundNetLog()); |
| 2305 EXPECT_EQ(ERR_IO_PENDING, rv); | 2305 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2306 | 2306 |
| 2307 rv = callback.WaitForResult(); | 2307 rv = callback.WaitForResult(); |
| 2308 EXPECT_EQ(OK, rv); | 2308 EXPECT_EQ(OK, rv); |
| 2309 | 2309 |
| 2310 const HttpResponseInfo* response = trans->GetResponseInfo(); | 2310 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 2311 EXPECT_TRUE(response != NULL); | 2311 EXPECT_TRUE(response != NULL); |
| 2312 | 2312 |
| 2313 EXPECT_TRUE(response->headers != NULL); | 2313 EXPECT_TRUE(response->headers != NULL); |
| 2314 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 2314 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2369 | 2369 |
| 2370 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), | 2370 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), |
| 2371 data_writes1, arraysize(data_writes1)); | 2371 data_writes1, arraysize(data_writes1)); |
| 2372 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), | 2372 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), |
| 2373 data_writes2, arraysize(data_writes2)); | 2373 data_writes2, arraysize(data_writes2)); |
| 2374 session_deps.socket_factory.AddSocketDataProvider(&data1); | 2374 session_deps.socket_factory.AddSocketDataProvider(&data1); |
| 2375 session_deps.socket_factory.AddSocketDataProvider(&data2); | 2375 session_deps.socket_factory.AddSocketDataProvider(&data2); |
| 2376 | 2376 |
| 2377 TestCompletionCallback callback1; | 2377 TestCompletionCallback callback1; |
| 2378 | 2378 |
| 2379 int rv = trans->Start(&request, &callback1, NULL); | 2379 int rv = trans->Start(&request, &callback1, BoundNetLog()); |
| 2380 EXPECT_EQ(ERR_IO_PENDING, rv); | 2380 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2381 | 2381 |
| 2382 rv = callback1.WaitForResult(); | 2382 rv = callback1.WaitForResult(); |
| 2383 EXPECT_EQ(OK, rv); | 2383 EXPECT_EQ(OK, rv); |
| 2384 | 2384 |
| 2385 EXPECT_TRUE(trans->IsReadyToRestartForAuth()); | 2385 EXPECT_TRUE(trans->IsReadyToRestartForAuth()); |
| 2386 TestCompletionCallback callback2; | 2386 TestCompletionCallback callback2; |
| 2387 rv = trans->RestartWithAuth(std::wstring(), std::wstring(), &callback2); | 2387 rv = trans->RestartWithAuth(std::wstring(), std::wstring(), &callback2); |
| 2388 EXPECT_EQ(ERR_IO_PENDING, rv); | 2388 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2389 rv = callback2.WaitForResult(); | 2389 rv = callback2.WaitForResult(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2467 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), | 2467 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), |
| 2468 data_writes2, arraysize(data_writes2)); | 2468 data_writes2, arraysize(data_writes2)); |
| 2469 StaticSocketDataProvider data3(data_reads3, arraysize(data_reads3), | 2469 StaticSocketDataProvider data3(data_reads3, arraysize(data_reads3), |
| 2470 data_writes3, arraysize(data_writes3)); | 2470 data_writes3, arraysize(data_writes3)); |
| 2471 session_deps.socket_factory.AddSocketDataProvider(&data1); | 2471 session_deps.socket_factory.AddSocketDataProvider(&data1); |
| 2472 session_deps.socket_factory.AddSocketDataProvider(&data2); | 2472 session_deps.socket_factory.AddSocketDataProvider(&data2); |
| 2473 session_deps.socket_factory.AddSocketDataProvider(&data3); | 2473 session_deps.socket_factory.AddSocketDataProvider(&data3); |
| 2474 | 2474 |
| 2475 TestCompletionCallback callback1; | 2475 TestCompletionCallback callback1; |
| 2476 | 2476 |
| 2477 int rv = trans->Start(&request, &callback1, NULL); | 2477 int rv = trans->Start(&request, &callback1, BoundNetLog()); |
| 2478 EXPECT_EQ(ERR_IO_PENDING, rv); | 2478 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2479 | 2479 |
| 2480 rv = callback1.WaitForResult(); | 2480 rv = callback1.WaitForResult(); |
| 2481 EXPECT_EQ(OK, rv); | 2481 EXPECT_EQ(OK, rv); |
| 2482 | 2482 |
| 2483 EXPECT_TRUE(trans->IsReadyToRestartForAuth()); | 2483 EXPECT_TRUE(trans->IsReadyToRestartForAuth()); |
| 2484 TestCompletionCallback callback2; | 2484 TestCompletionCallback callback2; |
| 2485 rv = trans->RestartWithAuth(std::wstring(), std::wstring(), &callback2); | 2485 rv = trans->RestartWithAuth(std::wstring(), std::wstring(), &callback2); |
| 2486 EXPECT_EQ(ERR_IO_PENDING, rv); | 2486 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2487 rv = callback2.WaitForResult(); | 2487 rv = callback2.WaitForResult(); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2560 | 2560 |
| 2561 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), | 2561 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), |
| 2562 data_writes1, arraysize(data_writes1)); | 2562 data_writes1, arraysize(data_writes1)); |
| 2563 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), | 2563 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), |
| 2564 data_writes2, arraysize(data_writes2)); | 2564 data_writes2, arraysize(data_writes2)); |
| 2565 session_deps.socket_factory.AddSocketDataProvider(&data1); | 2565 session_deps.socket_factory.AddSocketDataProvider(&data1); |
| 2566 session_deps.socket_factory.AddSocketDataProvider(&data2); | 2566 session_deps.socket_factory.AddSocketDataProvider(&data2); |
| 2567 | 2567 |
| 2568 TestCompletionCallback callback1; | 2568 TestCompletionCallback callback1; |
| 2569 | 2569 |
| 2570 int rv = trans->Start(&request, &callback1, NULL); | 2570 int rv = trans->Start(&request, &callback1, BoundNetLog()); |
| 2571 EXPECT_EQ(ERR_IO_PENDING, rv); | 2571 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2572 | 2572 |
| 2573 rv = callback1.WaitForResult(); | 2573 rv = callback1.WaitForResult(); |
| 2574 EXPECT_EQ(OK, rv); | 2574 EXPECT_EQ(OK, rv); |
| 2575 | 2575 |
| 2576 const HttpResponseInfo* response = trans->GetResponseInfo(); | 2576 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 2577 EXPECT_FALSE(response == NULL); | 2577 EXPECT_FALSE(response == NULL); |
| 2578 | 2578 |
| 2579 // The password prompt info should have been set in | 2579 // The password prompt info should have been set in |
| 2580 // response->auth_challenge. | 2580 // response->auth_challenge. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2645 | 2645 |
| 2646 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), | 2646 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), |
| 2647 data_writes1, arraysize(data_writes1)); | 2647 data_writes1, arraysize(data_writes1)); |
| 2648 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), | 2648 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), |
| 2649 data_writes2, arraysize(data_writes2)); | 2649 data_writes2, arraysize(data_writes2)); |
| 2650 session_deps.socket_factory.AddSocketDataProvider(&data1); | 2650 session_deps.socket_factory.AddSocketDataProvider(&data1); |
| 2651 session_deps.socket_factory.AddSocketDataProvider(&data2); | 2651 session_deps.socket_factory.AddSocketDataProvider(&data2); |
| 2652 | 2652 |
| 2653 TestCompletionCallback callback1; | 2653 TestCompletionCallback callback1; |
| 2654 | 2654 |
| 2655 int rv = trans->Start(&request, &callback1, NULL); | 2655 int rv = trans->Start(&request, &callback1, BoundNetLog()); |
| 2656 EXPECT_EQ(ERR_IO_PENDING, rv); | 2656 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2657 | 2657 |
| 2658 rv = callback1.WaitForResult(); | 2658 rv = callback1.WaitForResult(); |
| 2659 EXPECT_EQ(OK, rv); | 2659 EXPECT_EQ(OK, rv); |
| 2660 | 2660 |
| 2661 const HttpResponseInfo* response = trans->GetResponseInfo(); | 2661 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 2662 EXPECT_FALSE(response == NULL); | 2662 EXPECT_FALSE(response == NULL); |
| 2663 | 2663 |
| 2664 // The password prompt info should have been set in | 2664 // The password prompt info should have been set in |
| 2665 // response->auth_challenge. | 2665 // response->auth_challenge. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2710 MockRead("Content-Length: 100\r\n\r\n"), | 2710 MockRead("Content-Length: 100\r\n\r\n"), |
| 2711 MockRead(false, OK), | 2711 MockRead(false, OK), |
| 2712 }; | 2712 }; |
| 2713 | 2713 |
| 2714 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), | 2714 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), |
| 2715 data_writes1, arraysize(data_writes1)); | 2715 data_writes1, arraysize(data_writes1)); |
| 2716 session_deps.socket_factory.AddSocketDataProvider(&data1); | 2716 session_deps.socket_factory.AddSocketDataProvider(&data1); |
| 2717 | 2717 |
| 2718 TestCompletionCallback callback1; | 2718 TestCompletionCallback callback1; |
| 2719 | 2719 |
| 2720 int rv = trans->Start(&request, &callback1, NULL); | 2720 int rv = trans->Start(&request, &callback1, BoundNetLog()); |
| 2721 EXPECT_EQ(ERR_IO_PENDING, rv); | 2721 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2722 | 2722 |
| 2723 rv = callback1.WaitForResult(); | 2723 rv = callback1.WaitForResult(); |
| 2724 EXPECT_EQ(OK, rv); | 2724 EXPECT_EQ(OK, rv); |
| 2725 | 2725 |
| 2726 const HttpResponseInfo* response = trans->GetResponseInfo(); | 2726 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 2727 EXPECT_FALSE(response == NULL); | 2727 EXPECT_FALSE(response == NULL); |
| 2728 | 2728 |
| 2729 EXPECT_TRUE(response->auth_challenge.get() == NULL); | 2729 EXPECT_TRUE(response->auth_challenge.get() == NULL); |
| 2730 EXPECT_EQ(100, response->headers->GetContentLength()); | 2730 EXPECT_EQ(100, response->headers->GetContentLength()); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2772 | 2772 |
| 2773 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), | 2773 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), |
| 2774 data_writes1, arraysize(data_writes1)); | 2774 data_writes1, arraysize(data_writes1)); |
| 2775 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), | 2775 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), |
| 2776 data_writes2, arraysize(data_writes2)); | 2776 data_writes2, arraysize(data_writes2)); |
| 2777 session_deps.socket_factory.AddSocketDataProvider(&data1); | 2777 session_deps.socket_factory.AddSocketDataProvider(&data1); |
| 2778 session_deps.socket_factory.AddSocketDataProvider(&data2); | 2778 session_deps.socket_factory.AddSocketDataProvider(&data2); |
| 2779 | 2779 |
| 2780 TestCompletionCallback callback1; | 2780 TestCompletionCallback callback1; |
| 2781 | 2781 |
| 2782 int rv = trans->Start(&request, &callback1, NULL); | 2782 int rv = trans->Start(&request, &callback1, BoundNetLog()); |
| 2783 EXPECT_EQ(ERR_IO_PENDING, rv); | 2783 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2784 | 2784 |
| 2785 rv = callback1.WaitForResult(); | 2785 rv = callback1.WaitForResult(); |
| 2786 EXPECT_EQ(OK, rv); | 2786 EXPECT_EQ(OK, rv); |
| 2787 | 2787 |
| 2788 EXPECT_TRUE(trans->IsReadyToRestartForAuth()); | 2788 EXPECT_TRUE(trans->IsReadyToRestartForAuth()); |
| 2789 TestCompletionCallback callback2; | 2789 TestCompletionCallback callback2; |
| 2790 rv = trans->RestartWithAuth(std::wstring(), std::wstring(), &callback2); | 2790 rv = trans->RestartWithAuth(std::wstring(), std::wstring(), &callback2); |
| 2791 EXPECT_EQ(ERR_IO_PENDING, rv); | 2791 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2792 rv = callback2.WaitForResult(); | 2792 rv = callback2.WaitForResult(); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2861 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), | 2861 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), |
| 2862 data_writes2, arraysize(data_writes2)); | 2862 data_writes2, arraysize(data_writes2)); |
| 2863 StaticSocketDataProvider data3(data_reads3, arraysize(data_reads3), | 2863 StaticSocketDataProvider data3(data_reads3, arraysize(data_reads3), |
| 2864 data_writes3, arraysize(data_writes3)); | 2864 data_writes3, arraysize(data_writes3)); |
| 2865 session_deps.socket_factory.AddSocketDataProvider(&data1); | 2865 session_deps.socket_factory.AddSocketDataProvider(&data1); |
| 2866 session_deps.socket_factory.AddSocketDataProvider(&data2); | 2866 session_deps.socket_factory.AddSocketDataProvider(&data2); |
| 2867 session_deps.socket_factory.AddSocketDataProvider(&data3); | 2867 session_deps.socket_factory.AddSocketDataProvider(&data3); |
| 2868 | 2868 |
| 2869 TestCompletionCallback callback1; | 2869 TestCompletionCallback callback1; |
| 2870 | 2870 |
| 2871 int rv = trans->Start(&request, &callback1, NULL); | 2871 int rv = trans->Start(&request, &callback1, BoundNetLog()); |
| 2872 EXPECT_EQ(ERR_IO_PENDING, rv); | 2872 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2873 | 2873 |
| 2874 rv = callback1.WaitForResult(); | 2874 rv = callback1.WaitForResult(); |
| 2875 EXPECT_EQ(OK, rv); | 2875 EXPECT_EQ(OK, rv); |
| 2876 | 2876 |
| 2877 EXPECT_TRUE(trans->IsReadyToRestartForAuth()); | 2877 EXPECT_TRUE(trans->IsReadyToRestartForAuth()); |
| 2878 TestCompletionCallback callback2; | 2878 TestCompletionCallback callback2; |
| 2879 rv = trans->RestartWithAuth(std::wstring(), std::wstring(), &callback2); | 2879 rv = trans->RestartWithAuth(std::wstring(), std::wstring(), &callback2); |
| 2880 EXPECT_EQ(ERR_IO_PENDING, rv); | 2880 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2881 rv = callback2.WaitForResult(); | 2881 rv = callback2.WaitForResult(); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2981 SSLSocketDataProvider ssl_bad(true, ERR_CERT_AUTHORITY_INVALID); | 2981 SSLSocketDataProvider ssl_bad(true, ERR_CERT_AUTHORITY_INVALID); |
| 2982 SSLSocketDataProvider ssl(true, OK); | 2982 SSLSocketDataProvider ssl(true, OK); |
| 2983 | 2983 |
| 2984 session_deps.socket_factory.AddSocketDataProvider(&ssl_bad_certificate); | 2984 session_deps.socket_factory.AddSocketDataProvider(&ssl_bad_certificate); |
| 2985 session_deps.socket_factory.AddSocketDataProvider(&data); | 2985 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 2986 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl_bad); | 2986 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl_bad); |
| 2987 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); | 2987 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
| 2988 | 2988 |
| 2989 TestCompletionCallback callback; | 2989 TestCompletionCallback callback; |
| 2990 | 2990 |
| 2991 int rv = trans->Start(&request, &callback, NULL); | 2991 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 2992 EXPECT_EQ(ERR_IO_PENDING, rv); | 2992 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2993 | 2993 |
| 2994 rv = callback.WaitForResult(); | 2994 rv = callback.WaitForResult(); |
| 2995 EXPECT_EQ(ERR_CERT_AUTHORITY_INVALID, rv); | 2995 EXPECT_EQ(ERR_CERT_AUTHORITY_INVALID, rv); |
| 2996 | 2996 |
| 2997 rv = trans->RestartIgnoringLastError(&callback); | 2997 rv = trans->RestartIgnoringLastError(&callback); |
| 2998 EXPECT_EQ(ERR_IO_PENDING, rv); | 2998 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2999 | 2999 |
| 3000 rv = callback.WaitForResult(); | 3000 rv = callback.WaitForResult(); |
| 3001 EXPECT_EQ(OK, rv); | 3001 EXPECT_EQ(OK, rv); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3058 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); | 3058 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
| 3059 | 3059 |
| 3060 TestCompletionCallback callback; | 3060 TestCompletionCallback callback; |
| 3061 | 3061 |
| 3062 for (int i = 0; i < 2; i++) { | 3062 for (int i = 0; i < 2; i++) { |
| 3063 session_deps.socket_factory.ResetNextMockIndexes(); | 3063 session_deps.socket_factory.ResetNextMockIndexes(); |
| 3064 | 3064 |
| 3065 scoped_ptr<HttpTransaction> trans( | 3065 scoped_ptr<HttpTransaction> trans( |
| 3066 new HttpNetworkTransaction(CreateSession(&session_deps))); | 3066 new HttpNetworkTransaction(CreateSession(&session_deps))); |
| 3067 | 3067 |
| 3068 int rv = trans->Start(&request, &callback, NULL); | 3068 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 3069 EXPECT_EQ(ERR_IO_PENDING, rv); | 3069 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3070 | 3070 |
| 3071 rv = callback.WaitForResult(); | 3071 rv = callback.WaitForResult(); |
| 3072 EXPECT_EQ(ERR_CERT_AUTHORITY_INVALID, rv); | 3072 EXPECT_EQ(ERR_CERT_AUTHORITY_INVALID, rv); |
| 3073 | 3073 |
| 3074 rv = trans->RestartIgnoringLastError(&callback); | 3074 rv = trans->RestartIgnoringLastError(&callback); |
| 3075 EXPECT_EQ(ERR_IO_PENDING, rv); | 3075 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3076 | 3076 |
| 3077 rv = callback.WaitForResult(); | 3077 rv = callback.WaitForResult(); |
| 3078 EXPECT_EQ(OK, rv); | 3078 EXPECT_EQ(OK, rv); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 3109 MockRead("Content-Length: 100\r\n\r\n"), | 3109 MockRead("Content-Length: 100\r\n\r\n"), |
| 3110 MockRead(false, OK), | 3110 MockRead(false, OK), |
| 3111 }; | 3111 }; |
| 3112 | 3112 |
| 3113 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 3113 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 3114 data_writes, arraysize(data_writes)); | 3114 data_writes, arraysize(data_writes)); |
| 3115 session_deps.socket_factory.AddSocketDataProvider(&data); | 3115 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 3116 | 3116 |
| 3117 TestCompletionCallback callback; | 3117 TestCompletionCallback callback; |
| 3118 | 3118 |
| 3119 int rv = trans->Start(&request, &callback, NULL); | 3119 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 3120 EXPECT_EQ(ERR_IO_PENDING, rv); | 3120 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3121 | 3121 |
| 3122 rv = callback.WaitForResult(); | 3122 rv = callback.WaitForResult(); |
| 3123 EXPECT_EQ(OK, rv); | 3123 EXPECT_EQ(OK, rv); |
| 3124 } | 3124 } |
| 3125 | 3125 |
| 3126 TEST_F(HttpNetworkTransactionTest, BuildRequest_Referer) { | 3126 TEST_F(HttpNetworkTransactionTest, BuildRequest_Referer) { |
| 3127 SessionDependencies session_deps; | 3127 SessionDependencies session_deps; |
| 3128 scoped_ptr<HttpTransaction> trans( | 3128 scoped_ptr<HttpTransaction> trans( |
| 3129 new HttpNetworkTransaction(CreateSession(&session_deps))); | 3129 new HttpNetworkTransaction(CreateSession(&session_deps))); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3148 MockRead("Content-Length: 100\r\n\r\n"), | 3148 MockRead("Content-Length: 100\r\n\r\n"), |
| 3149 MockRead(false, OK), | 3149 MockRead(false, OK), |
| 3150 }; | 3150 }; |
| 3151 | 3151 |
| 3152 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 3152 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 3153 data_writes, arraysize(data_writes)); | 3153 data_writes, arraysize(data_writes)); |
| 3154 session_deps.socket_factory.AddSocketDataProvider(&data); | 3154 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 3155 | 3155 |
| 3156 TestCompletionCallback callback; | 3156 TestCompletionCallback callback; |
| 3157 | 3157 |
| 3158 int rv = trans->Start(&request, &callback, NULL); | 3158 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 3159 EXPECT_EQ(ERR_IO_PENDING, rv); | 3159 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3160 | 3160 |
| 3161 rv = callback.WaitForResult(); | 3161 rv = callback.WaitForResult(); |
| 3162 EXPECT_EQ(OK, rv); | 3162 EXPECT_EQ(OK, rv); |
| 3163 } | 3163 } |
| 3164 | 3164 |
| 3165 TEST_F(HttpNetworkTransactionTest, BuildRequest_PostContentLengthZero) { | 3165 TEST_F(HttpNetworkTransactionTest, BuildRequest_PostContentLengthZero) { |
| 3166 SessionDependencies session_deps; | 3166 SessionDependencies session_deps; |
| 3167 scoped_ptr<HttpTransaction> trans( | 3167 scoped_ptr<HttpTransaction> trans( |
| 3168 new HttpNetworkTransaction(CreateSession(&session_deps))); | 3168 new HttpNetworkTransaction(CreateSession(&session_deps))); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 3185 MockRead("Content-Length: 100\r\n\r\n"), | 3185 MockRead("Content-Length: 100\r\n\r\n"), |
| 3186 MockRead(false, OK), | 3186 MockRead(false, OK), |
| 3187 }; | 3187 }; |
| 3188 | 3188 |
| 3189 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 3189 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 3190 data_writes, arraysize(data_writes)); | 3190 data_writes, arraysize(data_writes)); |
| 3191 session_deps.socket_factory.AddSocketDataProvider(&data); | 3191 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 3192 | 3192 |
| 3193 TestCompletionCallback callback; | 3193 TestCompletionCallback callback; |
| 3194 | 3194 |
| 3195 int rv = trans->Start(&request, &callback, NULL); | 3195 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 3196 EXPECT_EQ(ERR_IO_PENDING, rv); | 3196 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3197 | 3197 |
| 3198 rv = callback.WaitForResult(); | 3198 rv = callback.WaitForResult(); |
| 3199 EXPECT_EQ(OK, rv); | 3199 EXPECT_EQ(OK, rv); |
| 3200 } | 3200 } |
| 3201 | 3201 |
| 3202 TEST_F(HttpNetworkTransactionTest, BuildRequest_PutContentLengthZero) { | 3202 TEST_F(HttpNetworkTransactionTest, BuildRequest_PutContentLengthZero) { |
| 3203 SessionDependencies session_deps; | 3203 SessionDependencies session_deps; |
| 3204 scoped_ptr<HttpTransaction> trans( | 3204 scoped_ptr<HttpTransaction> trans( |
| 3205 new HttpNetworkTransaction(CreateSession(&session_deps))); | 3205 new HttpNetworkTransaction(CreateSession(&session_deps))); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 3222 MockRead("Content-Length: 100\r\n\r\n"), | 3222 MockRead("Content-Length: 100\r\n\r\n"), |
| 3223 MockRead(false, OK), | 3223 MockRead(false, OK), |
| 3224 }; | 3224 }; |
| 3225 | 3225 |
| 3226 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 3226 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 3227 data_writes, arraysize(data_writes)); | 3227 data_writes, arraysize(data_writes)); |
| 3228 session_deps.socket_factory.AddSocketDataProvider(&data); | 3228 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 3229 | 3229 |
| 3230 TestCompletionCallback callback; | 3230 TestCompletionCallback callback; |
| 3231 | 3231 |
| 3232 int rv = trans->Start(&request, &callback, NULL); | 3232 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 3233 EXPECT_EQ(ERR_IO_PENDING, rv); | 3233 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3234 | 3234 |
| 3235 rv = callback.WaitForResult(); | 3235 rv = callback.WaitForResult(); |
| 3236 EXPECT_EQ(OK, rv); | 3236 EXPECT_EQ(OK, rv); |
| 3237 } | 3237 } |
| 3238 | 3238 |
| 3239 TEST_F(HttpNetworkTransactionTest, BuildRequest_HeadContentLengthZero) { | 3239 TEST_F(HttpNetworkTransactionTest, BuildRequest_HeadContentLengthZero) { |
| 3240 SessionDependencies session_deps; | 3240 SessionDependencies session_deps; |
| 3241 scoped_ptr<HttpTransaction> trans( | 3241 scoped_ptr<HttpTransaction> trans( |
| 3242 new HttpNetworkTransaction(CreateSession(&session_deps))); | 3242 new HttpNetworkTransaction(CreateSession(&session_deps))); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 3259 MockRead("Content-Length: 100\r\n\r\n"), | 3259 MockRead("Content-Length: 100\r\n\r\n"), |
| 3260 MockRead(false, OK), | 3260 MockRead(false, OK), |
| 3261 }; | 3261 }; |
| 3262 | 3262 |
| 3263 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 3263 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 3264 data_writes, arraysize(data_writes)); | 3264 data_writes, arraysize(data_writes)); |
| 3265 session_deps.socket_factory.AddSocketDataProvider(&data); | 3265 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 3266 | 3266 |
| 3267 TestCompletionCallback callback; | 3267 TestCompletionCallback callback; |
| 3268 | 3268 |
| 3269 int rv = trans->Start(&request, &callback, NULL); | 3269 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 3270 EXPECT_EQ(ERR_IO_PENDING, rv); | 3270 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3271 | 3271 |
| 3272 rv = callback.WaitForResult(); | 3272 rv = callback.WaitForResult(); |
| 3273 EXPECT_EQ(OK, rv); | 3273 EXPECT_EQ(OK, rv); |
| 3274 } | 3274 } |
| 3275 | 3275 |
| 3276 TEST_F(HttpNetworkTransactionTest, BuildRequest_CacheControlNoCache) { | 3276 TEST_F(HttpNetworkTransactionTest, BuildRequest_CacheControlNoCache) { |
| 3277 SessionDependencies session_deps; | 3277 SessionDependencies session_deps; |
| 3278 scoped_ptr<HttpTransaction> trans( | 3278 scoped_ptr<HttpTransaction> trans( |
| 3279 new HttpNetworkTransaction(CreateSession(&session_deps))); | 3279 new HttpNetworkTransaction(CreateSession(&session_deps))); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3298 MockRead("Content-Length: 100\r\n\r\n"), | 3298 MockRead("Content-Length: 100\r\n\r\n"), |
| 3299 MockRead(false, OK), | 3299 MockRead(false, OK), |
| 3300 }; | 3300 }; |
| 3301 | 3301 |
| 3302 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 3302 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 3303 data_writes, arraysize(data_writes)); | 3303 data_writes, arraysize(data_writes)); |
| 3304 session_deps.socket_factory.AddSocketDataProvider(&data); | 3304 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 3305 | 3305 |
| 3306 TestCompletionCallback callback; | 3306 TestCompletionCallback callback; |
| 3307 | 3307 |
| 3308 int rv = trans->Start(&request, &callback, NULL); | 3308 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 3309 EXPECT_EQ(ERR_IO_PENDING, rv); | 3309 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3310 | 3310 |
| 3311 rv = callback.WaitForResult(); | 3311 rv = callback.WaitForResult(); |
| 3312 EXPECT_EQ(OK, rv); | 3312 EXPECT_EQ(OK, rv); |
| 3313 } | 3313 } |
| 3314 | 3314 |
| 3315 TEST_F(HttpNetworkTransactionTest, | 3315 TEST_F(HttpNetworkTransactionTest, |
| 3316 BuildRequest_CacheControlValidateCache) { | 3316 BuildRequest_CacheControlValidateCache) { |
| 3317 SessionDependencies session_deps; | 3317 SessionDependencies session_deps; |
| 3318 scoped_ptr<HttpTransaction> trans( | 3318 scoped_ptr<HttpTransaction> trans( |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3337 MockRead("Content-Length: 100\r\n\r\n"), | 3337 MockRead("Content-Length: 100\r\n\r\n"), |
| 3338 MockRead(false, OK), | 3338 MockRead(false, OK), |
| 3339 }; | 3339 }; |
| 3340 | 3340 |
| 3341 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 3341 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 3342 data_writes, arraysize(data_writes)); | 3342 data_writes, arraysize(data_writes)); |
| 3343 session_deps.socket_factory.AddSocketDataProvider(&data); | 3343 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 3344 | 3344 |
| 3345 TestCompletionCallback callback; | 3345 TestCompletionCallback callback; |
| 3346 | 3346 |
| 3347 int rv = trans->Start(&request, &callback, NULL); | 3347 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 3348 EXPECT_EQ(ERR_IO_PENDING, rv); | 3348 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3349 | 3349 |
| 3350 rv = callback.WaitForResult(); | 3350 rv = callback.WaitForResult(); |
| 3351 EXPECT_EQ(OK, rv); | 3351 EXPECT_EQ(OK, rv); |
| 3352 } | 3352 } |
| 3353 | 3353 |
| 3354 TEST_F(HttpNetworkTransactionTest, BuildRequest_ExtraHeaders) { | 3354 TEST_F(HttpNetworkTransactionTest, BuildRequest_ExtraHeaders) { |
| 3355 SessionDependencies session_deps; | 3355 SessionDependencies session_deps; |
| 3356 scoped_ptr<HttpTransaction> trans( | 3356 scoped_ptr<HttpTransaction> trans( |
| 3357 new HttpNetworkTransaction(CreateSession(&session_deps))); | 3357 new HttpNetworkTransaction(CreateSession(&session_deps))); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 3375 MockRead("Content-Length: 100\r\n\r\n"), | 3375 MockRead("Content-Length: 100\r\n\r\n"), |
| 3376 MockRead(false, OK), | 3376 MockRead(false, OK), |
| 3377 }; | 3377 }; |
| 3378 | 3378 |
| 3379 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 3379 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 3380 data_writes, arraysize(data_writes)); | 3380 data_writes, arraysize(data_writes)); |
| 3381 session_deps.socket_factory.AddSocketDataProvider(&data); | 3381 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 3382 | 3382 |
| 3383 TestCompletionCallback callback; | 3383 TestCompletionCallback callback; |
| 3384 | 3384 |
| 3385 int rv = trans->Start(&request, &callback, NULL); | 3385 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 3386 EXPECT_EQ(ERR_IO_PENDING, rv); | 3386 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3387 | 3387 |
| 3388 rv = callback.WaitForResult(); | 3388 rv = callback.WaitForResult(); |
| 3389 EXPECT_EQ(OK, rv); | 3389 EXPECT_EQ(OK, rv); |
| 3390 } | 3390 } |
| 3391 | 3391 |
| 3392 TEST_F(HttpNetworkTransactionTest, BuildRequest_ExtraHeadersStripped) { | 3392 TEST_F(HttpNetworkTransactionTest, BuildRequest_ExtraHeadersStripped) { |
| 3393 SessionDependencies session_deps; | 3393 SessionDependencies session_deps; |
| 3394 scoped_ptr<HttpTransaction> trans( | 3394 scoped_ptr<HttpTransaction> trans( |
| 3395 new HttpNetworkTransaction(CreateSession(&session_deps))); | 3395 new HttpNetworkTransaction(CreateSession(&session_deps))); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 3416 MockRead("Content-Length: 100\r\n\r\n"), | 3416 MockRead("Content-Length: 100\r\n\r\n"), |
| 3417 MockRead(false, OK), | 3417 MockRead(false, OK), |
| 3418 }; | 3418 }; |
| 3419 | 3419 |
| 3420 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 3420 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 3421 data_writes, arraysize(data_writes)); | 3421 data_writes, arraysize(data_writes)); |
| 3422 session_deps.socket_factory.AddSocketDataProvider(&data); | 3422 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 3423 | 3423 |
| 3424 TestCompletionCallback callback; | 3424 TestCompletionCallback callback; |
| 3425 | 3425 |
| 3426 int rv = trans->Start(&request, &callback, NULL); | 3426 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 3427 EXPECT_EQ(ERR_IO_PENDING, rv); | 3427 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3428 | 3428 |
| 3429 rv = callback.WaitForResult(); | 3429 rv = callback.WaitForResult(); |
| 3430 EXPECT_EQ(OK, rv); | 3430 EXPECT_EQ(OK, rv); |
| 3431 } | 3431 } |
| 3432 | 3432 |
| 3433 TEST_F(HttpNetworkTransactionTest, SOCKS4_HTTP_GET) { | 3433 TEST_F(HttpNetworkTransactionTest, SOCKS4_HTTP_GET) { |
| 3434 SessionDependencies session_deps( | 3434 SessionDependencies session_deps( |
| 3435 CreateFixedProxyService("socks4://myproxy:1080")); | 3435 CreateFixedProxyService("socks4://myproxy:1080")); |
| 3436 | 3436 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 3459 MockRead("Payload"), | 3459 MockRead("Payload"), |
| 3460 MockRead(false, OK) | 3460 MockRead(false, OK) |
| 3461 }; | 3461 }; |
| 3462 | 3462 |
| 3463 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 3463 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 3464 data_writes, arraysize(data_writes)); | 3464 data_writes, arraysize(data_writes)); |
| 3465 session_deps.socket_factory.AddSocketDataProvider(&data); | 3465 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 3466 | 3466 |
| 3467 TestCompletionCallback callback; | 3467 TestCompletionCallback callback; |
| 3468 | 3468 |
| 3469 int rv = trans->Start(&request, &callback, NULL); | 3469 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 3470 EXPECT_EQ(ERR_IO_PENDING, rv); | 3470 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3471 | 3471 |
| 3472 rv = callback.WaitForResult(); | 3472 rv = callback.WaitForResult(); |
| 3473 EXPECT_EQ(OK, rv); | 3473 EXPECT_EQ(OK, rv); |
| 3474 | 3474 |
| 3475 const HttpResponseInfo* response = trans->GetResponseInfo(); | 3475 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 3476 EXPECT_FALSE(response == NULL); | 3476 EXPECT_FALSE(response == NULL); |
| 3477 | 3477 |
| 3478 std::string response_text; | 3478 std::string response_text; |
| 3479 rv = ReadTransaction(trans.get(), &response_text); | 3479 rv = ReadTransaction(trans.get(), &response_text); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3515 | 3515 |
| 3516 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 3516 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 3517 data_writes, arraysize(data_writes)); | 3517 data_writes, arraysize(data_writes)); |
| 3518 session_deps.socket_factory.AddSocketDataProvider(&data); | 3518 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 3519 | 3519 |
| 3520 SSLSocketDataProvider ssl(true, OK); | 3520 SSLSocketDataProvider ssl(true, OK); |
| 3521 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); | 3521 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
| 3522 | 3522 |
| 3523 TestCompletionCallback callback; | 3523 TestCompletionCallback callback; |
| 3524 | 3524 |
| 3525 int rv = trans->Start(&request, &callback, NULL); | 3525 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 3526 EXPECT_EQ(ERR_IO_PENDING, rv); | 3526 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3527 | 3527 |
| 3528 rv = callback.WaitForResult(); | 3528 rv = callback.WaitForResult(); |
| 3529 EXPECT_EQ(OK, rv); | 3529 EXPECT_EQ(OK, rv); |
| 3530 | 3530 |
| 3531 const HttpResponseInfo* response = trans->GetResponseInfo(); | 3531 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 3532 EXPECT_FALSE(response == NULL); | 3532 EXPECT_FALSE(response == NULL); |
| 3533 | 3533 |
| 3534 std::string response_text; | 3534 std::string response_text; |
| 3535 rv = ReadTransaction(trans.get(), &response_text); | 3535 rv = ReadTransaction(trans.get(), &response_text); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3580 MockRead("Payload"), | 3580 MockRead("Payload"), |
| 3581 MockRead(false, OK) | 3581 MockRead(false, OK) |
| 3582 }; | 3582 }; |
| 3583 | 3583 |
| 3584 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 3584 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 3585 data_writes, arraysize(data_writes)); | 3585 data_writes, arraysize(data_writes)); |
| 3586 session_deps.socket_factory.AddSocketDataProvider(&data); | 3586 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 3587 | 3587 |
| 3588 TestCompletionCallback callback; | 3588 TestCompletionCallback callback; |
| 3589 | 3589 |
| 3590 int rv = trans->Start(&request, &callback, NULL); | 3590 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 3591 EXPECT_EQ(ERR_IO_PENDING, rv); | 3591 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3592 | 3592 |
| 3593 rv = callback.WaitForResult(); | 3593 rv = callback.WaitForResult(); |
| 3594 EXPECT_EQ(OK, rv); | 3594 EXPECT_EQ(OK, rv); |
| 3595 | 3595 |
| 3596 const HttpResponseInfo* response = trans->GetResponseInfo(); | 3596 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 3597 EXPECT_FALSE(response == NULL); | 3597 EXPECT_FALSE(response == NULL); |
| 3598 | 3598 |
| 3599 std::string response_text; | 3599 std::string response_text; |
| 3600 rv = ReadTransaction(trans.get(), &response_text); | 3600 rv = ReadTransaction(trans.get(), &response_text); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3650 | 3650 |
| 3651 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 3651 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 3652 data_writes, arraysize(data_writes)); | 3652 data_writes, arraysize(data_writes)); |
| 3653 session_deps.socket_factory.AddSocketDataProvider(&data); | 3653 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 3654 | 3654 |
| 3655 SSLSocketDataProvider ssl(true, OK); | 3655 SSLSocketDataProvider ssl(true, OK); |
| 3656 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); | 3656 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
| 3657 | 3657 |
| 3658 TestCompletionCallback callback; | 3658 TestCompletionCallback callback; |
| 3659 | 3659 |
| 3660 int rv = trans->Start(&request, &callback, NULL); | 3660 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 3661 EXPECT_EQ(ERR_IO_PENDING, rv); | 3661 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3662 | 3662 |
| 3663 rv = callback.WaitForResult(); | 3663 rv = callback.WaitForResult(); |
| 3664 EXPECT_EQ(OK, rv); | 3664 EXPECT_EQ(OK, rv); |
| 3665 | 3665 |
| 3666 const HttpResponseInfo* response = trans->GetResponseInfo(); | 3666 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 3667 EXPECT_FALSE(response == NULL); | 3667 EXPECT_FALSE(response == NULL); |
| 3668 | 3668 |
| 3669 std::string response_text; | 3669 std::string response_text; |
| 3670 rv = ReadTransaction(trans.get(), &response_text); | 3670 rv = ReadTransaction(trans.get(), &response_text); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3761 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); | 3761 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
| 3762 | 3762 |
| 3763 HttpRequestInfo request; | 3763 HttpRequestInfo request; |
| 3764 request.method = "GET"; | 3764 request.method = "GET"; |
| 3765 request.url = GURL(tests[i].url); | 3765 request.url = GURL(tests[i].url); |
| 3766 request.load_flags = 0; | 3766 request.load_flags = 0; |
| 3767 | 3767 |
| 3768 TestCompletionCallback callback; | 3768 TestCompletionCallback callback; |
| 3769 | 3769 |
| 3770 // We do not complete this request, the dtor will clean the transaction up. | 3770 // We do not complete this request, the dtor will clean the transaction up. |
| 3771 EXPECT_EQ(ERR_IO_PENDING, trans->Start(&request, &callback, NULL)); | 3771 EXPECT_EQ(ERR_IO_PENDING, trans->Start(&request, &callback, BoundNetLog())); |
| 3772 std::string allgroups = tcp_conn_pool->last_group_name_received() + | 3772 std::string allgroups = tcp_conn_pool->last_group_name_received() + |
| 3773 socks_conn_pool->last_group_name_received(); | 3773 socks_conn_pool->last_group_name_received(); |
| 3774 EXPECT_EQ(tests[i].expected_group_name, allgroups); | 3774 EXPECT_EQ(tests[i].expected_group_name, allgroups); |
| 3775 } | 3775 } |
| 3776 | 3776 |
| 3777 HttpNetworkTransaction::SetUseAlternateProtocols(false); | 3777 HttpNetworkTransaction::SetUseAlternateProtocols(false); |
| 3778 } | 3778 } |
| 3779 | 3779 |
| 3780 TEST_F(HttpNetworkTransactionTest, ReconsiderProxyAfterFailedConnection) { | 3780 TEST_F(HttpNetworkTransactionTest, ReconsiderProxyAfterFailedConnection) { |
| 3781 SessionDependencies session_deps( | 3781 SessionDependencies session_deps( |
| 3782 CreateFixedProxyService("myproxy:70;foobar:80")); | 3782 CreateFixedProxyService("myproxy:70;foobar:80")); |
| 3783 | 3783 |
| 3784 // This simulates failure resolving all hostnames; that means we will fail | 3784 // This simulates failure resolving all hostnames; that means we will fail |
| 3785 // connecting to both proxies (myproxy:70 and foobar:80). | 3785 // connecting to both proxies (myproxy:70 and foobar:80). |
| 3786 session_deps.host_resolver->rules()->AddSimulatedFailure("*"); | 3786 session_deps.host_resolver->rules()->AddSimulatedFailure("*"); |
| 3787 | 3787 |
| 3788 scoped_ptr<HttpTransaction> trans( | 3788 scoped_ptr<HttpTransaction> trans( |
| 3789 new HttpNetworkTransaction(CreateSession(&session_deps))); | 3789 new HttpNetworkTransaction(CreateSession(&session_deps))); |
| 3790 | 3790 |
| 3791 HttpRequestInfo request; | 3791 HttpRequestInfo request; |
| 3792 request.method = "GET"; | 3792 request.method = "GET"; |
| 3793 request.url = GURL("http://www.google.com/"); | 3793 request.url = GURL("http://www.google.com/"); |
| 3794 | 3794 |
| 3795 TestCompletionCallback callback; | 3795 TestCompletionCallback callback; |
| 3796 | 3796 |
| 3797 int rv = trans->Start(&request, &callback, NULL); | 3797 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 3798 EXPECT_EQ(ERR_IO_PENDING, rv); | 3798 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3799 | 3799 |
| 3800 rv = callback.WaitForResult(); | 3800 rv = callback.WaitForResult(); |
| 3801 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, rv); | 3801 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, rv); |
| 3802 } | 3802 } |
| 3803 | 3803 |
| 3804 // Host resolution observer used by | 3804 // Host resolution observer used by |
| 3805 // HttpNetworkTransactionTest.ResolveMadeWithReferrer to check that host | 3805 // HttpNetworkTransactionTest.ResolveMadeWithReferrer to check that host |
| 3806 // resovle requests are issued with a referrer of |expected_referrer|. | 3806 // resovle requests are issued with a referrer of |expected_referrer|. |
| 3807 class ResolutionReferrerObserver : public HostResolver::Observer { | 3807 class ResolutionReferrerObserver : public HostResolver::Observer { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3863 session_deps.socket_factory.AddSocketDataProvider(&data); | 3863 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 3864 | 3864 |
| 3865 // Issue a request, containing an HTTP referrer. | 3865 // Issue a request, containing an HTTP referrer. |
| 3866 HttpRequestInfo request; | 3866 HttpRequestInfo request; |
| 3867 request.method = "GET"; | 3867 request.method = "GET"; |
| 3868 request.referrer = referrer; | 3868 request.referrer = referrer; |
| 3869 request.url = GURL("http://www.google.com/"); | 3869 request.url = GURL("http://www.google.com/"); |
| 3870 | 3870 |
| 3871 // Run the request until it fails reading from the socket. | 3871 // Run the request until it fails reading from the socket. |
| 3872 TestCompletionCallback callback; | 3872 TestCompletionCallback callback; |
| 3873 int rv = trans->Start(&request, &callback, NULL); | 3873 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 3874 EXPECT_EQ(ERR_IO_PENDING, rv); | 3874 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3875 rv = callback.WaitForResult(); | 3875 rv = callback.WaitForResult(); |
| 3876 EXPECT_EQ(ERR_FAILED, rv); | 3876 EXPECT_EQ(ERR_FAILED, rv); |
| 3877 | 3877 |
| 3878 // Check that the host resolution observer saw |referrer|. | 3878 // Check that the host resolution observer saw |referrer|. |
| 3879 EXPECT_TRUE(resolution_observer.did_complete_with_expected_referrer()); | 3879 EXPECT_TRUE(resolution_observer.did_complete_with_expected_referrer()); |
| 3880 } | 3880 } |
| 3881 | 3881 |
| 3882 // Make sure that when the load flags contain LOAD_BYPASS_CACHE, the resolver's | 3882 // Make sure that when the load flags contain LOAD_BYPASS_CACHE, the resolver's |
| 3883 // host cache is bypassed. | 3883 // host cache is bypassed. |
| 3884 TEST_F(HttpNetworkTransactionTest, BypassHostCacheOnRefresh) { | 3884 TEST_F(HttpNetworkTransactionTest, BypassHostCacheOnRefresh) { |
| 3885 SessionDependencies session_deps; | 3885 SessionDependencies session_deps; |
| 3886 | 3886 |
| 3887 // Select a host resolver that does caching. | 3887 // Select a host resolver that does caching. |
| 3888 session_deps.host_resolver = new MockCachingHostResolver; | 3888 session_deps.host_resolver = new MockCachingHostResolver; |
| 3889 | 3889 |
| 3890 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction( | 3890 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction( |
| 3891 CreateSession(&session_deps))); | 3891 CreateSession(&session_deps))); |
| 3892 | 3892 |
| 3893 // Warm up the host cache so it has an entry for "www.google.com" (by doing | 3893 // Warm up the host cache so it has an entry for "www.google.com" (by doing |
| 3894 // a synchronous lookup.) | 3894 // a synchronous lookup.) |
| 3895 AddressList addrlist; | 3895 AddressList addrlist; |
| 3896 int rv = session_deps.host_resolver->Resolve( | 3896 int rv = session_deps.host_resolver->Resolve( |
| 3897 HostResolver::RequestInfo("www.google.com", 80), &addrlist, | 3897 HostResolver::RequestInfo("www.google.com", 80), &addrlist, |
| 3898 NULL, NULL, NULL); | 3898 NULL, NULL, BoundNetLog()); |
| 3899 EXPECT_EQ(OK, rv); | 3899 EXPECT_EQ(OK, rv); |
| 3900 | 3900 |
| 3901 // Verify that it was added to host cache, by doing a subsequent async lookup | 3901 // Verify that it was added to host cache, by doing a subsequent async lookup |
| 3902 // and confirming it completes synchronously. | 3902 // and confirming it completes synchronously. |
| 3903 TestCompletionCallback resolve_callback; | 3903 TestCompletionCallback resolve_callback; |
| 3904 rv = session_deps.host_resolver->Resolve( | 3904 rv = session_deps.host_resolver->Resolve( |
| 3905 HostResolver::RequestInfo("www.google.com", 80), &addrlist, | 3905 HostResolver::RequestInfo("www.google.com", 80), &addrlist, |
| 3906 &resolve_callback, NULL, NULL); | 3906 &resolve_callback, NULL, BoundNetLog()); |
| 3907 ASSERT_EQ(OK, rv); | 3907 ASSERT_EQ(OK, rv); |
| 3908 | 3908 |
| 3909 // Inject a failure the next time that "www.google.com" is resolved. This way | 3909 // Inject a failure the next time that "www.google.com" is resolved. This way |
| 3910 // we can tell if the next lookup hit the cache, or the "network". | 3910 // we can tell if the next lookup hit the cache, or the "network". |
| 3911 // (cache --> success, "network" --> failure). | 3911 // (cache --> success, "network" --> failure). |
| 3912 session_deps.host_resolver->rules()->AddSimulatedFailure("www.google.com"); | 3912 session_deps.host_resolver->rules()->AddSimulatedFailure("www.google.com"); |
| 3913 | 3913 |
| 3914 // Connect up a mock socket which will fail with ERR_UNEXPECTED during the | 3914 // Connect up a mock socket which will fail with ERR_UNEXPECTED during the |
| 3915 // first read -- this won't be reached as the host resolution will fail first. | 3915 // first read -- this won't be reached as the host resolution will fail first. |
| 3916 MockRead data_reads[] = { MockRead(false, ERR_UNEXPECTED) }; | 3916 MockRead data_reads[] = { MockRead(false, ERR_UNEXPECTED) }; |
| 3917 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 3917 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 3918 session_deps.socket_factory.AddSocketDataProvider(&data); | 3918 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 3919 | 3919 |
| 3920 // Issue a request, asking to bypass the cache(s). | 3920 // Issue a request, asking to bypass the cache(s). |
| 3921 HttpRequestInfo request; | 3921 HttpRequestInfo request; |
| 3922 request.method = "GET"; | 3922 request.method = "GET"; |
| 3923 request.load_flags = LOAD_BYPASS_CACHE; | 3923 request.load_flags = LOAD_BYPASS_CACHE; |
| 3924 request.url = GURL("http://www.google.com/"); | 3924 request.url = GURL("http://www.google.com/"); |
| 3925 | 3925 |
| 3926 // Run the request. | 3926 // Run the request. |
| 3927 TestCompletionCallback callback; | 3927 TestCompletionCallback callback; |
| 3928 rv = trans->Start(&request, &callback, NULL); | 3928 rv = trans->Start(&request, &callback, BoundNetLog()); |
| 3929 ASSERT_EQ(ERR_IO_PENDING, rv); | 3929 ASSERT_EQ(ERR_IO_PENDING, rv); |
| 3930 rv = callback.WaitForResult(); | 3930 rv = callback.WaitForResult(); |
| 3931 | 3931 |
| 3932 // If we bypassed the cache, we would have gotten a failure while resolving | 3932 // If we bypassed the cache, we would have gotten a failure while resolving |
| 3933 // "www.google.com". | 3933 // "www.google.com". |
| 3934 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, rv); | 3934 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, rv); |
| 3935 } | 3935 } |
| 3936 | 3936 |
| 3937 // Make sure we can handle an error when writing the request. | 3937 // Make sure we can handle an error when writing the request. |
| 3938 TEST_F(HttpNetworkTransactionTest, RequestWriteError) { | 3938 TEST_F(HttpNetworkTransactionTest, RequestWriteError) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 3949 }; | 3949 }; |
| 3950 StaticSocketDataProvider data(NULL, 0, | 3950 StaticSocketDataProvider data(NULL, 0, |
| 3951 write_failure, arraysize(write_failure)); | 3951 write_failure, arraysize(write_failure)); |
| 3952 session_deps.socket_factory.AddSocketDataProvider(&data); | 3952 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 3953 | 3953 |
| 3954 TestCompletionCallback callback; | 3954 TestCompletionCallback callback; |
| 3955 | 3955 |
| 3956 scoped_ptr<HttpTransaction> trans( | 3956 scoped_ptr<HttpTransaction> trans( |
| 3957 new HttpNetworkTransaction(CreateSession(&session_deps))); | 3957 new HttpNetworkTransaction(CreateSession(&session_deps))); |
| 3958 | 3958 |
| 3959 int rv = trans->Start(&request, &callback, NULL); | 3959 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 3960 EXPECT_EQ(ERR_IO_PENDING, rv); | 3960 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3961 | 3961 |
| 3962 rv = callback.WaitForResult(); | 3962 rv = callback.WaitForResult(); |
| 3963 EXPECT_EQ(ERR_CONNECTION_RESET, rv); | 3963 EXPECT_EQ(ERR_CONNECTION_RESET, rv); |
| 3964 } | 3964 } |
| 3965 | 3965 |
| 3966 // Check that a connection closed after the start of the headers finishes ok. | 3966 // Check that a connection closed after the start of the headers finishes ok. |
| 3967 TEST_F(HttpNetworkTransactionTest, ConnectionClosedAfterStartOfHeaders) { | 3967 TEST_F(HttpNetworkTransactionTest, ConnectionClosedAfterStartOfHeaders) { |
| 3968 SessionDependencies session_deps; | 3968 SessionDependencies session_deps; |
| 3969 scoped_refptr<HttpNetworkSession> session = CreateSession(&session_deps); | 3969 scoped_refptr<HttpNetworkSession> session = CreateSession(&session_deps); |
| 3970 | 3970 |
| 3971 HttpRequestInfo request; | 3971 HttpRequestInfo request; |
| 3972 request.method = "GET"; | 3972 request.method = "GET"; |
| 3973 request.url = GURL("http://www.foo.com/"); | 3973 request.url = GURL("http://www.foo.com/"); |
| 3974 request.load_flags = 0; | 3974 request.load_flags = 0; |
| 3975 | 3975 |
| 3976 MockRead data_reads[] = { | 3976 MockRead data_reads[] = { |
| 3977 MockRead("HTTP/1."), | 3977 MockRead("HTTP/1."), |
| 3978 MockRead(false, OK), | 3978 MockRead(false, OK), |
| 3979 }; | 3979 }; |
| 3980 | 3980 |
| 3981 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 3981 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 3982 session_deps.socket_factory.AddSocketDataProvider(&data); | 3982 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 3983 | 3983 |
| 3984 TestCompletionCallback callback; | 3984 TestCompletionCallback callback; |
| 3985 | 3985 |
| 3986 scoped_ptr<HttpTransaction> trans( | 3986 scoped_ptr<HttpTransaction> trans( |
| 3987 new HttpNetworkTransaction(CreateSession(&session_deps))); | 3987 new HttpNetworkTransaction(CreateSession(&session_deps))); |
| 3988 | 3988 |
| 3989 int rv = trans->Start(&request, &callback, NULL); | 3989 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 3990 EXPECT_EQ(ERR_IO_PENDING, rv); | 3990 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3991 | 3991 |
| 3992 rv = callback.WaitForResult(); | 3992 rv = callback.WaitForResult(); |
| 3993 EXPECT_EQ(OK, rv); | 3993 EXPECT_EQ(OK, rv); |
| 3994 | 3994 |
| 3995 const HttpResponseInfo* response = trans->GetResponseInfo(); | 3995 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 3996 EXPECT_TRUE(response != NULL); | 3996 EXPECT_TRUE(response != NULL); |
| 3997 | 3997 |
| 3998 EXPECT_TRUE(response->headers != NULL); | 3998 EXPECT_TRUE(response->headers != NULL); |
| 3999 EXPECT_EQ("HTTP/1.0 200 OK", response->headers->GetStatusLine()); | 3999 EXPECT_EQ("HTTP/1.0 200 OK", response->headers->GetStatusLine()); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4051 MockRead("Content-Length: 100\r\n\r\n"), | 4051 MockRead("Content-Length: 100\r\n\r\n"), |
| 4052 MockRead(false, OK), | 4052 MockRead(false, OK), |
| 4053 }; | 4053 }; |
| 4054 | 4054 |
| 4055 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), | 4055 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), |
| 4056 data_writes2, arraysize(data_writes2)); | 4056 data_writes2, arraysize(data_writes2)); |
| 4057 session_deps.socket_factory.AddSocketDataProvider(&data2); | 4057 session_deps.socket_factory.AddSocketDataProvider(&data2); |
| 4058 | 4058 |
| 4059 TestCompletionCallback callback1; | 4059 TestCompletionCallback callback1; |
| 4060 | 4060 |
| 4061 int rv = trans->Start(&request, &callback1, NULL); | 4061 int rv = trans->Start(&request, &callback1, BoundNetLog()); |
| 4062 EXPECT_EQ(ERR_IO_PENDING, rv); | 4062 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 4063 | 4063 |
| 4064 rv = callback1.WaitForResult(); | 4064 rv = callback1.WaitForResult(); |
| 4065 EXPECT_EQ(OK, rv); | 4065 EXPECT_EQ(OK, rv); |
| 4066 | 4066 |
| 4067 const HttpResponseInfo* response = trans->GetResponseInfo(); | 4067 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 4068 EXPECT_FALSE(response == NULL); | 4068 EXPECT_FALSE(response == NULL); |
| 4069 | 4069 |
| 4070 // The password prompt info should have been set in response->auth_challenge. | 4070 // The password prompt info should have been set in response->auth_challenge. |
| 4071 EXPECT_FALSE(response->auth_challenge.get() == NULL); | 4071 EXPECT_FALSE(response->auth_challenge.get() == NULL); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4108 session_deps.socket_factory.AddSocketDataProvider(&data); | 4108 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 4109 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); | 4109 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
| 4110 | 4110 |
| 4111 TestCompletionCallback callback; | 4111 TestCompletionCallback callback; |
| 4112 | 4112 |
| 4113 session_deps.socket_factory.ResetNextMockIndexes(); | 4113 session_deps.socket_factory.ResetNextMockIndexes(); |
| 4114 | 4114 |
| 4115 scoped_ptr<HttpTransaction> trans( | 4115 scoped_ptr<HttpTransaction> trans( |
| 4116 new HttpNetworkTransaction(CreateSession(&session_deps))); | 4116 new HttpNetworkTransaction(CreateSession(&session_deps))); |
| 4117 | 4117 |
| 4118 int rv = trans->Start(&request, &callback, NULL); | 4118 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 4119 EXPECT_EQ(ERR_IO_PENDING, rv); | 4119 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 4120 | 4120 |
| 4121 rv = callback.WaitForResult(); | 4121 rv = callback.WaitForResult(); |
| 4122 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); | 4122 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); |
| 4123 } | 4123 } |
| 4124 | 4124 |
| 4125 TEST_F(HttpNetworkTransactionTest, LargeContentLengthThenClose) { | 4125 TEST_F(HttpNetworkTransactionTest, LargeContentLengthThenClose) { |
| 4126 SessionDependencies session_deps; | 4126 SessionDependencies session_deps; |
| 4127 scoped_ptr<HttpTransaction> trans( | 4127 scoped_ptr<HttpTransaction> trans( |
| 4128 new HttpNetworkTransaction(CreateSession(&session_deps))); | 4128 new HttpNetworkTransaction(CreateSession(&session_deps))); |
| 4129 | 4129 |
| 4130 HttpRequestInfo request; | 4130 HttpRequestInfo request; |
| 4131 request.method = "GET"; | 4131 request.method = "GET"; |
| 4132 request.url = GURL("http://www.google.com/"); | 4132 request.url = GURL("http://www.google.com/"); |
| 4133 request.load_flags = 0; | 4133 request.load_flags = 0; |
| 4134 | 4134 |
| 4135 MockRead data_reads[] = { | 4135 MockRead data_reads[] = { |
| 4136 MockRead("HTTP/1.0 200 OK\r\nContent-Length:6719476739\r\n\r\n"), | 4136 MockRead("HTTP/1.0 200 OK\r\nContent-Length:6719476739\r\n\r\n"), |
| 4137 MockRead(false, OK), | 4137 MockRead(false, OK), |
| 4138 }; | 4138 }; |
| 4139 | 4139 |
| 4140 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 4140 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 4141 session_deps.socket_factory.AddSocketDataProvider(&data); | 4141 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 4142 | 4142 |
| 4143 TestCompletionCallback callback; | 4143 TestCompletionCallback callback; |
| 4144 | 4144 |
| 4145 int rv = trans->Start(&request, &callback, NULL); | 4145 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 4146 EXPECT_EQ(ERR_IO_PENDING, rv); | 4146 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 4147 | 4147 |
| 4148 EXPECT_EQ(OK, callback.WaitForResult()); | 4148 EXPECT_EQ(OK, callback.WaitForResult()); |
| 4149 | 4149 |
| 4150 const HttpResponseInfo* response = trans->GetResponseInfo(); | 4150 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 4151 EXPECT_TRUE(response != NULL); | 4151 EXPECT_TRUE(response != NULL); |
| 4152 | 4152 |
| 4153 EXPECT_TRUE(response->headers != NULL); | 4153 EXPECT_TRUE(response->headers != NULL); |
| 4154 EXPECT_EQ("HTTP/1.0 200 OK", response->headers->GetStatusLine()); | 4154 EXPECT_EQ("HTTP/1.0 200 OK", response->headers->GetStatusLine()); |
| 4155 | 4155 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 4184 MockRead data_reads[] = { | 4184 MockRead data_reads[] = { |
| 4185 MockRead("HTTP/1.0 200 OK\r\n\r\n"), | 4185 MockRead("HTTP/1.0 200 OK\r\n\r\n"), |
| 4186 MockRead("hello world"), | 4186 MockRead("hello world"), |
| 4187 MockRead(false, OK), | 4187 MockRead(false, OK), |
| 4188 }; | 4188 }; |
| 4189 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 4189 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 4190 session_deps.socket_factory.AddSocketDataProvider(&data); | 4190 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 4191 | 4191 |
| 4192 TestCompletionCallback callback; | 4192 TestCompletionCallback callback; |
| 4193 | 4193 |
| 4194 int rv = trans->Start(&request, &callback, NULL); | 4194 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 4195 EXPECT_EQ(ERR_IO_PENDING, rv); | 4195 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 4196 | 4196 |
| 4197 rv = callback.WaitForResult(); | 4197 rv = callback.WaitForResult(); |
| 4198 EXPECT_EQ(OK, rv); | 4198 EXPECT_EQ(OK, rv); |
| 4199 | 4199 |
| 4200 const HttpResponseInfo* response = trans->GetResponseInfo(); | 4200 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 4201 EXPECT_TRUE(response != NULL); | 4201 EXPECT_TRUE(response != NULL); |
| 4202 | 4202 |
| 4203 EXPECT_TRUE(response->headers != NULL); | 4203 EXPECT_TRUE(response->headers != NULL); |
| 4204 EXPECT_EQ("HTTP/1.0 200 OK", response->headers->GetStatusLine()); | 4204 EXPECT_EQ("HTTP/1.0 200 OK", response->headers->GetStatusLine()); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4247 "Connection: keep-alive\r\n" | 4247 "Connection: keep-alive\r\n" |
| 4248 "Content-Length: 0\r\n\r\n"), | 4248 "Content-Length: 0\r\n\r\n"), |
| 4249 MockWrite(false, OK), | 4249 MockWrite(false, OK), |
| 4250 }; | 4250 }; |
| 4251 StaticSocketDataProvider data(data_reads, arraysize(data_reads), data_writes, | 4251 StaticSocketDataProvider data(data_reads, arraysize(data_reads), data_writes, |
| 4252 arraysize(data_writes)); | 4252 arraysize(data_writes)); |
| 4253 session_deps.socket_factory.AddSocketDataProvider(&data); | 4253 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 4254 | 4254 |
| 4255 TestCompletionCallback callback; | 4255 TestCompletionCallback callback; |
| 4256 | 4256 |
| 4257 int rv = trans->Start(&request, &callback, NULL); | 4257 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 4258 EXPECT_EQ(ERR_IO_PENDING, rv); | 4258 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 4259 | 4259 |
| 4260 rv = callback.WaitForResult(); | 4260 rv = callback.WaitForResult(); |
| 4261 EXPECT_EQ(OK, rv); | 4261 EXPECT_EQ(OK, rv); |
| 4262 | 4262 |
| 4263 const HttpResponseInfo* response = trans->GetResponseInfo(); | 4263 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 4264 EXPECT_TRUE(response != NULL); | 4264 EXPECT_TRUE(response != NULL); |
| 4265 EXPECT_TRUE(response->headers != NULL); | 4265 EXPECT_TRUE(response->headers != NULL); |
| 4266 EXPECT_EQ("HTTP/1.0 200 OK", response->headers->GetStatusLine()); | 4266 EXPECT_EQ("HTTP/1.0 200 OK", response->headers->GetStatusLine()); |
| 4267 | 4267 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4315 "Authorization: Basic Zm9vOmJhcg==\r\n\r\n"), | 4315 "Authorization: Basic Zm9vOmJhcg==\r\n\r\n"), |
| 4316 MockWrite(false, unreadable_contents.c_str(), temp_file_contents.length()), | 4316 MockWrite(false, unreadable_contents.c_str(), temp_file_contents.length()), |
| 4317 MockWrite(false, OK), | 4317 MockWrite(false, OK), |
| 4318 }; | 4318 }; |
| 4319 StaticSocketDataProvider data(data_reads, arraysize(data_reads), data_writes, | 4319 StaticSocketDataProvider data(data_reads, arraysize(data_reads), data_writes, |
| 4320 arraysize(data_writes)); | 4320 arraysize(data_writes)); |
| 4321 session_deps.socket_factory.AddSocketDataProvider(&data); | 4321 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 4322 | 4322 |
| 4323 TestCompletionCallback callback1; | 4323 TestCompletionCallback callback1; |
| 4324 | 4324 |
| 4325 int rv = trans->Start(&request, &callback1, NULL); | 4325 int rv = trans->Start(&request, &callback1, BoundNetLog()); |
| 4326 EXPECT_EQ(ERR_IO_PENDING, rv); | 4326 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 4327 | 4327 |
| 4328 rv = callback1.WaitForResult(); | 4328 rv = callback1.WaitForResult(); |
| 4329 EXPECT_EQ(OK, rv); | 4329 EXPECT_EQ(OK, rv); |
| 4330 | 4330 |
| 4331 const HttpResponseInfo* response = trans->GetResponseInfo(); | 4331 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 4332 EXPECT_TRUE(response != NULL); | 4332 EXPECT_TRUE(response != NULL); |
| 4333 EXPECT_TRUE(response->headers != NULL); | 4333 EXPECT_TRUE(response->headers != NULL); |
| 4334 EXPECT_EQ("HTTP/1.1 401 Unauthorized", response->headers->GetStatusLine()); | 4334 EXPECT_EQ("HTTP/1.1 401 Unauthorized", response->headers->GetStatusLine()); |
| 4335 | 4335 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4441 session_deps.socket_factory.AddSocketDataProvider(&data1); | 4441 session_deps.socket_factory.AddSocketDataProvider(&data1); |
| 4442 session_deps.socket_factory.AddSocketDataProvider(&data2); | 4442 session_deps.socket_factory.AddSocketDataProvider(&data2); |
| 4443 session_deps.socket_factory.AddSocketDataProvider(&data3); | 4443 session_deps.socket_factory.AddSocketDataProvider(&data3); |
| 4444 session_deps.socket_factory.AddSocketDataProvider(&data4); | 4444 session_deps.socket_factory.AddSocketDataProvider(&data4); |
| 4445 | 4445 |
| 4446 TestCompletionCallback callback1; | 4446 TestCompletionCallback callback1; |
| 4447 | 4447 |
| 4448 // Issue the first request with Authorize headers. There should be a | 4448 // Issue the first request with Authorize headers. There should be a |
| 4449 // password prompt for first_realm waiting to be filled in after the | 4449 // password prompt for first_realm waiting to be filled in after the |
| 4450 // transaction completes. | 4450 // transaction completes. |
| 4451 int rv = trans->Start(&request, &callback1, NULL); | 4451 int rv = trans->Start(&request, &callback1, BoundNetLog()); |
| 4452 EXPECT_EQ(ERR_IO_PENDING, rv); | 4452 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 4453 rv = callback1.WaitForResult(); | 4453 rv = callback1.WaitForResult(); |
| 4454 EXPECT_EQ(OK, rv); | 4454 EXPECT_EQ(OK, rv); |
| 4455 const HttpResponseInfo* response = trans->GetResponseInfo(); | 4455 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 4456 ASSERT_FALSE(response == NULL); | 4456 ASSERT_FALSE(response == NULL); |
| 4457 ASSERT_FALSE(response->auth_challenge.get() == NULL); | 4457 ASSERT_FALSE(response->auth_challenge.get() == NULL); |
| 4458 EXPECT_EQ(L"www.google.com:80", response->auth_challenge->host_and_port); | 4458 EXPECT_EQ(L"www.google.com:80", response->auth_challenge->host_and_port); |
| 4459 EXPECT_EQ(L"first_realm", response->auth_challenge->realm); | 4459 EXPECT_EQ(L"first_realm", response->auth_challenge->realm); |
| 4460 EXPECT_EQ(L"basic", response->auth_challenge->scheme); | 4460 EXPECT_EQ(L"basic", response->auth_challenge->scheme); |
| 4461 | 4461 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4521 | 4521 |
| 4522 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 4522 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 4523 | 4523 |
| 4524 session_deps.socket_factory.AddSocketDataProvider(&data); | 4524 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 4525 | 4525 |
| 4526 TestCompletionCallback callback; | 4526 TestCompletionCallback callback; |
| 4527 | 4527 |
| 4528 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); | 4528 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); |
| 4529 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); | 4529 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
| 4530 | 4530 |
| 4531 int rv = trans->Start(&request, &callback, NULL); | 4531 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 4532 EXPECT_EQ(ERR_IO_PENDING, rv); | 4532 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 4533 | 4533 |
| 4534 HostPortPair http_host_port_pair; | 4534 HostPortPair http_host_port_pair; |
| 4535 http_host_port_pair.host = "www.google.com"; | 4535 http_host_port_pair.host = "www.google.com"; |
| 4536 http_host_port_pair.port = 80; | 4536 http_host_port_pair.port = 80; |
| 4537 const HttpAlternateProtocols& alternate_protocols = | 4537 const HttpAlternateProtocols& alternate_protocols = |
| 4538 session->alternate_protocols(); | 4538 session->alternate_protocols(); |
| 4539 EXPECT_FALSE( | 4539 EXPECT_FALSE( |
| 4540 alternate_protocols.HasAlternateProtocolFor(http_host_port_pair)); | 4540 alternate_protocols.HasAlternateProtocolFor(http_host_port_pair)); |
| 4541 | 4541 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4598 http_host_port_pair.host = "www.google.com"; | 4598 http_host_port_pair.host = "www.google.com"; |
| 4599 http_host_port_pair.port = 80; | 4599 http_host_port_pair.port = 80; |
| 4600 HttpAlternateProtocols* alternate_protocols = | 4600 HttpAlternateProtocols* alternate_protocols = |
| 4601 session->mutable_alternate_protocols(); | 4601 session->mutable_alternate_protocols(); |
| 4602 alternate_protocols->SetAlternateProtocolFor( | 4602 alternate_protocols->SetAlternateProtocolFor( |
| 4603 http_host_port_pair, 1234 /* port is ignored by MockConnect anyway */, | 4603 http_host_port_pair, 1234 /* port is ignored by MockConnect anyway */, |
| 4604 HttpAlternateProtocols::NPN_SPDY_1); | 4604 HttpAlternateProtocols::NPN_SPDY_1); |
| 4605 | 4605 |
| 4606 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); | 4606 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
| 4607 | 4607 |
| 4608 int rv = trans->Start(&request, &callback, NULL); | 4608 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 4609 EXPECT_EQ(ERR_IO_PENDING, rv); | 4609 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 4610 EXPECT_EQ(OK, callback.WaitForResult()); | 4610 EXPECT_EQ(OK, callback.WaitForResult()); |
| 4611 | 4611 |
| 4612 const HttpResponseInfo* response = trans->GetResponseInfo(); | 4612 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 4613 ASSERT_TRUE(response != NULL); | 4613 ASSERT_TRUE(response != NULL); |
| 4614 ASSERT_TRUE(response->headers != NULL); | 4614 ASSERT_TRUE(response->headers != NULL); |
| 4615 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 4615 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| 4616 | 4616 |
| 4617 std::string response_data; | 4617 std::string response_data; |
| 4618 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 4618 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4658 // http_host_port_pair.host = "www.google.com"; | 4658 // http_host_port_pair.host = "www.google.com"; |
| 4659 // http_host_port_pair.port = 80; | 4659 // http_host_port_pair.port = 80; |
| 4660 // HttpAlternateProtocols* alternate_protocols = | 4660 // HttpAlternateProtocols* alternate_protocols = |
| 4661 // session->mutable_alternate_protocols(); | 4661 // session->mutable_alternate_protocols(); |
| 4662 // alternate_protocols->SetAlternateProtocolFor( | 4662 // alternate_protocols->SetAlternateProtocolFor( |
| 4663 // http_host_port_pair, 1234 /* port is ignored */, | 4663 // http_host_port_pair, 1234 /* port is ignored */, |
| 4664 // HttpAlternateProtocols::NPN_SPDY_1); | 4664 // HttpAlternateProtocols::NPN_SPDY_1); |
| 4665 // | 4665 // |
| 4666 // scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); | 4666 // scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
| 4667 // | 4667 // |
| 4668 // int rv = trans->Start(&request, &callback, NULL); | 4668 // int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 4669 // EXPECT_EQ(ERR_IO_PENDING, rv); | 4669 // EXPECT_EQ(ERR_IO_PENDING, rv); |
| 4670 // EXPECT_EQ(OK, callback.WaitForResult()); | 4670 // EXPECT_EQ(OK, callback.WaitForResult()); |
| 4671 // | 4671 // |
| 4672 // const HttpResponseInfo* response = trans->GetResponseInfo(); | 4672 // const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 4673 // ASSERT_TRUE(response != NULL); | 4673 // ASSERT_TRUE(response != NULL); |
| 4674 // ASSERT_TRUE(response->headers != NULL); | 4674 // ASSERT_TRUE(response->headers != NULL); |
| 4675 // EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 4675 // EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| 4676 // | 4676 // |
| 4677 // std::string response_data; | 4677 // std::string response_data; |
| 4678 // ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 4678 // ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4713 http_host_port_pair.host = "www.google.com"; | 4713 http_host_port_pair.host = "www.google.com"; |
| 4714 http_host_port_pair.port = 80; | 4714 http_host_port_pair.port = 80; |
| 4715 HttpAlternateProtocols* alternate_protocols = | 4715 HttpAlternateProtocols* alternate_protocols = |
| 4716 session->mutable_alternate_protocols(); | 4716 session->mutable_alternate_protocols(); |
| 4717 alternate_protocols->SetAlternateProtocolFor( | 4717 alternate_protocols->SetAlternateProtocolFor( |
| 4718 http_host_port_pair, 1234 /* port is ignored */, | 4718 http_host_port_pair, 1234 /* port is ignored */, |
| 4719 HttpAlternateProtocols::NPN_SPDY_1); | 4719 HttpAlternateProtocols::NPN_SPDY_1); |
| 4720 | 4720 |
| 4721 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); | 4721 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
| 4722 | 4722 |
| 4723 int rv = trans->Start(&request, &callback, NULL); | 4723 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 4724 EXPECT_EQ(ERR_IO_PENDING, rv); | 4724 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 4725 EXPECT_EQ(OK, callback.WaitForResult()); | 4725 EXPECT_EQ(OK, callback.WaitForResult()); |
| 4726 | 4726 |
| 4727 const HttpResponseInfo* response = trans->GetResponseInfo(); | 4727 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 4728 ASSERT_TRUE(response != NULL); | 4728 ASSERT_TRUE(response != NULL); |
| 4729 ASSERT_TRUE(response->headers != NULL); | 4729 ASSERT_TRUE(response->headers != NULL); |
| 4730 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 4730 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| 4731 | 4731 |
| 4732 std::string response_data; | 4732 std::string response_data; |
| 4733 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 4733 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4781 1, // wait for one write to finish before reading. | 4781 1, // wait for one write to finish before reading. |
| 4782 spdy_reads, arraysize(spdy_reads), | 4782 spdy_reads, arraysize(spdy_reads), |
| 4783 spdy_writes, arraysize(spdy_writes))); | 4783 spdy_writes, arraysize(spdy_writes))); |
| 4784 session_deps.socket_factory.AddSocketDataProvider(spdy_data); | 4784 session_deps.socket_factory.AddSocketDataProvider(spdy_data); |
| 4785 | 4785 |
| 4786 TestCompletionCallback callback; | 4786 TestCompletionCallback callback; |
| 4787 | 4787 |
| 4788 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); | 4788 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); |
| 4789 scoped_ptr<HttpNetworkTransaction> trans(new HttpNetworkTransaction(session)); | 4789 scoped_ptr<HttpNetworkTransaction> trans(new HttpNetworkTransaction(session)); |
| 4790 | 4790 |
| 4791 int rv = trans->Start(&request, &callback, NULL); | 4791 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 4792 EXPECT_EQ(ERR_IO_PENDING, rv); | 4792 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 4793 EXPECT_EQ(OK, callback.WaitForResult()); | 4793 EXPECT_EQ(OK, callback.WaitForResult()); |
| 4794 | 4794 |
| 4795 const HttpResponseInfo* response = trans->GetResponseInfo(); | 4795 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 4796 ASSERT_TRUE(response != NULL); | 4796 ASSERT_TRUE(response != NULL); |
| 4797 ASSERT_TRUE(response->headers != NULL); | 4797 ASSERT_TRUE(response->headers != NULL); |
| 4798 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 4798 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| 4799 | 4799 |
| 4800 std::string response_data; | 4800 std::string response_data; |
| 4801 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 4801 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| 4802 EXPECT_EQ("hello world", response_data); | 4802 EXPECT_EQ("hello world", response_data); |
| 4803 | 4803 |
| 4804 trans.reset(new HttpNetworkTransaction(session)); | 4804 trans.reset(new HttpNetworkTransaction(session)); |
| 4805 | 4805 |
| 4806 rv = trans->Start(&request, &callback, NULL); | 4806 rv = trans->Start(&request, &callback, BoundNetLog()); |
| 4807 EXPECT_EQ(ERR_IO_PENDING, rv); | 4807 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 4808 EXPECT_EQ(OK, callback.WaitForResult()); | 4808 EXPECT_EQ(OK, callback.WaitForResult()); |
| 4809 | 4809 |
| 4810 response = trans->GetResponseInfo(); | 4810 response = trans->GetResponseInfo(); |
| 4811 ASSERT_TRUE(response != NULL); | 4811 ASSERT_TRUE(response != NULL); |
| 4812 ASSERT_TRUE(response->headers != NULL); | 4812 ASSERT_TRUE(response->headers != NULL); |
| 4813 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 4813 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| 4814 | 4814 |
| 4815 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 4815 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| 4816 EXPECT_EQ("hello!", response_data); | 4816 EXPECT_EQ("hello!", response_data); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4866 spdy_reads, arraysize(spdy_reads), | 4866 spdy_reads, arraysize(spdy_reads), |
| 4867 spdy_writes, arraysize(spdy_writes))); | 4867 spdy_writes, arraysize(spdy_writes))); |
| 4868 session_deps.socket_factory.AddSocketDataProvider(spdy_data); | 4868 session_deps.socket_factory.AddSocketDataProvider(spdy_data); |
| 4869 | 4869 |
| 4870 TestCompletionCallback callback; | 4870 TestCompletionCallback callback; |
| 4871 | 4871 |
| 4872 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); | 4872 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); |
| 4873 | 4873 |
| 4874 scoped_ptr<HttpNetworkTransaction> trans(new HttpNetworkTransaction(session)); | 4874 scoped_ptr<HttpNetworkTransaction> trans(new HttpNetworkTransaction(session)); |
| 4875 | 4875 |
| 4876 int rv = trans->Start(&request, &callback, NULL); | 4876 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 4877 EXPECT_EQ(ERR_IO_PENDING, rv); | 4877 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 4878 EXPECT_EQ(OK, callback.WaitForResult()); | 4878 EXPECT_EQ(OK, callback.WaitForResult()); |
| 4879 | 4879 |
| 4880 const HttpResponseInfo* response = trans->GetResponseInfo(); | 4880 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 4881 ASSERT_TRUE(response != NULL); | 4881 ASSERT_TRUE(response != NULL); |
| 4882 ASSERT_TRUE(response->headers != NULL); | 4882 ASSERT_TRUE(response->headers != NULL); |
| 4883 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 4883 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| 4884 | 4884 |
| 4885 std::string response_data; | 4885 std::string response_data; |
| 4886 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 4886 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| 4887 EXPECT_EQ("hello world", response_data); | 4887 EXPECT_EQ("hello world", response_data); |
| 4888 | 4888 |
| 4889 // Set up an initial SpdySession in the pool to reuse. | 4889 // Set up an initial SpdySession in the pool to reuse. |
| 4890 scoped_refptr<SpdySession> spdy_session = | 4890 scoped_refptr<SpdySession> spdy_session = |
| 4891 session->spdy_session_pool()->Get(HostPortPair("www.google.com", 443), | 4891 session->spdy_session_pool()->Get(HostPortPair("www.google.com", 443), |
| 4892 session); | 4892 session); |
| 4893 TCPSocketParams tcp_params("www.google.com", 443, MEDIUM, GURL(), false); | 4893 TCPSocketParams tcp_params("www.google.com", 443, MEDIUM, GURL(), false); |
| 4894 spdy_session->Connect( | 4894 spdy_session->Connect( |
| 4895 "www.google.com:443", tcp_params, MEDIUM, BoundNetLog()); | 4895 "www.google.com:443", tcp_params, MEDIUM, BoundNetLog()); |
| 4896 | 4896 |
| 4897 trans.reset(new HttpNetworkTransaction(session)); | 4897 trans.reset(new HttpNetworkTransaction(session)); |
| 4898 | 4898 |
| 4899 rv = trans->Start(&request, &callback, NULL); | 4899 rv = trans->Start(&request, &callback, BoundNetLog()); |
| 4900 EXPECT_EQ(ERR_IO_PENDING, rv); | 4900 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 4901 EXPECT_EQ(OK, callback.WaitForResult()); | 4901 EXPECT_EQ(OK, callback.WaitForResult()); |
| 4902 | 4902 |
| 4903 response = trans->GetResponseInfo(); | 4903 response = trans->GetResponseInfo(); |
| 4904 ASSERT_TRUE(response != NULL); | 4904 ASSERT_TRUE(response != NULL); |
| 4905 ASSERT_TRUE(response->headers != NULL); | 4905 ASSERT_TRUE(response->headers != NULL); |
| 4906 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 4906 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| 4907 | 4907 |
| 4908 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 4908 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| 4909 EXPECT_EQ("hello!", response_data); | 4909 EXPECT_EQ("hello!", response_data); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5081 MockRead("Content-Length: 14\r\n\r\n"), | 5081 MockRead("Content-Length: 14\r\n\r\n"), |
| 5082 MockRead("Unauthorized\r\n"), | 5082 MockRead("Unauthorized\r\n"), |
| 5083 }; | 5083 }; |
| 5084 | 5084 |
| 5085 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), | 5085 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), |
| 5086 data_writes1, arraysize(data_writes1)); | 5086 data_writes1, arraysize(data_writes1)); |
| 5087 session_deps.socket_factory.AddSocketDataProvider(&data1); | 5087 session_deps.socket_factory.AddSocketDataProvider(&data1); |
| 5088 | 5088 |
| 5089 TestCompletionCallback callback1; | 5089 TestCompletionCallback callback1; |
| 5090 | 5090 |
| 5091 int rv = trans->Start(&request, &callback1, NULL); | 5091 int rv = trans->Start(&request, &callback1, BoundNetLog()); |
| 5092 EXPECT_EQ(ERR_IO_PENDING, rv); | 5092 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 5093 | 5093 |
| 5094 rv = callback1.WaitForResult(); | 5094 rv = callback1.WaitForResult(); |
| 5095 EXPECT_EQ(OK, rv); | 5095 EXPECT_EQ(OK, rv); |
| 5096 | 5096 |
| 5097 const HttpResponseInfo* response = trans->GetResponseInfo(); | 5097 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 5098 EXPECT_FALSE(response == NULL); | 5098 EXPECT_FALSE(response == NULL); |
| 5099 | 5099 |
| 5100 // The password prompt is set after the canonical name is resolved. | 5100 // The password prompt is set after the canonical name is resolved. |
| 5101 // If it isn't present or is incorrect, it indicates that the scheme | 5101 // If it isn't present or is incorrect, it indicates that the scheme |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5154 session_deps.socket_factory.AddSocketDataProvider(&socket_data_provider2); | 5154 session_deps.socket_factory.AddSocketDataProvider(&socket_data_provider2); |
| 5155 session_deps.socket_factory.AddSSLSocketDataProvider( | 5155 session_deps.socket_factory.AddSSLSocketDataProvider( |
| 5156 &ssl_socket_data_provider1); | 5156 &ssl_socket_data_provider1); |
| 5157 session_deps.socket_factory.AddSSLSocketDataProvider( | 5157 session_deps.socket_factory.AddSSLSocketDataProvider( |
| 5158 &ssl_socket_data_provider2); | 5158 &ssl_socket_data_provider2); |
| 5159 | 5159 |
| 5160 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); | 5160 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); |
| 5161 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); | 5161 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
| 5162 TestCompletionCallback callback; | 5162 TestCompletionCallback callback; |
| 5163 | 5163 |
| 5164 int rv = trans->Start(&request, &callback, NULL); | 5164 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 5165 EXPECT_EQ(ERR_IO_PENDING, rv); | 5165 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 5166 EXPECT_EQ(OK, callback.WaitForResult()); | 5166 EXPECT_EQ(OK, callback.WaitForResult()); |
| 5167 | 5167 |
| 5168 const HttpResponseInfo* response = trans->GetResponseInfo(); | 5168 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 5169 ASSERT_TRUE(response != NULL); | 5169 ASSERT_TRUE(response != NULL); |
| 5170 ASSERT_TRUE(response->headers != NULL); | 5170 ASSERT_TRUE(response->headers != NULL); |
| 5171 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 5171 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| 5172 | 5172 |
| 5173 std::string response_data; | 5173 std::string response_data; |
| 5174 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 5174 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 5196 session_deps.socket_factory.AddSocketDataProvider(&socket_data_provider2); | 5196 session_deps.socket_factory.AddSocketDataProvider(&socket_data_provider2); |
| 5197 session_deps.socket_factory.AddSSLSocketDataProvider( | 5197 session_deps.socket_factory.AddSSLSocketDataProvider( |
| 5198 &ssl_socket_data_provider1); | 5198 &ssl_socket_data_provider1); |
| 5199 session_deps.socket_factory.AddSSLSocketDataProvider( | 5199 session_deps.socket_factory.AddSSLSocketDataProvider( |
| 5200 &ssl_socket_data_provider2); | 5200 &ssl_socket_data_provider2); |
| 5201 | 5201 |
| 5202 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); | 5202 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); |
| 5203 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); | 5203 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
| 5204 TestCompletionCallback callback; | 5204 TestCompletionCallback callback; |
| 5205 | 5205 |
| 5206 int rv = trans->Start(&request, &callback, NULL); | 5206 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 5207 EXPECT_EQ(ERR_IO_PENDING, rv); | 5207 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 5208 EXPECT_EQ(OK, callback.WaitForResult()); | 5208 EXPECT_EQ(OK, callback.WaitForResult()); |
| 5209 | 5209 |
| 5210 const HttpResponseInfo* response = trans->GetResponseInfo(); | 5210 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 5211 ASSERT_TRUE(response != NULL); | 5211 ASSERT_TRUE(response != NULL); |
| 5212 ASSERT_TRUE(response->headers != NULL); | 5212 ASSERT_TRUE(response->headers != NULL); |
| 5213 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 5213 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| 5214 | 5214 |
| 5215 std::string response_data; | 5215 std::string response_data; |
| 5216 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 5216 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| 5217 EXPECT_EQ("ok.", response_data); | 5217 EXPECT_EQ("ok.", response_data); |
| 5218 } | 5218 } |
| 5219 | 5219 |
| 5220 } // namespace net | 5220 } // namespace net |
| OLD | NEW |