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 5925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5936 TEST_F(URLRequestTestHTTP, DefaultUserAgent) { | 5936 TEST_F(URLRequestTestHTTP, DefaultUserAgent) { |
5937 ASSERT_TRUE(test_server_.Start()); | 5937 ASSERT_TRUE(test_server_.Start()); |
5938 | 5938 |
5939 TestDelegate d; | 5939 TestDelegate d; |
5940 URLRequest req(test_server_.GetURL("echoheader?User-Agent"), | 5940 URLRequest req(test_server_.GetURL("echoheader?User-Agent"), |
5941 DEFAULT_PRIORITY, | 5941 DEFAULT_PRIORITY, |
5942 &d, | 5942 &d, |
5943 &default_context_); | 5943 &default_context_); |
5944 req.Start(); | 5944 req.Start(); |
5945 base::RunLoop().Run(); | 5945 base::RunLoop().Run(); |
5946 EXPECT_EQ(req.context()->GetUserAgent(req.url()), d.data_received()); | 5946 EXPECT_EQ(req.context()->http_user_agent_settings()->GetUserAgent(req.url()), |
| 5947 d.data_received()); |
5947 } | 5948 } |
5948 | 5949 |
5949 // Check that if request overrides the User-Agent header, | 5950 // Check that if request overrides the User-Agent header, |
5950 // the default is not appended. | 5951 // the default is not appended. |
5951 TEST_F(URLRequestTestHTTP, OverrideUserAgent) { | 5952 TEST_F(URLRequestTestHTTP, OverrideUserAgent) { |
5952 ASSERT_TRUE(test_server_.Start()); | 5953 ASSERT_TRUE(test_server_.Start()); |
5953 | 5954 |
5954 TestDelegate d; | 5955 TestDelegate d; |
5955 URLRequest req(test_server_.GetURL("echoheader?User-Agent"), | 5956 URLRequest req(test_server_.GetURL("echoheader?User-Agent"), |
5956 DEFAULT_PRIORITY, | 5957 DEFAULT_PRIORITY, |
(...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7615 | 7616 |
7616 EXPECT_FALSE(r.is_pending()); | 7617 EXPECT_FALSE(r.is_pending()); |
7617 EXPECT_EQ(1, d->response_started_count()); | 7618 EXPECT_EQ(1, d->response_started_count()); |
7618 EXPECT_FALSE(d->received_data_before_response()); | 7619 EXPECT_FALSE(d->received_data_before_response()); |
7619 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); | 7620 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); |
7620 } | 7621 } |
7621 } | 7622 } |
7622 #endif // !defined(DISABLE_FTP_SUPPORT) | 7623 #endif // !defined(DISABLE_FTP_SUPPORT) |
7623 | 7624 |
7624 } // namespace net | 7625 } // namespace net |
OLD | NEW |