| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/base/mock_host_resolver.h" | 5 #include "net/base/mock_host_resolver.h" |
| 6 #include "net/base/net_log.h" | 6 #include "net/base/net_log.h" |
| 7 #include "net/base/ssl_config_service_defaults.h" | 7 #include "net/base/ssl_config_service_defaults.h" |
| 8 #include "net/http/http_network_layer.h" | 8 #include "net/http/http_network_layer.h" |
| 9 #include "net/http/http_transaction_unittest.h" | 9 #include "net/http/http_transaction_unittest.h" |
| 10 #include "net/proxy/proxy_service.h" | 10 #include "net/proxy/proxy_service.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 TestCompletionCallback callback; | 76 TestCompletionCallback callback; |
| 77 | 77 |
| 78 scoped_ptr<net::HttpTransaction> trans; | 78 scoped_ptr<net::HttpTransaction> trans; |
| 79 int rv = factory.CreateTransaction(&trans); | 79 int rv = factory.CreateTransaction(&trans); |
| 80 EXPECT_EQ(net::OK, rv); | 80 EXPECT_EQ(net::OK, rv); |
| 81 | 81 |
| 82 net::HttpRequestInfo request_info; | 82 net::HttpRequestInfo request_info; |
| 83 request_info.url = GURL("http://www.google.com/"); | 83 request_info.url = GURL("http://www.google.com/"); |
| 84 request_info.method = "GET"; | 84 request_info.method = "GET"; |
| 85 request_info.user_agent = "Foo/1.0"; | 85 request_info.extra_headers.SetHeader(net::HttpRequestHeaders::kUserAgent, |
| 86 "Foo/1.0"); |
| 86 request_info.load_flags = net::LOAD_NORMAL; | 87 request_info.load_flags = net::LOAD_NORMAL; |
| 87 | 88 |
| 88 rv = trans->Start(&request_info, &callback, net::BoundNetLog()); | 89 rv = trans->Start(&request_info, &callback, net::BoundNetLog()); |
| 89 if (rv == net::ERR_IO_PENDING) | 90 if (rv == net::ERR_IO_PENDING) |
| 90 rv = callback.WaitForResult(); | 91 rv = callback.WaitForResult(); |
| 91 ASSERT_EQ(net::OK, rv); | 92 ASSERT_EQ(net::OK, rv); |
| 92 | 93 |
| 93 std::string contents; | 94 std::string contents; |
| 94 rv = ReadTransaction(trans.get(), &contents); | 95 rv = ReadTransaction(trans.get(), &contents); |
| 95 EXPECT_EQ(net::OK, rv); | 96 EXPECT_EQ(net::OK, rv); |
| 96 EXPECT_EQ("hello world", contents); | 97 EXPECT_EQ("hello world", contents); |
| 97 } | 98 } |
| OLD | NEW |