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/files/file_util.h" | 18 #include "base/files/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 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1820 | 1821 |
1821 // Other times should have been left null. | 1822 // Other times should have been left null. |
1822 TestLoadTimingNotReusedWithProxy(load_timing_result, | 1823 TestLoadTimingNotReusedWithProxy(load_timing_result, |
1823 CONNECT_TIMING_HAS_CONNECT_TIMES_ONLY); | 1824 CONNECT_TIMING_HAS_CONNECT_TIMES_ONLY); |
1824 } | 1825 } |
1825 | 1826 |
1826 // Check that two different URL requests have different identifiers. | 1827 // Check that two different URL requests have different identifiers. |
1827 TEST_F(URLRequestTest, Identifiers) { | 1828 TEST_F(URLRequestTest, Identifiers) { |
1828 TestDelegate d; | 1829 TestDelegate d; |
1829 TestURLRequestContext context; | 1830 TestURLRequestContext context; |
1830 TestURLRequest req( | 1831 scoped_ptr<URLRequest> req(context.CreateRequest( |
1831 GURL("http://example.com"), DEFAULT_PRIORITY, &d, &context); | 1832 GURL("http://example.com"), DEFAULT_PRIORITY, &d, NULL)); |
1832 TestURLRequest other_req( | 1833 scoped_ptr<URLRequest> other_req(context.CreateRequest( |
1833 GURL("http://example.com"), DEFAULT_PRIORITY, &d, &context); | 1834 GURL("http://example.com"), DEFAULT_PRIORITY, &d, NULL)); |
1834 | 1835 |
1835 ASSERT_NE(req.identifier(), other_req.identifier()); | 1836 ASSERT_NE(req->identifier(), other_req->identifier()); |
1836 } | 1837 } |
1837 | 1838 |
1838 // Check that a failure to connect to the proxy is reported to the network | 1839 // Check that a failure to connect to the proxy is reported to the network |
1839 // delegate. | 1840 // delegate. |
1840 TEST_F(URLRequestTest, NetworkDelegateProxyError) { | 1841 TEST_F(URLRequestTest, NetworkDelegateProxyError) { |
1841 MockHostResolver host_resolver; | 1842 MockHostResolver host_resolver; |
1842 host_resolver.rules()->AddSimulatedFailure("*"); | 1843 host_resolver.rules()->AddSimulatedFailure("*"); |
1843 | 1844 |
1844 TestNetworkDelegate network_delegate; // Must outlive URLRequests. | 1845 TestNetworkDelegate network_delegate; // Must outlive URLRequests. |
1845 TestURLRequestContextWithProxy context("myproxy:70", &network_delegate); | 1846 TestURLRequestContextWithProxy context("myproxy:70", &network_delegate); |
(...skipping 6248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8094 | 8095 |
8095 EXPECT_FALSE(r->is_pending()); | 8096 EXPECT_FALSE(r->is_pending()); |
8096 EXPECT_EQ(1, d->response_started_count()); | 8097 EXPECT_EQ(1, d->response_started_count()); |
8097 EXPECT_FALSE(d->received_data_before_response()); | 8098 EXPECT_FALSE(d->received_data_before_response()); |
8098 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); | 8099 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); |
8099 } | 8100 } |
8100 } | 8101 } |
8101 #endif // !defined(DISABLE_FTP_SUPPORT) | 8102 #endif // !defined(DISABLE_FTP_SUPPORT) |
8102 | 8103 |
8103 } // namespace net | 8104 } // namespace net |
OLD | NEW |