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

Side by Side Diff: net/url_request/url_request_unittest.cc

Issue 251082: Add a response_info() accessor to URLRequest to get a reference to the net::H... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « net/url_request/url_request.h ('k') | no next file » | 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) 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 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 } 878 }
879 879
880 TEST_F(URLRequestTestHTTP, ResponseHeadersTest) { 880 TEST_F(URLRequestTestHTTP, ResponseHeadersTest) {
881 ASSERT_TRUE(NULL != server_.get()); 881 ASSERT_TRUE(NULL != server_.get());
882 TestDelegate d; 882 TestDelegate d;
883 TestURLRequest req(server_->TestServerPage("files/with-headers.html"), &d); 883 TestURLRequest req(server_->TestServerPage("files/with-headers.html"), &d);
884 req.Start(); 884 req.Start();
885 MessageLoop::current()->Run(); 885 MessageLoop::current()->Run();
886 886
887 const net::HttpResponseHeaders* headers = req.response_headers(); 887 const net::HttpResponseHeaders* headers = req.response_headers();
888
889 // Simple sanity check that response_info() accesses the same data.
890 EXPECT_EQ(headers, req.response_info().headers.get());
891
888 std::string header; 892 std::string header;
889 EXPECT_TRUE(headers->GetNormalizedHeader("cache-control", &header)); 893 EXPECT_TRUE(headers->GetNormalizedHeader("cache-control", &header));
890 EXPECT_EQ("private", header); 894 EXPECT_EQ("private", header);
891 895
892 header.clear(); 896 header.clear();
893 EXPECT_TRUE(headers->GetNormalizedHeader("content-type", &header)); 897 EXPECT_TRUE(headers->GetNormalizedHeader("content-type", &header));
894 EXPECT_EQ("text/html; charset=ISO-8859-1", header); 898 EXPECT_EQ("text/html; charset=ISO-8859-1", header);
895 899
896 // The response has two "X-Multiple-Entries" headers. 900 // The response has two "X-Multiple-Entries" headers.
897 // This verfies our output has them concatenated together. 901 // This verfies our output has them concatenated together.
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after
2262 TEST_F(URLRequestTestHTTP, OverrideAcceptCharset) { 2266 TEST_F(URLRequestTestHTTP, OverrideAcceptCharset) {
2263 ASSERT_TRUE(NULL != server_.get()); 2267 ASSERT_TRUE(NULL != server_.get());
2264 TestDelegate d; 2268 TestDelegate d;
2265 TestURLRequest req(server_->TestServerPage("echoheader?Accept-Charset"), &d); 2269 TestURLRequest req(server_->TestServerPage("echoheader?Accept-Charset"), &d);
2266 req.set_context(new URLRequestTestContext()); 2270 req.set_context(new URLRequestTestContext());
2267 req.SetExtraRequestHeaders("Accept-Charset: koi-8r"); 2271 req.SetExtraRequestHeaders("Accept-Charset: koi-8r");
2268 req.Start(); 2272 req.Start();
2269 MessageLoop::current()->Run(); 2273 MessageLoop::current()->Run();
2270 EXPECT_EQ(std::string("koi-8r"), d.data_received()); 2274 EXPECT_EQ(std::string("koi-8r"), d.data_received());
2271 } 2275 }
OLDNEW
« no previous file with comments | « net/url_request/url_request.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698