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

Unified Diff: net/url_request/url_request_unittest.cc

Issue 173270: Implement RestartWithAuth for NewFtpTransaction. (Closed)
Patch Set: win compile fixes Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/url_request/url_request_unittest.cc
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index afa2c6cb1bdee43b5223c21a097484affeec3042..72deea0b78ac01396c6f4c9eb6c9bfc22e10e620 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -1887,6 +1887,33 @@ TEST_F(URLRequestTest, FTPCheckWrongPassword) {
}
}
+TEST_F(URLRequestTest, FTPCheckWrongPasswordRestart) {
wtc 2009/08/25 20:52:50 Can you add comments to explain why calling d.se
+ scoped_refptr<FTPTestServer> server =
+ FTPTestServer::CreateServer(L"", "chrome", "wrong_password");
+ ASSERT_TRUE(NULL != server.get());
+ FilePath app_path;
+ PathService::Get(base::DIR_SOURCE_ROOT, &app_path);
+ app_path = app_path.AppendASCII("LICENSE");
+ TestDelegate d;
+ d.set_username(L"chrome");
+ d.set_password(L"chrome");
+ {
+ TestURLRequest r(server->TestServerPage("/LICENSE"), &d);
+ r.Start();
+ EXPECT_TRUE(r.is_pending());
+
+ MessageLoop::current()->Run();
+
+ int64 file_size = 0;
+ file_util::GetFileSize(app_path, &file_size);
+
+ EXPECT_FALSE(r.is_pending());
+ EXPECT_EQ(1, d.response_started_count());
+ EXPECT_FALSE(d.received_data_before_response());
+ EXPECT_EQ(d.bytes_received(), static_cast<int>(file_size));
+ }
+}
+
TEST_F(URLRequestTest, FTPCheckWrongUser) {
scoped_refptr<FTPTestServer> server =
FTPTestServer::CreateServer(L"", "wrong_user", "chrome");
@@ -1911,3 +1938,30 @@ TEST_F(URLRequestTest, FTPCheckWrongUser) {
EXPECT_EQ(d.bytes_received(), 0);
}
}
+
+TEST_F(URLRequestTest, FTPCheckWrongUserRestart) {
+ scoped_refptr<FTPTestServer> server =
+ FTPTestServer::CreateServer(L"", "wrong_user", "chrome");
+ ASSERT_TRUE(NULL != server.get());
+ FilePath app_path;
+ PathService::Get(base::DIR_SOURCE_ROOT, &app_path);
+ app_path = app_path.AppendASCII("LICENSE");
+ TestDelegate d;
+ d.set_username(L"chrome");
+ d.set_password(L"chrome");
+ {
+ TestURLRequest r(server->TestServerPage("/LICENSE"), &d);
+ r.Start();
+ EXPECT_TRUE(r.is_pending());
+
+ MessageLoop::current()->Run();
+
+ int64 file_size = 0;
+ file_util::GetFileSize(app_path, &file_size);
+
+ EXPECT_FALSE(r.is_pending());
+ EXPECT_EQ(1, d.response_started_count());
+ EXPECT_FALSE(d.received_data_before_response());
+ EXPECT_EQ(d.bytes_received(), static_cast<int>(file_size));
+ }
+}
« net/url_request/url_request_new_ftp_job.cc ('K') | « net/url_request/url_request_new_ftp_job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698