| 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 new UploadBytesElementReader(data, strlen(data))); | 251 new UploadBytesElementReader(data, strlen(data))); |
| 252 return ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0); | 252 return ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0); |
| 253 } | 253 } |
| 254 | 254 |
| 255 // Verify that the SSLInfo of a successful SSL connection has valid values. | 255 // Verify that the SSLInfo of a successful SSL connection has valid values. |
| 256 void CheckSSLInfo(const SSLInfo& ssl_info) { | 256 void CheckSSLInfo(const SSLInfo& ssl_info) { |
| 257 // -1 means unknown. 0 means no encryption. | 257 // -1 means unknown. 0 means no encryption. |
| 258 EXPECT_GT(ssl_info.security_bits, 0); | 258 EXPECT_GT(ssl_info.security_bits, 0); |
| 259 | 259 |
| 260 // The cipher suite TLS_NULL_WITH_NULL_NULL (0) must not be negotiated. | 260 // The cipher suite TLS_NULL_WITH_NULL_NULL (0) must not be negotiated. |
| 261 int cipher_suite = SSLConnectionStatusToCipherSuite( | 261 uint16 cipher_suite = SSLConnectionStatusToCipherSuite( |
| 262 ssl_info.connection_status); | 262 ssl_info.connection_status); |
| 263 EXPECT_NE(0, cipher_suite); | 263 EXPECT_NE(0U, cipher_suite); |
| 264 } | 264 } |
| 265 | 265 |
| 266 void CheckFullRequestHeaders(const HttpRequestHeaders& headers, | 266 void CheckFullRequestHeaders(const HttpRequestHeaders& headers, |
| 267 const GURL& host_url) { | 267 const GURL& host_url) { |
| 268 std::string sent_value; | 268 std::string sent_value; |
| 269 | 269 |
| 270 EXPECT_TRUE(headers.GetHeader("Host", &sent_value)); | 270 EXPECT_TRUE(headers.GetHeader("Host", &sent_value)); |
| 271 EXPECT_EQ(GetHostAndOptionalPort(host_url), sent_value); | 271 EXPECT_EQ(GetHostAndOptionalPort(host_url), sent_value); |
| 272 | 272 |
| 273 EXPECT_TRUE(headers.GetHeader("Connection", &sent_value)); | 273 EXPECT_TRUE(headers.GetHeader("Connection", &sent_value)); |
| (...skipping 3482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3756 int upper_bound = 1; | 3756 int upper_bound = 1; |
| 3757 | 3757 |
| 3758 // Double the number of cookies until the response header limits are | 3758 // Double the number of cookies until the response header limits are |
| 3759 // exceeded. | 3759 // exceeded. |
| 3760 while (DoManyCookiesRequest(upper_bound)) { | 3760 while (DoManyCookiesRequest(upper_bound)) { |
| 3761 lower_bound = upper_bound; | 3761 lower_bound = upper_bound; |
| 3762 upper_bound *= 2; | 3762 upper_bound *= 2; |
| 3763 ASSERT_LT(upper_bound, 1000000); | 3763 ASSERT_LT(upper_bound, 1000000); |
| 3764 } | 3764 } |
| 3765 | 3765 |
| 3766 int tolerance = upper_bound * 0.005; | 3766 int tolerance = static_cast<int>(upper_bound * 0.005); |
| 3767 if (tolerance < 2) | 3767 if (tolerance < 2) |
| 3768 tolerance = 2; | 3768 tolerance = 2; |
| 3769 | 3769 |
| 3770 // Perform a binary search to find the highest possible number of cookies, | 3770 // Perform a binary search to find the highest possible number of cookies, |
| 3771 // within the desired tolerance. | 3771 // within the desired tolerance. |
| 3772 while (upper_bound - lower_bound >= tolerance) { | 3772 while (upper_bound - lower_bound >= tolerance) { |
| 3773 int num_cookies = (lower_bound + upper_bound) / 2; | 3773 int num_cookies = (lower_bound + upper_bound) / 2; |
| 3774 | 3774 |
| 3775 if (DoManyCookiesRequest(num_cookies)) | 3775 if (DoManyCookiesRequest(num_cookies)) |
| 3776 lower_bound = num_cookies; | 3776 lower_bound = num_cookies; |
| (...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4962 kuint64max, | 4962 kuint64max, |
| 4963 base::Time())); | 4963 base::Time())); |
| 4964 r->set_upload(make_scoped_ptr<UploadDataStream>( | 4964 r->set_upload(make_scoped_ptr<UploadDataStream>( |
| 4965 new ElementsUploadDataStream(element_readers.Pass(), 0))); | 4965 new ElementsUploadDataStream(element_readers.Pass(), 0))); |
| 4966 | 4966 |
| 4967 r->Start(); | 4967 r->Start(); |
| 4968 EXPECT_TRUE(r->is_pending()); | 4968 EXPECT_TRUE(r->is_pending()); |
| 4969 | 4969 |
| 4970 base::RunLoop().Run(); | 4970 base::RunLoop().Run(); |
| 4971 | 4971 |
| 4972 int64 size = 0; | 4972 int64 size64 = 0; |
| 4973 ASSERT_EQ(true, base::GetFileSize(path, &size)); | 4973 ASSERT_EQ(true, base::GetFileSize(path, &size64)); |
| 4974 ASSERT_LE(size64, std::numeric_limits<int>::max()); |
| 4975 int size = static_cast<int>(size64); |
| 4974 scoped_ptr<char[]> buf(new char[size]); | 4976 scoped_ptr<char[]> buf(new char[size]); |
| 4975 | 4977 |
| 4976 ASSERT_EQ(size, base::ReadFile(path, buf.get(), size)); | 4978 ASSERT_EQ(size, base::ReadFile(path, buf.get(), size)); |
| 4977 | 4979 |
| 4978 ASSERT_EQ(1, d.response_started_count()) | 4980 ASSERT_EQ(1, d.response_started_count()) |
| 4979 << "request failed: " << r->status().status() | 4981 << "request failed: " << r->status().status() |
| 4980 << ", error: " << r->status().error(); | 4982 << ", error: " << r->status().error(); |
| 4981 | 4983 |
| 4982 EXPECT_FALSE(d.received_data_before_response()); | 4984 EXPECT_FALSE(d.received_data_before_response()); |
| 4983 | 4985 |
| (...skipping 3831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8815 | 8817 |
| 8816 EXPECT_FALSE(r->is_pending()); | 8818 EXPECT_FALSE(r->is_pending()); |
| 8817 EXPECT_EQ(1, d->response_started_count()); | 8819 EXPECT_EQ(1, d->response_started_count()); |
| 8818 EXPECT_FALSE(d->received_data_before_response()); | 8820 EXPECT_FALSE(d->received_data_before_response()); |
| 8819 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); | 8821 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); |
| 8820 } | 8822 } |
| 8821 } | 8823 } |
| 8822 #endif // !defined(DISABLE_FTP_SUPPORT) | 8824 #endif // !defined(DISABLE_FTP_SUPPORT) |
| 8823 | 8825 |
| 8824 } // namespace net | 8826 } // namespace net |
| OLD | NEW |