Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: net/http/http_network_layer_unittest.cc

Issue 1604011: Use HttpRequestHeaders for extra_headers. (Closed)
Patch Set: Address eroman comments. Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http/http_cache_unittest.cc ('k') | net/http/http_network_transaction.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « net/http/http_cache_unittest.cc ('k') | net/http/http_network_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698