| 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(OS_LINUX) | 12 #elif defined(OS_LINUX) |
| 13 #include "base/nss_init.h" | 13 #include "base/nss_init.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/message_loop.h" | 20 #include "base/message_loop.h" |
| 21 #include "base/path_service.h" | 21 #include "base/path_service.h" |
| 22 #include "base/process_util.h" | 22 #include "base/process_util.h" |
| 23 #include "base/string_piece.h" | 23 #include "base/string_piece.h" |
| 24 #include "base/string_util.h" | 24 #include "base/string_util.h" |
| 25 #include "net/base/cookie_monster.h" | 25 #include "net/base/cookie_monster.h" |
| 26 #include "net/base/load_flags.h" | 26 #include "net/base/load_flags.h" |
| 27 #include "net/base/load_log.h" |
| 28 #include "net/base/load_log_unittest.h" |
| 27 #include "net/base/net_errors.h" | 29 #include "net/base/net_errors.h" |
| 28 #include "net/base/net_module.h" | 30 #include "net/base/net_module.h" |
| 29 #include "net/base/net_util.h" | 31 #include "net/base/net_util.h" |
| 30 #include "net/base/upload_data.h" | 32 #include "net/base/upload_data.h" |
| 31 #include "net/disk_cache/disk_cache.h" | 33 #include "net/disk_cache/disk_cache.h" |
| 32 #include "net/ftp/ftp_network_layer.h" | 34 #include "net/ftp/ftp_network_layer.h" |
| 33 #include "net/http/http_cache.h" | 35 #include "net/http/http_cache.h" |
| 34 #include "net/http/http_network_layer.h" | 36 #include "net/http/http_network_layer.h" |
| 35 #include "net/http/http_response_headers.h" | 37 #include "net/http/http_response_headers.h" |
| 36 #include "net/proxy/proxy_service.h" | 38 #include "net/proxy/proxy_service.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 TestURLRequest r(server_->TestServerPage(""), &d); | 197 TestURLRequest r(server_->TestServerPage(""), &d); |
| 196 | 198 |
| 197 r.Start(); | 199 r.Start(); |
| 198 EXPECT_TRUE(r.is_pending()); | 200 EXPECT_TRUE(r.is_pending()); |
| 199 | 201 |
| 200 MessageLoop::current()->Run(); | 202 MessageLoop::current()->Run(); |
| 201 | 203 |
| 202 EXPECT_EQ(1, d.response_started_count()); | 204 EXPECT_EQ(1, d.response_started_count()); |
| 203 EXPECT_FALSE(d.received_data_before_response()); | 205 EXPECT_FALSE(d.received_data_before_response()); |
| 204 EXPECT_NE(0, d.bytes_received()); | 206 EXPECT_NE(0, d.bytes_received()); |
| 207 |
| 208 // The first and last entries of the LoadLog should be for |
| 209 // TYPE_URL_REQUEST_START. |
| 210 net::ExpectLogContains(r.load_log(), 0, |
| 211 net::LoadLog::TYPE_URL_REQUEST_START, |
| 212 net::LoadLog::PHASE_BEGIN); |
| 213 net::ExpectLogContains(r.load_log(), r.load_log()->events().size() - 1, |
| 214 net::LoadLog::TYPE_URL_REQUEST_START, |
| 215 net::LoadLog::PHASE_END); |
| 205 } | 216 } |
| 206 } | 217 } |
| 207 | 218 |
| 208 TEST_F(URLRequestTestHTTP, GetTest) { | 219 TEST_F(URLRequestTestHTTP, GetTest) { |
| 209 ASSERT_TRUE(NULL != server_.get()); | 220 ASSERT_TRUE(NULL != server_.get()); |
| 210 TestDelegate d; | 221 TestDelegate d; |
| 211 { | 222 { |
| 212 TestURLRequest r(server_->TestServerPage(""), &d); | 223 TestURLRequest r(server_->TestServerPage(""), &d); |
| 213 | 224 |
| 214 r.Start(); | 225 r.Start(); |
| (...skipping 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2099 | 2110 |
| 2100 int64 file_size = 0; | 2111 int64 file_size = 0; |
| 2101 file_util::GetFileSize(app_path, &file_size); | 2112 file_util::GetFileSize(app_path, &file_size); |
| 2102 | 2113 |
| 2103 EXPECT_FALSE(r.is_pending()); | 2114 EXPECT_FALSE(r.is_pending()); |
| 2104 EXPECT_EQ(1, d.response_started_count()); | 2115 EXPECT_EQ(1, d.response_started_count()); |
| 2105 EXPECT_FALSE(d.received_data_before_response()); | 2116 EXPECT_FALSE(d.received_data_before_response()); |
| 2106 EXPECT_EQ(d.bytes_received(), static_cast<int>(file_size)); | 2117 EXPECT_EQ(d.bytes_received(), static_cast<int>(file_size)); |
| 2107 } | 2118 } |
| 2108 } | 2119 } |
| OLD | NEW |