| 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 |
| 11 | 11 |
| 12 #include <algorithm> | 12 #include <algorithm> |
| 13 #include <string> | 13 #include <string> |
| 14 | 14 |
| 15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
| 16 #include "base/bind.h" | 16 #include "base/bind.h" |
| 17 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
| 18 #include "base/file_util.h" | 18 #include "base/file_util.h" |
| 19 #include "base/files/scoped_temp_dir.h" | 19 #include "base/files/scoped_temp_dir.h" |
| 20 #include "base/format_macros.h" | 20 #include "base/format_macros.h" |
| 21 #include "base/memory/scoped_ptr.h" |
| 21 #include "base/memory/weak_ptr.h" | 22 #include "base/memory/weak_ptr.h" |
| 22 #include "base/message_loop/message_loop.h" | 23 #include "base/message_loop/message_loop.h" |
| 23 #include "base/message_loop/message_loop_proxy.h" | 24 #include "base/message_loop/message_loop_proxy.h" |
| 24 #include "base/path_service.h" | 25 #include "base/path_service.h" |
| 25 #include "base/run_loop.h" | 26 #include "base/run_loop.h" |
| 26 #include "base/strings/string_number_conversions.h" | 27 #include "base/strings/string_number_conversions.h" |
| 27 #include "base/strings/string_piece.h" | 28 #include "base/strings/string_piece.h" |
| 28 #include "base/strings/string_split.h" | 29 #include "base/strings/string_split.h" |
| 29 #include "base/strings/string_util.h" | 30 #include "base/strings/string_util.h" |
| 30 #include "base/strings/stringprintf.h" | 31 #include "base/strings/stringprintf.h" |
| (...skipping 1788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1819 | 1820 |
| 1820 // Other times should have been left null. | 1821 // Other times should have been left null. |
| 1821 TestLoadTimingNotReusedWithProxy(load_timing_result, | 1822 TestLoadTimingNotReusedWithProxy(load_timing_result, |
| 1822 CONNECT_TIMING_HAS_CONNECT_TIMES_ONLY); | 1823 CONNECT_TIMING_HAS_CONNECT_TIMES_ONLY); |
| 1823 } | 1824 } |
| 1824 | 1825 |
| 1825 // Check that two different URL requests have different identifiers. | 1826 // Check that two different URL requests have different identifiers. |
| 1826 TEST_F(URLRequestTest, Identifiers) { | 1827 TEST_F(URLRequestTest, Identifiers) { |
| 1827 TestDelegate d; | 1828 TestDelegate d; |
| 1828 TestURLRequestContext context; | 1829 TestURLRequestContext context; |
| 1829 TestURLRequest req( | 1830 scoped_ptr<URLRequest> req(context.CreateRequest( |
| 1830 GURL("http://example.com"), DEFAULT_PRIORITY, &d, &context); | 1831 GURL("http://example.com"), DEFAULT_PRIORITY, &d, NULL)); |
| 1831 TestURLRequest other_req( | 1832 scoped_ptr<URLRequest> other_req(context.CreateRequest( |
| 1832 GURL("http://example.com"), DEFAULT_PRIORITY, &d, &context); | 1833 GURL("http://example.com"), DEFAULT_PRIORITY, &d, NULL)); |
| 1833 | 1834 |
| 1834 ASSERT_NE(req.identifier(), other_req.identifier()); | 1835 ASSERT_NE(req->identifier(), other_req->identifier()); |
| 1835 } | 1836 } |
| 1836 | 1837 |
| 1837 // Check that a failure to connect to the proxy is reported to the network | 1838 // Check that a failure to connect to the proxy is reported to the network |
| 1838 // delegate. | 1839 // delegate. |
| 1839 TEST_F(URLRequestTest, NetworkDelegateProxyError) { | 1840 TEST_F(URLRequestTest, NetworkDelegateProxyError) { |
| 1840 MockHostResolver host_resolver; | 1841 MockHostResolver host_resolver; |
| 1841 host_resolver.rules()->AddSimulatedFailure("*"); | 1842 host_resolver.rules()->AddSimulatedFailure("*"); |
| 1842 | 1843 |
| 1843 TestNetworkDelegate network_delegate; // Must outlive URLRequests. | 1844 TestNetworkDelegate network_delegate; // Must outlive URLRequests. |
| 1844 TestURLRequestContextWithProxy context("myproxy:70", &network_delegate); | 1845 TestURLRequestContextWithProxy context("myproxy:70", &network_delegate); |
| (...skipping 6196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8041 | 8042 |
| 8042 EXPECT_FALSE(r->is_pending()); | 8043 EXPECT_FALSE(r->is_pending()); |
| 8043 EXPECT_EQ(1, d->response_started_count()); | 8044 EXPECT_EQ(1, d->response_started_count()); |
| 8044 EXPECT_FALSE(d->received_data_before_response()); | 8045 EXPECT_FALSE(d->received_data_before_response()); |
| 8045 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); | 8046 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); |
| 8046 } | 8047 } |
| 8047 } | 8048 } |
| 8048 #endif // !defined(DISABLE_FTP_SUPPORT) | 8049 #endif // !defined(DISABLE_FTP_SUPPORT) |
| 8049 | 8050 |
| 8050 } // namespace net | 8051 } // namespace net |
| OLD | NEW |