OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "net/url_request/url_request_unittest.h" | 5 #include "net/url_request/url_request_unittest.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <windows.h> | 10 #include <windows.h> |
11 #include <shlobj.h> | 11 #include <shlobj.h> |
12 #elif defined(USE_NSS) | 12 #elif defined(USE_NSS) |
13 #include "base/nss_util.h" | 13 #include "base/nss_util.h" |
14 #endif | 14 #endif |
15 | 15 |
16 #include <algorithm> | 16 #include <algorithm> |
17 #include <string> | 17 #include <string> |
18 | 18 |
19 #include "base/file_util.h" | 19 #include "base/file_util.h" |
20 #include "base/format_macros.h" | 20 #include "base/format_macros.h" |
21 #include "base/message_loop.h" | 21 #include "base/message_loop.h" |
22 #include "base/path_service.h" | 22 #include "base/path_service.h" |
23 #include "base/process_util.h" | 23 #include "base/process_util.h" |
24 #include "base/string_piece.h" | 24 #include "base/string_piece.h" |
25 #include "base/string_util.h" | 25 #include "base/string_util.h" |
26 #include "net/base/cookie_monster.h" | 26 #include "net/base/cookie_monster.h" |
27 #include "net/base/cookie_policy.h" | 27 #include "net/base/cookie_policy.h" |
28 #include "net/base/load_flags.h" | 28 #include "net/base/load_flags.h" |
29 #include "net/base/load_log.h" | 29 #include "net/base/net_log.h" |
30 #include "net/base/load_log_unittest.h" | 30 #include "net/base/net_log_unittest.h" |
31 #include "net/base/net_errors.h" | 31 #include "net/base/net_errors.h" |
32 #include "net/base/net_module.h" | 32 #include "net/base/net_module.h" |
33 #include "net/base/net_util.h" | 33 #include "net/base/net_util.h" |
34 #include "net/base/upload_data.h" | 34 #include "net/base/upload_data.h" |
35 #include "net/disk_cache/disk_cache.h" | 35 #include "net/disk_cache/disk_cache.h" |
36 #include "net/ftp/ftp_network_layer.h" | 36 #include "net/ftp/ftp_network_layer.h" |
37 #include "net/http/http_cache.h" | 37 #include "net/http/http_cache.h" |
38 #include "net/http/http_network_layer.h" | 38 #include "net/http/http_network_layer.h" |
39 #include "net/http/http_response_headers.h" | 39 #include "net/http/http_response_headers.h" |
40 #include "net/proxy/proxy_service.h" | 40 #include "net/proxy/proxy_service.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 210 |
211 r.Start(); | 211 r.Start(); |
212 EXPECT_TRUE(r.is_pending()); | 212 EXPECT_TRUE(r.is_pending()); |
213 | 213 |
214 MessageLoop::current()->Run(); | 214 MessageLoop::current()->Run(); |
215 | 215 |
216 EXPECT_EQ(1, d.response_started_count()); | 216 EXPECT_EQ(1, d.response_started_count()); |
217 EXPECT_FALSE(d.received_data_before_response()); | 217 EXPECT_FALSE(d.received_data_before_response()); |
218 EXPECT_NE(0, d.bytes_received()); | 218 EXPECT_NE(0, d.bytes_received()); |
219 | 219 |
220 // The first part of the log will be for URL_REQUEST_START. | 220 // TODO(eroman): Add back the NetLog tests... |
221 // After that, there should be an HTTP_TRANSACTION_READ_BODY | |
222 EXPECT_TRUE(net::LogContainsBeginEvent( | |
223 *r.load_log(), 0, net::LoadLog::TYPE_URL_REQUEST_START)); | |
224 EXPECT_TRUE(net::LogContainsEndEvent( | |
225 *r.load_log(), -3, net::LoadLog::TYPE_URL_REQUEST_START)); | |
226 EXPECT_TRUE(net::LogContainsBeginEvent( | |
227 *r.load_log(), -2, net::LoadLog::TYPE_HTTP_TRANSACTION_READ_BODY)); | |
228 EXPECT_TRUE(net::LogContainsEndEvent( | |
229 *r.load_log(), -1, net::LoadLog::TYPE_HTTP_TRANSACTION_READ_BODY)); | |
230 } | 221 } |
231 } | 222 } |
232 | 223 |
233 TEST_F(URLRequestTestHTTP, GetTest) { | 224 TEST_F(URLRequestTestHTTP, GetTest) { |
234 ASSERT_TRUE(NULL != server_.get()); | 225 ASSERT_TRUE(NULL != server_.get()); |
235 TestDelegate d; | 226 TestDelegate d; |
236 { | 227 { |
237 TestURLRequest r(server_->TestServerPage(""), &d); | 228 TestURLRequest r(server_->TestServerPage(""), &d); |
238 | 229 |
239 r.Start(); | 230 r.Start(); |
(...skipping 2284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2524 ASSERT_TRUE(NULL != server_.get()); | 2515 ASSERT_TRUE(NULL != server_.get()); |
2525 TestDelegate d; | 2516 TestDelegate d; |
2526 TestURLRequest | 2517 TestURLRequest |
2527 req(server_->TestServerPage("echoheaderoverride?Accept-Charset"), &d); | 2518 req(server_->TestServerPage("echoheaderoverride?Accept-Charset"), &d); |
2528 req.set_context(new URLRequestTestContext()); | 2519 req.set_context(new URLRequestTestContext()); |
2529 req.SetExtraRequestHeaders("Accept-Charset: koi-8r"); | 2520 req.SetExtraRequestHeaders("Accept-Charset: koi-8r"); |
2530 req.Start(); | 2521 req.Start(); |
2531 MessageLoop::current()->Run(); | 2522 MessageLoop::current()->Run(); |
2532 EXPECT_EQ(std::string("koi-8r"), d.data_received()); | 2523 EXPECT_EQ(std::string("koi-8r"), d.data_received()); |
2533 } | 2524 } |
OLD | NEW |