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

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

Issue 486015: If we redirect from an https to an http site, ensure that we don't... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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.cc ('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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 EXPECT_TRUE(r.is_pending()); 235 EXPECT_TRUE(r.is_pending());
236 236
237 MessageLoop::current()->Run(); 237 MessageLoop::current()->Run();
238 238
239 EXPECT_EQ(1, d.response_started_count()); 239 EXPECT_EQ(1, d.response_started_count());
240 EXPECT_FALSE(d.received_data_before_response()); 240 EXPECT_FALSE(d.received_data_before_response());
241 EXPECT_NE(0, d.bytes_received()); 241 EXPECT_NE(0, d.bytes_received());
242 } 242 }
243 } 243 }
244 244
245 TEST_F(URLRequestTestHTTP, HTTPSToHTTPRedirectNoRefererTest) {
246 scoped_refptr<HTTPSTestServer> https_server =
247 HTTPSTestServer::CreateGoodServer(L"net/data/ssl/");
248 ASSERT_TRUE(NULL != https_server.get());
249 ASSERT_TRUE(NULL != server_.get());
250
251 // An https server is sent a request with an https referer,
252 // and responds with a redirect to an http url. The http
253 // server should not be sent the referer.
254 GURL http_destination = server_->TestServerPage("");
255 TestDelegate d;
256 TestURLRequest req(https_server->TestServerPage(
257 "server-redirect?" + http_destination.spec()), &d);
258 req.set_referrer("https://www.referrer.com/");
259 req.Start();
260 MessageLoop::current()->Run();
261
262 EXPECT_EQ(1, d.response_started_count());
263 EXPECT_EQ(1, d.received_redirect_count());
264 EXPECT_EQ(http_destination, req.url());
265 EXPECT_EQ(std::string(""), req.referrer());
darin (slow to review) 2009/12/15 21:06:16 nit: just use std::string() here.
266 }
267
245 TEST_F(URLRequestTest, QuitTest) { 268 TEST_F(URLRequestTest, QuitTest) {
246 // Don't use shared server here because we order it to quit. 269 // Don't use shared server here because we order it to quit.
247 // It would impact other tests. 270 // It would impact other tests.
248 scoped_refptr<HTTPTestServer> server = 271 scoped_refptr<HTTPTestServer> server =
249 HTTPTestServer::CreateServer(L"", NULL); 272 HTTPTestServer::CreateServer(L"", NULL);
250 ASSERT_TRUE(NULL != server.get()); 273 ASSERT_TRUE(NULL != server.get());
251 server->SendQuit(); 274 server->SendQuit();
252 EXPECT_TRUE(server->WaitToFinish(20000)); 275 EXPECT_TRUE(server->WaitToFinish(20000));
253 } 276 }
254 277
(...skipping 1910 matching lines...) Expand 10 before | Expand all | Expand 10 after
2165 ASSERT_TRUE(NULL != server_.get()); 2188 ASSERT_TRUE(NULL != server_.get());
2166 TestDelegate d; 2189 TestDelegate d;
2167 TestURLRequest 2190 TestURLRequest
2168 req(server_->TestServerPage("echoheaderoverride?Accept-Charset"), &d); 2191 req(server_->TestServerPage("echoheaderoverride?Accept-Charset"), &d);
2169 req.set_context(new URLRequestTestContext()); 2192 req.set_context(new URLRequestTestContext());
2170 req.SetExtraRequestHeaders("Accept-Charset: koi-8r"); 2193 req.SetExtraRequestHeaders("Accept-Charset: koi-8r");
2171 req.Start(); 2194 req.Start();
2172 MessageLoop::current()->Run(); 2195 MessageLoop::current()->Run();
2173 EXPECT_EQ(std::string("koi-8r"), d.data_received()); 2196 EXPECT_EQ(std::string("koi-8r"), d.data_received());
2174 } 2197 }
OLDNEW
« no previous file with comments | « net/url_request/url_request.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698