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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shlobj.h> | 9 #include <shlobj.h> |
10 #endif | 10 #endif |
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 TestDelegate d; | 697 TestDelegate d; |
698 { | 698 { |
699 URLRequest r(app_url, DEFAULT_PRIORITY, &d, &default_context_); | 699 URLRequest r(app_url, DEFAULT_PRIORITY, &d, &default_context_); |
700 | 700 |
701 r.Start(); | 701 r.Start(); |
702 EXPECT_TRUE(r.is_pending()); | 702 EXPECT_TRUE(r.is_pending()); |
703 | 703 |
704 base::RunLoop().Run(); | 704 base::RunLoop().Run(); |
705 | 705 |
706 int64 file_size = -1; | 706 int64 file_size = -1; |
707 EXPECT_TRUE(file_util::GetFileSize(app_path, &file_size)); | 707 EXPECT_TRUE(base::GetFileSize(app_path, &file_size)); |
708 | 708 |
709 EXPECT_TRUE(!r.is_pending()); | 709 EXPECT_TRUE(!r.is_pending()); |
710 EXPECT_EQ(1, d.response_started_count()); | 710 EXPECT_EQ(1, d.response_started_count()); |
711 EXPECT_FALSE(d.received_data_before_response()); | 711 EXPECT_FALSE(d.received_data_before_response()); |
712 EXPECT_EQ(d.bytes_received(), static_cast<int>(file_size)); | 712 EXPECT_EQ(d.bytes_received(), static_cast<int>(file_size)); |
713 EXPECT_EQ("", r.GetSocketAddress().host()); | 713 EXPECT_EQ("", r.GetSocketAddress().host()); |
714 EXPECT_EQ(0, r.GetSocketAddress().port()); | 714 EXPECT_EQ(0, r.GetSocketAddress().port()); |
715 | 715 |
716 HttpRequestHeaders headers; | 716 HttpRequestHeaders headers; |
717 EXPECT_FALSE(r.GetFullRequestHeaders(&headers)); | 717 EXPECT_FALSE(r.GetFullRequestHeaders(&headers)); |
(...skipping 22 matching lines...) Expand all Loading... |
740 const size_t buffer_size = 4000; | 740 const size_t buffer_size = 4000; |
741 scoped_ptr<char[]> buffer(new char[buffer_size]); | 741 scoped_ptr<char[]> buffer(new char[buffer_size]); |
742 FillBuffer(buffer.get(), buffer_size); | 742 FillBuffer(buffer.get(), buffer_size); |
743 | 743 |
744 base::FilePath temp_path; | 744 base::FilePath temp_path; |
745 EXPECT_TRUE(base::CreateTemporaryFile(&temp_path)); | 745 EXPECT_TRUE(base::CreateTemporaryFile(&temp_path)); |
746 GURL temp_url = FilePathToFileURL(temp_path); | 746 GURL temp_url = FilePathToFileURL(temp_path); |
747 EXPECT_TRUE(file_util::WriteFile(temp_path, buffer.get(), buffer_size)); | 747 EXPECT_TRUE(file_util::WriteFile(temp_path, buffer.get(), buffer_size)); |
748 | 748 |
749 int64 file_size; | 749 int64 file_size; |
750 EXPECT_TRUE(file_util::GetFileSize(temp_path, &file_size)); | 750 EXPECT_TRUE(base::GetFileSize(temp_path, &file_size)); |
751 | 751 |
752 const size_t first_byte_position = 500; | 752 const size_t first_byte_position = 500; |
753 const size_t last_byte_position = buffer_size - first_byte_position; | 753 const size_t last_byte_position = buffer_size - first_byte_position; |
754 const size_t content_length = last_byte_position - first_byte_position + 1; | 754 const size_t content_length = last_byte_position - first_byte_position + 1; |
755 std::string partial_buffer_string(buffer.get() + first_byte_position, | 755 std::string partial_buffer_string(buffer.get() + first_byte_position, |
756 buffer.get() + last_byte_position + 1); | 756 buffer.get() + last_byte_position + 1); |
757 | 757 |
758 TestDelegate d; | 758 TestDelegate d; |
759 { | 759 { |
760 URLRequest r(temp_url, DEFAULT_PRIORITY, &d, &default_context_); | 760 URLRequest r(temp_url, DEFAULT_PRIORITY, &d, &default_context_); |
(...skipping 23 matching lines...) Expand all Loading... |
784 const size_t buffer_size = 4000; | 784 const size_t buffer_size = 4000; |
785 scoped_ptr<char[]> buffer(new char[buffer_size]); | 785 scoped_ptr<char[]> buffer(new char[buffer_size]); |
786 FillBuffer(buffer.get(), buffer_size); | 786 FillBuffer(buffer.get(), buffer_size); |
787 | 787 |
788 base::FilePath temp_path; | 788 base::FilePath temp_path; |
789 EXPECT_TRUE(base::CreateTemporaryFile(&temp_path)); | 789 EXPECT_TRUE(base::CreateTemporaryFile(&temp_path)); |
790 GURL temp_url = FilePathToFileURL(temp_path); | 790 GURL temp_url = FilePathToFileURL(temp_path); |
791 EXPECT_TRUE(file_util::WriteFile(temp_path, buffer.get(), buffer_size)); | 791 EXPECT_TRUE(file_util::WriteFile(temp_path, buffer.get(), buffer_size)); |
792 | 792 |
793 int64 file_size; | 793 int64 file_size; |
794 EXPECT_TRUE(file_util::GetFileSize(temp_path, &file_size)); | 794 EXPECT_TRUE(base::GetFileSize(temp_path, &file_size)); |
795 | 795 |
796 const size_t first_byte_position = 500; | 796 const size_t first_byte_position = 500; |
797 const size_t last_byte_position = buffer_size - 1; | 797 const size_t last_byte_position = buffer_size - 1; |
798 const size_t content_length = last_byte_position - first_byte_position + 1; | 798 const size_t content_length = last_byte_position - first_byte_position + 1; |
799 std::string partial_buffer_string(buffer.get() + first_byte_position, | 799 std::string partial_buffer_string(buffer.get() + first_byte_position, |
800 buffer.get() + last_byte_position + 1); | 800 buffer.get() + last_byte_position + 1); |
801 | 801 |
802 TestDelegate d; | 802 TestDelegate d; |
803 { | 803 { |
804 URLRequest r(temp_url, DEFAULT_PRIORITY, &d, &default_context_); | 804 URLRequest r(temp_url, DEFAULT_PRIORITY, &d, &default_context_); |
(...skipping 22 matching lines...) Expand all Loading... |
827 const size_t buffer_size = 400000; | 827 const size_t buffer_size = 400000; |
828 scoped_ptr<char[]> buffer(new char[buffer_size]); | 828 scoped_ptr<char[]> buffer(new char[buffer_size]); |
829 FillBuffer(buffer.get(), buffer_size); | 829 FillBuffer(buffer.get(), buffer_size); |
830 | 830 |
831 base::FilePath temp_path; | 831 base::FilePath temp_path; |
832 EXPECT_TRUE(base::CreateTemporaryFile(&temp_path)); | 832 EXPECT_TRUE(base::CreateTemporaryFile(&temp_path)); |
833 GURL temp_url = FilePathToFileURL(temp_path); | 833 GURL temp_url = FilePathToFileURL(temp_path); |
834 EXPECT_TRUE(file_util::WriteFile(temp_path, buffer.get(), buffer_size)); | 834 EXPECT_TRUE(file_util::WriteFile(temp_path, buffer.get(), buffer_size)); |
835 | 835 |
836 int64 file_size; | 836 int64 file_size; |
837 EXPECT_TRUE(file_util::GetFileSize(temp_path, &file_size)); | 837 EXPECT_TRUE(base::GetFileSize(temp_path, &file_size)); |
838 | 838 |
839 TestDelegate d; | 839 TestDelegate d; |
840 { | 840 { |
841 URLRequest r(temp_url, DEFAULT_PRIORITY, &d, &default_context_); | 841 URLRequest r(temp_url, DEFAULT_PRIORITY, &d, &default_context_); |
842 | 842 |
843 HttpRequestHeaders headers; | 843 HttpRequestHeaders headers; |
844 headers.SetHeader(HttpRequestHeaders::kRange, "bytes=0-0,10-200,200-300"); | 844 headers.SetHeader(HttpRequestHeaders::kRange, "bytes=0-0,10-200,200-300"); |
845 r.SetExtraRequestHeaders(headers); | 845 r.SetExtraRequestHeaders(headers); |
846 r.Start(); | 846 r.Start(); |
847 EXPECT_TRUE(r.is_pending()); | 847 EXPECT_TRUE(r.is_pending()); |
(...skipping 3871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4719 base::Time())); | 4719 base::Time())); |
4720 r.set_upload(make_scoped_ptr( | 4720 r.set_upload(make_scoped_ptr( |
4721 new UploadDataStream(element_readers.Pass(), 0))); | 4721 new UploadDataStream(element_readers.Pass(), 0))); |
4722 | 4722 |
4723 r.Start(); | 4723 r.Start(); |
4724 EXPECT_TRUE(r.is_pending()); | 4724 EXPECT_TRUE(r.is_pending()); |
4725 | 4725 |
4726 base::RunLoop().Run(); | 4726 base::RunLoop().Run(); |
4727 | 4727 |
4728 int64 size = 0; | 4728 int64 size = 0; |
4729 ASSERT_EQ(true, file_util::GetFileSize(path, &size)); | 4729 ASSERT_EQ(true, base::GetFileSize(path, &size)); |
4730 scoped_ptr<char[]> buf(new char[size]); | 4730 scoped_ptr<char[]> buf(new char[size]); |
4731 | 4731 |
4732 ASSERT_EQ(size, file_util::ReadFile(path, buf.get(), size)); | 4732 ASSERT_EQ(size, file_util::ReadFile(path, buf.get(), size)); |
4733 | 4733 |
4734 ASSERT_EQ(1, d.response_started_count()) | 4734 ASSERT_EQ(1, d.response_started_count()) |
4735 << "request failed: " << r.status().status() | 4735 << "request failed: " << r.status().status() |
4736 << ", error: " << r.status().error(); | 4736 << ", error: " << r.status().error(); |
4737 | 4737 |
4738 EXPECT_FALSE(d.received_data_before_response()); | 4738 EXPECT_FALSE(d.received_data_before_response()); |
4739 | 4739 |
(...skipping 2321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7061 URLRequest r(test_server_.GetURL("/LICENSE"), | 7061 URLRequest r(test_server_.GetURL("/LICENSE"), |
7062 DEFAULT_PRIORITY, | 7062 DEFAULT_PRIORITY, |
7063 &d, | 7063 &d, |
7064 &default_context_); | 7064 &default_context_); |
7065 r.Start(); | 7065 r.Start(); |
7066 EXPECT_TRUE(r.is_pending()); | 7066 EXPECT_TRUE(r.is_pending()); |
7067 | 7067 |
7068 base::RunLoop().Run(); | 7068 base::RunLoop().Run(); |
7069 | 7069 |
7070 int64 file_size = 0; | 7070 int64 file_size = 0; |
7071 file_util::GetFileSize(app_path, &file_size); | 7071 base::GetFileSize(app_path, &file_size); |
7072 | 7072 |
7073 EXPECT_FALSE(r.is_pending()); | 7073 EXPECT_FALSE(r.is_pending()); |
7074 EXPECT_EQ(1, d.response_started_count()); | 7074 EXPECT_EQ(1, d.response_started_count()); |
7075 EXPECT_FALSE(d.received_data_before_response()); | 7075 EXPECT_FALSE(d.received_data_before_response()); |
7076 EXPECT_EQ(d.bytes_received(), static_cast<int>(file_size)); | 7076 EXPECT_EQ(d.bytes_received(), static_cast<int>(file_size)); |
7077 EXPECT_EQ(test_server_.host_port_pair().host(), | 7077 EXPECT_EQ(test_server_.host_port_pair().host(), |
7078 r.GetSocketAddress().host()); | 7078 r.GetSocketAddress().host()); |
7079 EXPECT_EQ(test_server_.host_port_pair().port(), | 7079 EXPECT_EQ(test_server_.host_port_pair().port(), |
7080 r.GetSocketAddress().port()); | 7080 r.GetSocketAddress().port()); |
7081 } | 7081 } |
(...skipping 12 matching lines...) Expand all Loading... |
7094 test_server_.GetURLWithUserAndPassword("/LICENSE", "chrome", "chrome"), | 7094 test_server_.GetURLWithUserAndPassword("/LICENSE", "chrome", "chrome"), |
7095 DEFAULT_PRIORITY, | 7095 DEFAULT_PRIORITY, |
7096 &d, | 7096 &d, |
7097 &default_context_); | 7097 &default_context_); |
7098 r.Start(); | 7098 r.Start(); |
7099 EXPECT_TRUE(r.is_pending()); | 7099 EXPECT_TRUE(r.is_pending()); |
7100 | 7100 |
7101 base::RunLoop().Run(); | 7101 base::RunLoop().Run(); |
7102 | 7102 |
7103 int64 file_size = 0; | 7103 int64 file_size = 0; |
7104 file_util::GetFileSize(app_path, &file_size); | 7104 base::GetFileSize(app_path, &file_size); |
7105 | 7105 |
7106 EXPECT_FALSE(r.is_pending()); | 7106 EXPECT_FALSE(r.is_pending()); |
7107 EXPECT_EQ(test_server_.host_port_pair().host(), | 7107 EXPECT_EQ(test_server_.host_port_pair().host(), |
7108 r.GetSocketAddress().host()); | 7108 r.GetSocketAddress().host()); |
7109 EXPECT_EQ(test_server_.host_port_pair().port(), | 7109 EXPECT_EQ(test_server_.host_port_pair().port(), |
7110 r.GetSocketAddress().port()); | 7110 r.GetSocketAddress().port()); |
7111 EXPECT_EQ(1, d.response_started_count()); | 7111 EXPECT_EQ(1, d.response_started_count()); |
7112 EXPECT_FALSE(d.received_data_before_response()); | 7112 EXPECT_FALSE(d.received_data_before_response()); |
7113 EXPECT_EQ(d.bytes_received(), static_cast<int>(file_size)); | 7113 EXPECT_EQ(d.bytes_received(), static_cast<int>(file_size)); |
7114 | 7114 |
(...skipping 16 matching lines...) Expand all Loading... |
7131 "/LICENSE", "chrome", "wrong_password"), | 7131 "/LICENSE", "chrome", "wrong_password"), |
7132 DEFAULT_PRIORITY, | 7132 DEFAULT_PRIORITY, |
7133 &d, | 7133 &d, |
7134 &default_context_); | 7134 &default_context_); |
7135 r.Start(); | 7135 r.Start(); |
7136 EXPECT_TRUE(r.is_pending()); | 7136 EXPECT_TRUE(r.is_pending()); |
7137 | 7137 |
7138 base::RunLoop().Run(); | 7138 base::RunLoop().Run(); |
7139 | 7139 |
7140 int64 file_size = 0; | 7140 int64 file_size = 0; |
7141 file_util::GetFileSize(app_path, &file_size); | 7141 base::GetFileSize(app_path, &file_size); |
7142 | 7142 |
7143 EXPECT_FALSE(r.is_pending()); | 7143 EXPECT_FALSE(r.is_pending()); |
7144 EXPECT_EQ(1, d.response_started_count()); | 7144 EXPECT_EQ(1, d.response_started_count()); |
7145 EXPECT_FALSE(d.received_data_before_response()); | 7145 EXPECT_FALSE(d.received_data_before_response()); |
7146 EXPECT_EQ(d.bytes_received(), 0); | 7146 EXPECT_EQ(d.bytes_received(), 0); |
7147 } | 7147 } |
7148 } | 7148 } |
7149 | 7149 |
7150 // Flaky, see http://crbug.com/25045. | 7150 // Flaky, see http://crbug.com/25045. |
7151 TEST_F(URLRequestTestFTP, DISABLED_FTPCheckWrongPasswordRestart) { | 7151 TEST_F(URLRequestTestFTP, DISABLED_FTPCheckWrongPasswordRestart) { |
(...skipping 11 matching lines...) Expand all Loading... |
7163 "/LICENSE", "chrome", "wrong_password"), | 7163 "/LICENSE", "chrome", "wrong_password"), |
7164 DEFAULT_PRIORITY, | 7164 DEFAULT_PRIORITY, |
7165 &d, | 7165 &d, |
7166 &default_context_); | 7166 &default_context_); |
7167 r.Start(); | 7167 r.Start(); |
7168 EXPECT_TRUE(r.is_pending()); | 7168 EXPECT_TRUE(r.is_pending()); |
7169 | 7169 |
7170 base::RunLoop().Run(); | 7170 base::RunLoop().Run(); |
7171 | 7171 |
7172 int64 file_size = 0; | 7172 int64 file_size = 0; |
7173 file_util::GetFileSize(app_path, &file_size); | 7173 base::GetFileSize(app_path, &file_size); |
7174 | 7174 |
7175 EXPECT_FALSE(r.is_pending()); | 7175 EXPECT_FALSE(r.is_pending()); |
7176 EXPECT_EQ(1, d.response_started_count()); | 7176 EXPECT_EQ(1, d.response_started_count()); |
7177 EXPECT_FALSE(d.received_data_before_response()); | 7177 EXPECT_FALSE(d.received_data_before_response()); |
7178 EXPECT_EQ(d.bytes_received(), static_cast<int>(file_size)); | 7178 EXPECT_EQ(d.bytes_received(), static_cast<int>(file_size)); |
7179 } | 7179 } |
7180 } | 7180 } |
7181 | 7181 |
7182 // Flaky, see http://crbug.com/25045. | 7182 // Flaky, see http://crbug.com/25045. |
7183 TEST_F(URLRequestTestFTP, DISABLED_FTPCheckWrongUser) { | 7183 TEST_F(URLRequestTestFTP, DISABLED_FTPCheckWrongUser) { |
7184 ASSERT_TRUE(test_server_.Start()); | 7184 ASSERT_TRUE(test_server_.Start()); |
7185 | 7185 |
7186 base::FilePath app_path; | 7186 base::FilePath app_path; |
7187 PathService::Get(base::DIR_SOURCE_ROOT, &app_path); | 7187 PathService::Get(base::DIR_SOURCE_ROOT, &app_path); |
7188 app_path = app_path.AppendASCII("LICENSE"); | 7188 app_path = app_path.AppendASCII("LICENSE"); |
7189 TestDelegate d; | 7189 TestDelegate d; |
7190 { | 7190 { |
7191 URLRequest r(test_server_.GetURLWithUserAndPassword( | 7191 URLRequest r(test_server_.GetURLWithUserAndPassword( |
7192 "/LICENSE", "wrong_user", "chrome"), | 7192 "/LICENSE", "wrong_user", "chrome"), |
7193 DEFAULT_PRIORITY, | 7193 DEFAULT_PRIORITY, |
7194 &d, | 7194 &d, |
7195 &default_context_); | 7195 &default_context_); |
7196 r.Start(); | 7196 r.Start(); |
7197 EXPECT_TRUE(r.is_pending()); | 7197 EXPECT_TRUE(r.is_pending()); |
7198 | 7198 |
7199 base::RunLoop().Run(); | 7199 base::RunLoop().Run(); |
7200 | 7200 |
7201 int64 file_size = 0; | 7201 int64 file_size = 0; |
7202 file_util::GetFileSize(app_path, &file_size); | 7202 base::GetFileSize(app_path, &file_size); |
7203 | 7203 |
7204 EXPECT_FALSE(r.is_pending()); | 7204 EXPECT_FALSE(r.is_pending()); |
7205 EXPECT_EQ(1, d.response_started_count()); | 7205 EXPECT_EQ(1, d.response_started_count()); |
7206 EXPECT_FALSE(d.received_data_before_response()); | 7206 EXPECT_FALSE(d.received_data_before_response()); |
7207 EXPECT_EQ(d.bytes_received(), 0); | 7207 EXPECT_EQ(d.bytes_received(), 0); |
7208 } | 7208 } |
7209 } | 7209 } |
7210 | 7210 |
7211 // Flaky, see http://crbug.com/25045. | 7211 // Flaky, see http://crbug.com/25045. |
7212 TEST_F(URLRequestTestFTP, DISABLED_FTPCheckWrongUserRestart) { | 7212 TEST_F(URLRequestTestFTP, DISABLED_FTPCheckWrongUserRestart) { |
(...skipping 11 matching lines...) Expand all Loading... |
7224 "/LICENSE", "wrong_user", "chrome"), | 7224 "/LICENSE", "wrong_user", "chrome"), |
7225 DEFAULT_PRIORITY, | 7225 DEFAULT_PRIORITY, |
7226 &d, | 7226 &d, |
7227 &default_context_); | 7227 &default_context_); |
7228 r.Start(); | 7228 r.Start(); |
7229 EXPECT_TRUE(r.is_pending()); | 7229 EXPECT_TRUE(r.is_pending()); |
7230 | 7230 |
7231 base::RunLoop().Run(); | 7231 base::RunLoop().Run(); |
7232 | 7232 |
7233 int64 file_size = 0; | 7233 int64 file_size = 0; |
7234 file_util::GetFileSize(app_path, &file_size); | 7234 base::GetFileSize(app_path, &file_size); |
7235 | 7235 |
7236 EXPECT_FALSE(r.is_pending()); | 7236 EXPECT_FALSE(r.is_pending()); |
7237 EXPECT_EQ(1, d.response_started_count()); | 7237 EXPECT_EQ(1, d.response_started_count()); |
7238 EXPECT_FALSE(d.received_data_before_response()); | 7238 EXPECT_FALSE(d.received_data_before_response()); |
7239 EXPECT_EQ(d.bytes_received(), static_cast<int>(file_size)); | 7239 EXPECT_EQ(d.bytes_received(), static_cast<int>(file_size)); |
7240 } | 7240 } |
7241 } | 7241 } |
7242 | 7242 |
7243 // Flaky, see http://crbug.com/25045. | 7243 // Flaky, see http://crbug.com/25045. |
7244 TEST_F(URLRequestTestFTP, DISABLED_FTPCacheURLCredentials) { | 7244 TEST_F(URLRequestTestFTP, DISABLED_FTPCacheURLCredentials) { |
(...skipping 10 matching lines...) Expand all Loading... |
7255 test_server_.GetURLWithUserAndPassword("/LICENSE", "chrome", "chrome"), | 7255 test_server_.GetURLWithUserAndPassword("/LICENSE", "chrome", "chrome"), |
7256 DEFAULT_PRIORITY, | 7256 DEFAULT_PRIORITY, |
7257 d.get(), | 7257 d.get(), |
7258 &default_context_); | 7258 &default_context_); |
7259 r.Start(); | 7259 r.Start(); |
7260 EXPECT_TRUE(r.is_pending()); | 7260 EXPECT_TRUE(r.is_pending()); |
7261 | 7261 |
7262 base::RunLoop().Run(); | 7262 base::RunLoop().Run(); |
7263 | 7263 |
7264 int64 file_size = 0; | 7264 int64 file_size = 0; |
7265 file_util::GetFileSize(app_path, &file_size); | 7265 base::GetFileSize(app_path, &file_size); |
7266 | 7266 |
7267 EXPECT_FALSE(r.is_pending()); | 7267 EXPECT_FALSE(r.is_pending()); |
7268 EXPECT_EQ(1, d->response_started_count()); | 7268 EXPECT_EQ(1, d->response_started_count()); |
7269 EXPECT_FALSE(d->received_data_before_response()); | 7269 EXPECT_FALSE(d->received_data_before_response()); |
7270 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); | 7270 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); |
7271 } | 7271 } |
7272 | 7272 |
7273 d.reset(new TestDelegate); | 7273 d.reset(new TestDelegate); |
7274 { | 7274 { |
7275 // This request should use cached identity from previous request. | 7275 // This request should use cached identity from previous request. |
7276 URLRequest r(test_server_.GetURL("/LICENSE"), | 7276 URLRequest r(test_server_.GetURL("/LICENSE"), |
7277 DEFAULT_PRIORITY, | 7277 DEFAULT_PRIORITY, |
7278 d.get(), | 7278 d.get(), |
7279 &default_context_); | 7279 &default_context_); |
7280 r.Start(); | 7280 r.Start(); |
7281 EXPECT_TRUE(r.is_pending()); | 7281 EXPECT_TRUE(r.is_pending()); |
7282 | 7282 |
7283 base::RunLoop().Run(); | 7283 base::RunLoop().Run(); |
7284 | 7284 |
7285 int64 file_size = 0; | 7285 int64 file_size = 0; |
7286 file_util::GetFileSize(app_path, &file_size); | 7286 base::GetFileSize(app_path, &file_size); |
7287 | 7287 |
7288 EXPECT_FALSE(r.is_pending()); | 7288 EXPECT_FALSE(r.is_pending()); |
7289 EXPECT_EQ(1, d->response_started_count()); | 7289 EXPECT_EQ(1, d->response_started_count()); |
7290 EXPECT_FALSE(d->received_data_before_response()); | 7290 EXPECT_FALSE(d->received_data_before_response()); |
7291 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); | 7291 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); |
7292 } | 7292 } |
7293 } | 7293 } |
7294 | 7294 |
7295 // Flaky, see http://crbug.com/25045. | 7295 // Flaky, see http://crbug.com/25045. |
7296 TEST_F(URLRequestTestFTP, DISABLED_FTPCacheLoginBoxCredentials) { | 7296 TEST_F(URLRequestTestFTP, DISABLED_FTPCacheLoginBoxCredentials) { |
(...skipping 12 matching lines...) Expand all Loading... |
7309 "/LICENSE", "chrome", "wrong_password"), | 7309 "/LICENSE", "chrome", "wrong_password"), |
7310 DEFAULT_PRIORITY, | 7310 DEFAULT_PRIORITY, |
7311 d.get(), | 7311 d.get(), |
7312 &default_context_); | 7312 &default_context_); |
7313 r.Start(); | 7313 r.Start(); |
7314 EXPECT_TRUE(r.is_pending()); | 7314 EXPECT_TRUE(r.is_pending()); |
7315 | 7315 |
7316 base::RunLoop().Run(); | 7316 base::RunLoop().Run(); |
7317 | 7317 |
7318 int64 file_size = 0; | 7318 int64 file_size = 0; |
7319 file_util::GetFileSize(app_path, &file_size); | 7319 base::GetFileSize(app_path, &file_size); |
7320 | 7320 |
7321 EXPECT_FALSE(r.is_pending()); | 7321 EXPECT_FALSE(r.is_pending()); |
7322 EXPECT_EQ(1, d->response_started_count()); | 7322 EXPECT_EQ(1, d->response_started_count()); |
7323 EXPECT_FALSE(d->received_data_before_response()); | 7323 EXPECT_FALSE(d->received_data_before_response()); |
7324 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); | 7324 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); |
7325 } | 7325 } |
7326 | 7326 |
7327 // Use a new delegate without explicit credentials. The cached ones should be | 7327 // Use a new delegate without explicit credentials. The cached ones should be |
7328 // used. | 7328 // used. |
7329 d.reset(new TestDelegate); | 7329 d.reset(new TestDelegate); |
7330 { | 7330 { |
7331 // Don't pass wrong credentials in the URL, they would override valid cached | 7331 // Don't pass wrong credentials in the URL, they would override valid cached |
7332 // ones. | 7332 // ones. |
7333 URLRequest r(test_server_.GetURL("/LICENSE"), | 7333 URLRequest r(test_server_.GetURL("/LICENSE"), |
7334 DEFAULT_PRIORITY, | 7334 DEFAULT_PRIORITY, |
7335 d.get(), | 7335 d.get(), |
7336 &default_context_); | 7336 &default_context_); |
7337 r.Start(); | 7337 r.Start(); |
7338 EXPECT_TRUE(r.is_pending()); | 7338 EXPECT_TRUE(r.is_pending()); |
7339 | 7339 |
7340 base::RunLoop().Run(); | 7340 base::RunLoop().Run(); |
7341 | 7341 |
7342 int64 file_size = 0; | 7342 int64 file_size = 0; |
7343 file_util::GetFileSize(app_path, &file_size); | 7343 base::GetFileSize(app_path, &file_size); |
7344 | 7344 |
7345 EXPECT_FALSE(r.is_pending()); | 7345 EXPECT_FALSE(r.is_pending()); |
7346 EXPECT_EQ(1, d->response_started_count()); | 7346 EXPECT_EQ(1, d->response_started_count()); |
7347 EXPECT_FALSE(d->received_data_before_response()); | 7347 EXPECT_FALSE(d->received_data_before_response()); |
7348 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); | 7348 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); |
7349 } | 7349 } |
7350 } | 7350 } |
7351 #endif // !defined(DISABLE_FTP_SUPPORT) | 7351 #endif // !defined(DISABLE_FTP_SUPPORT) |
7352 | 7352 |
7353 } // namespace net | 7353 } // namespace net |
OLD | NEW |