| 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> |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 EXPECT_TRUE(r.is_pending()); | 211 EXPECT_TRUE(r.is_pending()); |
| 212 | 212 |
| 213 MessageLoop::current()->Run(); | 213 MessageLoop::current()->Run(); |
| 214 | 214 |
| 215 EXPECT_EQ(1, d.response_started_count()); | 215 EXPECT_EQ(1, d.response_started_count()); |
| 216 EXPECT_FALSE(d.received_data_before_response()); | 216 EXPECT_FALSE(d.received_data_before_response()); |
| 217 EXPECT_NE(0, d.bytes_received()); | 217 EXPECT_NE(0, d.bytes_received()); |
| 218 | 218 |
| 219 // The first part of the log will be for URL_REQUEST_START. | 219 // The first part of the log will be for URL_REQUEST_START. |
| 220 // After that, there should be an HTTP_TRANSACTION_READ_BODY | 220 // After that, there should be an HTTP_TRANSACTION_READ_BODY |
| 221 EXPECT_TRUE( | 221 EXPECT_TRUE(net::LogContainsBeginEvent( |
| 222 net::LogContains(*r.load_log(), 0, | 222 *r.load_log(), 0, net::LoadLog::TYPE_URL_REQUEST_START)); |
| 223 net::LoadLog::TYPE_URL_REQUEST_START, | 223 EXPECT_TRUE(net::LogContainsEndEvent( |
| 224 net::LoadLog::PHASE_BEGIN)); | 224 *r.load_log(), -3, net::LoadLog::TYPE_URL_REQUEST_START)); |
| 225 EXPECT_TRUE( | 225 EXPECT_TRUE(net::LogContainsBeginEvent( |
| 226 net::LogContains(*r.load_log(), -3, | 226 *r.load_log(), -2, net::LoadLog::TYPE_HTTP_TRANSACTION_READ_BODY)); |
| 227 net::LoadLog::TYPE_URL_REQUEST_START, | 227 EXPECT_TRUE(net::LogContainsEndEvent( |
| 228 net::LoadLog::PHASE_END)); | 228 *r.load_log(), -1, net::LoadLog::TYPE_HTTP_TRANSACTION_READ_BODY)); |
| 229 EXPECT_TRUE( | |
| 230 net::LogContains(*r.load_log(), -2, | |
| 231 net::LoadLog::TYPE_HTTP_TRANSACTION_READ_BODY, | |
| 232 net::LoadLog::PHASE_BEGIN)); | |
| 233 EXPECT_TRUE( | |
| 234 net::LogContains(*r.load_log(), -1, | |
| 235 net::LoadLog::TYPE_HTTP_TRANSACTION_READ_BODY, | |
| 236 net::LoadLog::PHASE_END)); | |
| 237 } | 229 } |
| 238 } | 230 } |
| 239 | 231 |
| 240 TEST_F(URLRequestTestHTTP, GetTest) { | 232 TEST_F(URLRequestTestHTTP, GetTest) { |
| 241 ASSERT_TRUE(NULL != server_.get()); | 233 ASSERT_TRUE(NULL != server_.get()); |
| 242 TestDelegate d; | 234 TestDelegate d; |
| 243 { | 235 { |
| 244 TestURLRequest r(server_->TestServerPage(""), &d); | 236 TestURLRequest r(server_->TestServerPage(""), &d); |
| 245 | 237 |
| 246 r.Start(); | 238 r.Start(); |
| (...skipping 1917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2164 ASSERT_TRUE(NULL != server_.get()); | 2156 ASSERT_TRUE(NULL != server_.get()); |
| 2165 TestDelegate d; | 2157 TestDelegate d; |
| 2166 TestURLRequest | 2158 TestURLRequest |
| 2167 req(server_->TestServerPage("echoheaderoverride?Accept-Charset"), &d); | 2159 req(server_->TestServerPage("echoheaderoverride?Accept-Charset"), &d); |
| 2168 req.set_context(new URLRequestTestContext()); | 2160 req.set_context(new URLRequestTestContext()); |
| 2169 req.SetExtraRequestHeaders("Accept-Charset: koi-8r"); | 2161 req.SetExtraRequestHeaders("Accept-Charset: koi-8r"); |
| 2170 req.Start(); | 2162 req.Start(); |
| 2171 MessageLoop::current()->Run(); | 2163 MessageLoop::current()->Run(); |
| 2172 EXPECT_EQ(std::string("koi-8r"), d.data_received()); | 2164 EXPECT_EQ(std::string("koi-8r"), d.data_received()); |
| 2173 } | 2165 } |
| OLD | NEW |