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

Side by Side Diff: net/url_request/url_request_unittest.cc

Issue 197052: Add a unit test for FTP directory listing. (Closed)
Patch Set: Created 11 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1931 matching lines...) Expand 10 before | Expand all | Expand 10 after
1942 static void TearDownTestCase() { 1942 static void TearDownTestCase() {
1943 server_ = NULL; 1943 server_ = NULL;
1944 } 1944 }
1945 1945
1946 static scoped_refptr<FTPTestServer> server_; 1946 static scoped_refptr<FTPTestServer> server_;
1947 }; 1947 };
1948 1948
1949 // static 1949 // static
1950 scoped_refptr<FTPTestServer> URLRequestTestFTP::server_; 1950 scoped_refptr<FTPTestServer> URLRequestTestFTP::server_;
1951 1951
1952 TEST_F(URLRequestTestFTP, FTPDirectoryListing) {
1953 ASSERT_TRUE(NULL != server_.get());
1954 TestDelegate d;
1955 {
1956 TestURLRequest r(server_->TestServerPage("/"), &d);
1957 r.Start();
1958 EXPECT_TRUE(r.is_pending());
1959
1960 MessageLoop::current()->Run();
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_LT(0, d.bytes_received());
eroman 2009/09/08 23:39:41 this seems a bit odd to use LT. Can this be a dir
1966 }
1967 }
1968
1952 TEST_F(URLRequestTestFTP, FTPGetTestAnonymous) { 1969 TEST_F(URLRequestTestFTP, FTPGetTestAnonymous) {
1953 ASSERT_TRUE(NULL != server_.get()); 1970 ASSERT_TRUE(NULL != server_.get());
1954 FilePath app_path; 1971 FilePath app_path;
1955 PathService::Get(base::DIR_SOURCE_ROOT, &app_path); 1972 PathService::Get(base::DIR_SOURCE_ROOT, &app_path);
1956 app_path = app_path.AppendASCII("LICENSE"); 1973 app_path = app_path.AppendASCII("LICENSE");
1957 TestDelegate d; 1974 TestDelegate d;
1958 { 1975 {
1959 TestURLRequest r(server_->TestServerPage("/LICENSE"), &d); 1976 TestURLRequest r(server_->TestServerPage("/LICENSE"), &d);
1960 r.Start(); 1977 r.Start();
1961 EXPECT_TRUE(r.is_pending()); 1978 EXPECT_TRUE(r.is_pending());
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
2092 2109
2093 int64 file_size = 0; 2110 int64 file_size = 0;
2094 file_util::GetFileSize(app_path, &file_size); 2111 file_util::GetFileSize(app_path, &file_size);
2095 2112
2096 EXPECT_FALSE(r.is_pending()); 2113 EXPECT_FALSE(r.is_pending());
2097 EXPECT_EQ(1, d.response_started_count()); 2114 EXPECT_EQ(1, d.response_started_count());
2098 EXPECT_FALSE(d.received_data_before_response()); 2115 EXPECT_FALSE(d.received_data_before_response());
2099 EXPECT_EQ(d.bytes_received(), static_cast<int>(file_size)); 2116 EXPECT_EQ(d.bytes_received(), static_cast<int>(file_size));
2100 } 2117 }
2101 } 2118 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698