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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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_unittest.h" 5 #include "net/url_request/url_request_unittest.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
(...skipping 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after
1880 int64 file_size = 0; 1880 int64 file_size = 0;
1881 file_util::GetFileSize(app_path, &file_size); 1881 file_util::GetFileSize(app_path, &file_size);
1882 1882
1883 EXPECT_FALSE(r.is_pending()); 1883 EXPECT_FALSE(r.is_pending());
1884 EXPECT_EQ(1, d.response_started_count()); 1884 EXPECT_EQ(1, d.response_started_count());
1885 EXPECT_FALSE(d.received_data_before_response()); 1885 EXPECT_FALSE(d.received_data_before_response());
1886 EXPECT_EQ(d.bytes_received(), 0); 1886 EXPECT_EQ(d.bytes_received(), 0);
1887 } 1887 }
1888 } 1888 }
1889 1889
1890 TEST_F(URLRequestTest, FTPCheckWrongPasswordRestart) {
wtc 2009/08/25 20:52:50 Can you add comments to explain why calling d.se
1891 scoped_refptr<FTPTestServer> server =
1892 FTPTestServer::CreateServer(L"", "chrome", "wrong_password");
1893 ASSERT_TRUE(NULL != server.get());
1894 FilePath app_path;
1895 PathService::Get(base::DIR_SOURCE_ROOT, &app_path);
1896 app_path = app_path.AppendASCII("LICENSE");
1897 TestDelegate d;
1898 d.set_username(L"chrome");
1899 d.set_password(L"chrome");
1900 {
1901 TestURLRequest r(server->TestServerPage("/LICENSE"), &d);
1902 r.Start();
1903 EXPECT_TRUE(r.is_pending());
1904
1905 MessageLoop::current()->Run();
1906
1907 int64 file_size = 0;
1908 file_util::GetFileSize(app_path, &file_size);
1909
1910 EXPECT_FALSE(r.is_pending());
1911 EXPECT_EQ(1, d.response_started_count());
1912 EXPECT_FALSE(d.received_data_before_response());
1913 EXPECT_EQ(d.bytes_received(), static_cast<int>(file_size));
1914 }
1915 }
1916
1890 TEST_F(URLRequestTest, FTPCheckWrongUser) { 1917 TEST_F(URLRequestTest, FTPCheckWrongUser) {
1891 scoped_refptr<FTPTestServer> server = 1918 scoped_refptr<FTPTestServer> server =
1892 FTPTestServer::CreateServer(L"", "wrong_user", "chrome"); 1919 FTPTestServer::CreateServer(L"", "wrong_user", "chrome");
1893 ASSERT_TRUE(NULL != server.get()); 1920 ASSERT_TRUE(NULL != server.get());
1894 FilePath app_path; 1921 FilePath app_path;
1895 PathService::Get(base::DIR_SOURCE_ROOT, &app_path); 1922 PathService::Get(base::DIR_SOURCE_ROOT, &app_path);
1896 app_path = app_path.AppendASCII("LICENSE"); 1923 app_path = app_path.AppendASCII("LICENSE");
1897 TestDelegate d; 1924 TestDelegate d;
1898 { 1925 {
1899 TestURLRequest r(server->TestServerPage("/LICENSE"), &d); 1926 TestURLRequest r(server->TestServerPage("/LICENSE"), &d);
1900 r.Start(); 1927 r.Start();
1901 EXPECT_TRUE(r.is_pending()); 1928 EXPECT_TRUE(r.is_pending());
1902 1929
1903 MessageLoop::current()->Run(); 1930 MessageLoop::current()->Run();
1904 1931
1905 int64 file_size = 0; 1932 int64 file_size = 0;
1906 file_util::GetFileSize(app_path, &file_size); 1933 file_util::GetFileSize(app_path, &file_size);
1907 1934
1908 EXPECT_FALSE(r.is_pending()); 1935 EXPECT_FALSE(r.is_pending());
1909 EXPECT_EQ(1, d.response_started_count()); 1936 EXPECT_EQ(1, d.response_started_count());
1910 EXPECT_FALSE(d.received_data_before_response()); 1937 EXPECT_FALSE(d.received_data_before_response());
1911 EXPECT_EQ(d.bytes_received(), 0); 1938 EXPECT_EQ(d.bytes_received(), 0);
1912 } 1939 }
1913 } 1940 }
1941
1942 TEST_F(URLRequestTest, FTPCheckWrongUserRestart) {
1943 scoped_refptr<FTPTestServer> server =
1944 FTPTestServer::CreateServer(L"", "wrong_user", "chrome");
1945 ASSERT_TRUE(NULL != server.get());
1946 FilePath app_path;
1947 PathService::Get(base::DIR_SOURCE_ROOT, &app_path);
1948 app_path = app_path.AppendASCII("LICENSE");
1949 TestDelegate d;
1950 d.set_username(L"chrome");
1951 d.set_password(L"chrome");
1952 {
1953 TestURLRequest r(server->TestServerPage("/LICENSE"), &d);
1954 r.Start();
1955 EXPECT_TRUE(r.is_pending());
1956
1957 MessageLoop::current()->Run();
1958
1959 int64 file_size = 0;
1960 file_util::GetFileSize(app_path, &file_size);
1961
1962 EXPECT_FALSE(r.is_pending());
1963 EXPECT_EQ(1, d.response_started_count());
1964 EXPECT_FALSE(d.received_data_before_response());
1965 EXPECT_EQ(d.bytes_received(), static_cast<int>(file_size));
1966 }
1967 }
OLDNEW
« 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