OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/url_request/url_request_ftp_job.h" | 5 #include "net/url_request/url_request_ftp_job.h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 MockRead(ASYNC, 12, "Content-Length: 10\r\n\r\n"), | 496 MockRead(ASYNC, 12, "Content-Length: 10\r\n\r\n"), |
497 MockRead(ASYNC, 13, "test2.html"), | 497 MockRead(ASYNC, 13, "test2.html"), |
498 }; | 498 }; |
499 | 499 |
500 AddSocket(reads, arraysize(reads), writes, arraysize(writes)); | 500 AddSocket(reads, arraysize(reads), writes, arraysize(writes)); |
501 | 501 |
502 GURL url("ftp://ftp.example.com"); | 502 GURL url("ftp://ftp.example.com"); |
503 | 503 |
504 // Make sure cached FTP credentials are not used for proxy authentication. | 504 // Make sure cached FTP credentials are not used for proxy authentication. |
505 request_context()->GetFtpAuthCache()->Add( | 505 request_context()->GetFtpAuthCache()->Add( |
506 url.GetOrigin(), | 506 url::Origin(url), AuthCredentials(ASCIIToUTF16("userdonotuse"), |
507 AuthCredentials(ASCIIToUTF16("userdonotuse"), | 507 ASCIIToUTF16("passworddonotuse"))); |
508 ASCIIToUTF16("passworddonotuse"))); | |
509 | 508 |
510 TestDelegate request_delegate; | 509 TestDelegate request_delegate; |
511 request_delegate.set_credentials( | 510 request_delegate.set_credentials( |
512 AuthCredentials(ASCIIToUTF16("proxyuser"), ASCIIToUTF16("proxypass"))); | 511 AuthCredentials(ASCIIToUTF16("proxyuser"), ASCIIToUTF16("proxypass"))); |
513 scoped_ptr<URLRequest> url_request(request_context()->CreateRequest( | 512 scoped_ptr<URLRequest> url_request(request_context()->CreateRequest( |
514 url, DEFAULT_PRIORITY, &request_delegate)); | 513 url, DEFAULT_PRIORITY, &request_delegate)); |
515 url_request->Start(); | 514 url_request->Start(); |
516 ASSERT_TRUE(url_request->is_pending()); | 515 ASSERT_TRUE(url_request->is_pending()); |
517 socket_data(0)->RunFor(5); | 516 socket_data(0)->RunFor(5); |
518 | 517 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 EXPECT_TRUE(url_request2->status().is_success()); | 702 EXPECT_TRUE(url_request2->status().is_success()); |
704 EXPECT_EQ(2, network_delegate()->completed_requests()); | 703 EXPECT_EQ(2, network_delegate()->completed_requests()); |
705 EXPECT_EQ(0, network_delegate()->error_count()); | 704 EXPECT_EQ(0, network_delegate()->error_count()); |
706 EXPECT_FALSE(request_delegate2.auth_required_called()); | 705 EXPECT_FALSE(request_delegate2.auth_required_called()); |
707 EXPECT_EQ("test2.html", request_delegate2.data_received()); | 706 EXPECT_EQ("test2.html", request_delegate2.data_received()); |
708 } | 707 } |
709 | 708 |
710 } // namespace | 709 } // namespace |
711 | 710 |
712 } // namespace net | 711 } // namespace net |
OLD | NEW |