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

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

Issue 154473002: Support redirectUrl at onHeadersReceived in WebRequest / DWR API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix WebRequestRulesRegistrySimpleTest.StageChecker test Created 6 years, 9 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/url_request/url_request_test_util.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 #endif 10 #endif
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 GURL* new_url) OVERRIDE; 361 GURL* new_url) OVERRIDE;
362 362
363 virtual int OnBeforeSendHeaders(URLRequest* request, 363 virtual int OnBeforeSendHeaders(URLRequest* request,
364 const CompletionCallback& callback, 364 const CompletionCallback& callback,
365 HttpRequestHeaders* headers) OVERRIDE; 365 HttpRequestHeaders* headers) OVERRIDE;
366 366
367 virtual int OnHeadersReceived( 367 virtual int OnHeadersReceived(
368 URLRequest* request, 368 URLRequest* request,
369 const CompletionCallback& callback, 369 const CompletionCallback& callback,
370 const HttpResponseHeaders* original_response_headers, 370 const HttpResponseHeaders* original_response_headers,
371 scoped_refptr<HttpResponseHeaders>* override_response_headers) OVERRIDE; 371 scoped_refptr<HttpResponseHeaders>* override_response_headers,
372 GURL* allowed_unsafe_redirect_url) OVERRIDE;
372 373
373 virtual NetworkDelegate::AuthRequiredResponse OnAuthRequired( 374 virtual NetworkDelegate::AuthRequiredResponse OnAuthRequired(
374 URLRequest* request, 375 URLRequest* request,
375 const AuthChallengeInfo& auth_info, 376 const AuthChallengeInfo& auth_info,
376 const AuthCallback& callback, 377 const AuthCallback& callback,
377 AuthCredentials* credentials) OVERRIDE; 378 AuthCredentials* credentials) OVERRIDE;
378 379
379 // Resets the callbacks and |stage_blocked_for_callback_|. 380 // Resets the callbacks and |stage_blocked_for_callback_|.
380 void Reset(); 381 void Reset();
381 382
382 // Checks whether we should block in |stage|. If yes, returns an error code 383 // Checks whether we should block in |stage|. If yes, returns an error code
383 // and optionally sets up callback based on |block_mode_|. If no, returns OK. 384 // and optionally sets up callback based on |block_mode_|. If no, returns OK.
384 int MaybeBlockStage(Stage stage, const CompletionCallback& callback); 385 int MaybeBlockStage(Stage stage, const CompletionCallback& callback);
385 386
386 // Configuration parameters, can be adjusted by public methods: 387 // Configuration parameters, can be adjusted by public methods:
387 const BlockMode block_mode_; 388 const BlockMode block_mode_;
388 389
389 // Values returned on blocking stages when mode is SYNCHRONOUS or 390 // Values returned on blocking stages when mode is SYNCHRONOUS or
390 // AUTO_CALLBACK. For USER_CALLBACK these are set automatically to IO_PENDING. 391 // AUTO_CALLBACK. For USER_CALLBACK these are set automatically to IO_PENDING.
391 int retval_; // To be returned in non-auth stages. 392 int retval_; // To be returned in non-auth stages.
392 AuthRequiredResponse auth_retval_; 393 AuthRequiredResponse auth_retval_;
393 394
394 GURL redirect_url_; // Used if non-empty. 395 GURL redirect_url_; // Used if non-empty during OnBeforeURLRequest.
395 int block_on_; // Bit mask: in which stages to block. 396 int block_on_; // Bit mask: in which stages to block.
396 397
397 // |auth_credentials_| will be copied to |*target_auth_credential_| on 398 // |auth_credentials_| will be copied to |*target_auth_credential_| on
398 // callback. 399 // callback.
399 AuthCredentials auth_credentials_; 400 AuthCredentials auth_credentials_;
400 AuthCredentials* target_auth_credentials_; 401 AuthCredentials* target_auth_credentials_;
401 402
402 // Internal variables, not set by not the user: 403 // Internal variables, not set by not the user:
403 // Last blocked stage waiting for user callback (unused if |block_mode_| != 404 // Last blocked stage waiting for user callback (unused if |block_mode_| !=
404 // USER_CALLBACK). 405 // USER_CALLBACK).
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 HttpRequestHeaders* headers) { 477 HttpRequestHeaders* headers) {
477 TestNetworkDelegate::OnBeforeSendHeaders(request, callback, headers); 478 TestNetworkDelegate::OnBeforeSendHeaders(request, callback, headers);
478 479
479 return MaybeBlockStage(ON_BEFORE_SEND_HEADERS, callback); 480 return MaybeBlockStage(ON_BEFORE_SEND_HEADERS, callback);
480 } 481 }
481 482
482 int BlockingNetworkDelegate::OnHeadersReceived( 483 int BlockingNetworkDelegate::OnHeadersReceived(
483 URLRequest* request, 484 URLRequest* request,
484 const CompletionCallback& callback, 485 const CompletionCallback& callback,
485 const HttpResponseHeaders* original_response_headers, 486 const HttpResponseHeaders* original_response_headers,
486 scoped_refptr<HttpResponseHeaders>* override_response_headers) { 487 scoped_refptr<HttpResponseHeaders>* override_response_headers,
487 TestNetworkDelegate::OnHeadersReceived( 488 GURL* allowed_unsafe_redirect_url) {
488 request, callback, original_response_headers, 489 TestNetworkDelegate::OnHeadersReceived(request,
489 override_response_headers); 490 callback,
491 original_response_headers,
492 override_response_headers,
493 allowed_unsafe_redirect_url);
490 494
491 return MaybeBlockStage(ON_HEADERS_RECEIVED, callback); 495 return MaybeBlockStage(ON_HEADERS_RECEIVED, callback);
492 } 496 }
493 497
494 NetworkDelegate::AuthRequiredResponse BlockingNetworkDelegate::OnAuthRequired( 498 NetworkDelegate::AuthRequiredResponse BlockingNetworkDelegate::OnAuthRequired(
495 URLRequest* request, 499 URLRequest* request,
496 const AuthChallengeInfo& auth_info, 500 const AuthChallengeInfo& auth_info,
497 const AuthCallback& callback, 501 const AuthCallback& callback,
498 AuthCredentials* credentials) { 502 AuthCredentials* credentials) {
499 TestNetworkDelegate::OnAuthRequired(request, auth_info, callback, 503 TestNetworkDelegate::OnAuthRequired(request, auth_info, callback,
(...skipping 1910 matching lines...) Expand 10 before | Expand all | Expand 10 after
2410 public: 2414 public:
2411 explicit FixedDateNetworkDelegate(const std::string& fixed_date) 2415 explicit FixedDateNetworkDelegate(const std::string& fixed_date)
2412 : fixed_date_(fixed_date) {} 2416 : fixed_date_(fixed_date) {}
2413 virtual ~FixedDateNetworkDelegate() {} 2417 virtual ~FixedDateNetworkDelegate() {}
2414 2418
2415 // net::NetworkDelegate implementation 2419 // net::NetworkDelegate implementation
2416 virtual int OnHeadersReceived( 2420 virtual int OnHeadersReceived(
2417 net::URLRequest* request, 2421 net::URLRequest* request,
2418 const net::CompletionCallback& callback, 2422 const net::CompletionCallback& callback,
2419 const net::HttpResponseHeaders* original_response_headers, 2423 const net::HttpResponseHeaders* original_response_headers,
2420 scoped_refptr<net::HttpResponseHeaders>* override_response_headers) 2424 scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
2421 OVERRIDE; 2425 GURL* allowed_unsafe_redirect_url) OVERRIDE;
2422 2426
2423 private: 2427 private:
2424 std::string fixed_date_; 2428 std::string fixed_date_;
2425 2429
2426 DISALLOW_COPY_AND_ASSIGN(FixedDateNetworkDelegate); 2430 DISALLOW_COPY_AND_ASSIGN(FixedDateNetworkDelegate);
2427 }; 2431 };
2428 2432
2429 int FixedDateNetworkDelegate::OnHeadersReceived( 2433 int FixedDateNetworkDelegate::OnHeadersReceived(
2430 net::URLRequest* request, 2434 net::URLRequest* request,
2431 const net::CompletionCallback& callback, 2435 const net::CompletionCallback& callback,
2432 const net::HttpResponseHeaders* original_response_headers, 2436 const net::HttpResponseHeaders* original_response_headers,
2433 scoped_refptr<net::HttpResponseHeaders>* override_response_headers) { 2437 scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
2438 GURL* allowed_unsafe_redirect_url) {
2434 net::HttpResponseHeaders* new_response_headers = 2439 net::HttpResponseHeaders* new_response_headers =
2435 new net::HttpResponseHeaders(original_response_headers->raw_headers()); 2440 new net::HttpResponseHeaders(original_response_headers->raw_headers());
2436 2441
2437 new_response_headers->RemoveHeader("Date"); 2442 new_response_headers->RemoveHeader("Date");
2438 new_response_headers->AddHeader("Date: " + fixed_date_); 2443 new_response_headers->AddHeader("Date: " + fixed_date_);
2439 2444
2440 *override_response_headers = new_response_headers; 2445 *override_response_headers = new_response_headers;
2441 return TestNetworkDelegate::OnHeadersReceived(request, 2446 return TestNetworkDelegate::OnHeadersReceived(request,
2442 callback, 2447 callback,
2443 original_response_headers, 2448 original_response_headers,
2444 override_response_headers); 2449 override_response_headers,
2450 allowed_unsafe_redirect_url);
2445 } 2451 }
2446 2452
2447 // Test that cookie expiration times are adjusted for server/client clock 2453 // Test that cookie expiration times are adjusted for server/client clock
2448 // skew and that we handle incorrect timezone specifier "UTC" in HTTP Date 2454 // skew and that we handle incorrect timezone specifier "UTC" in HTTP Date
2449 // headers by defaulting to GMT. (crbug.com/135131) 2455 // headers by defaulting to GMT. (crbug.com/135131)
2450 TEST_F(URLRequestTest, AcceptClockSkewCookieWithWrongDateTimezone) { 2456 TEST_F(URLRequestTest, AcceptClockSkewCookieWithWrongDateTimezone) {
2451 LocalHttpTestServer test_server; 2457 LocalHttpTestServer test_server;
2452 ASSERT_TRUE(test_server.Start()); 2458 ASSERT_TRUE(test_server.Start());
2453 2459
2454 // Set up an expired cookie. 2460 // Set up an expired cookie.
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
3001 EXPECT_EQ(original_url, r.original_url()); 3007 EXPECT_EQ(original_url, r.original_url());
3002 EXPECT_EQ(2U, r.url_chain().size()); 3008 EXPECT_EQ(2U, r.url_chain().size());
3003 EXPECT_EQ(1, network_delegate.created_requests()); 3009 EXPECT_EQ(1, network_delegate.created_requests());
3004 EXPECT_EQ(0, network_delegate.destroyed_requests()); 3010 EXPECT_EQ(0, network_delegate.destroyed_requests());
3005 EXPECT_EQ("POST", r.method()); 3011 EXPECT_EQ("POST", r.method());
3006 EXPECT_EQ(kData, d.data_received()); 3012 EXPECT_EQ(kData, d.data_received());
3007 } 3013 }
3008 EXPECT_EQ(1, network_delegate.destroyed_requests()); 3014 EXPECT_EQ(1, network_delegate.destroyed_requests());
3009 } 3015 }
3010 3016
3017 // Tests that the network delegate can block and redirect a request to a new
3018 // URL during OnHeadersReceived.
3019 TEST_F(URLRequestTestHTTP, NetworkDelegateRedirectRequestOnHeadersReceived) {
3020 ASSERT_TRUE(test_server_.Start());
3021
3022 TestDelegate d;
3023 BlockingNetworkDelegate network_delegate(
3024 BlockingNetworkDelegate::AUTO_CALLBACK);
3025 network_delegate.set_block_on(BlockingNetworkDelegate::ON_HEADERS_RECEIVED);
3026 GURL redirect_url(test_server_.GetURL("simple.html"));
3027 network_delegate.set_redirect_on_headers_received_url(redirect_url);
3028
3029 TestURLRequestContextWithProxy context(
3030 test_server_.host_port_pair().ToString(), &network_delegate);
3031
3032 {
3033 GURL original_url(test_server_.GetURL("empty.html"));
3034 URLRequest r(original_url, DEFAULT_PRIORITY, &d, &context);
3035
3036 r.Start();
3037 base::RunLoop().Run();
3038
3039 EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status());
3040 EXPECT_EQ(net::OK, r.status().error());
3041 EXPECT_EQ(redirect_url, r.url());
3042 EXPECT_EQ(original_url, r.original_url());
3043 EXPECT_EQ(2U, r.url_chain().size());
3044 EXPECT_EQ(2, network_delegate.created_requests());
3045 EXPECT_EQ(0, network_delegate.destroyed_requests());
3046 }
3047 EXPECT_EQ(1, network_delegate.destroyed_requests());
3048 }
3049
3011 // Tests that the network delegate can synchronously complete OnAuthRequired 3050 // Tests that the network delegate can synchronously complete OnAuthRequired
3012 // by taking no action. This indicates that the NetworkDelegate does not want to 3051 // by taking no action. This indicates that the NetworkDelegate does not want to
3013 // handle the challenge, and is passing the buck along to the 3052 // handle the challenge, and is passing the buck along to the
3014 // URLRequest::Delegate. 3053 // URLRequest::Delegate.
3015 TEST_F(URLRequestTestHTTP, NetworkDelegateOnAuthRequiredSyncNoAction) { 3054 TEST_F(URLRequestTestHTTP, NetworkDelegateOnAuthRequiredSyncNoAction) {
3016 ASSERT_TRUE(test_server_.Start()); 3055 ASSERT_TRUE(test_server_.Start());
3017 3056
3018 TestDelegate d; 3057 TestDelegate d;
3019 BlockingNetworkDelegate network_delegate( 3058 BlockingNetworkDelegate network_delegate(
3020 BlockingNetworkDelegate::SYNCHRONOUS); 3059 BlockingNetworkDelegate::SYNCHRONOUS);
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
3913 const CompletionCallback& callback, 3952 const CompletionCallback& callback,
3914 HttpRequestHeaders* headers) OVERRIDE { 3953 HttpRequestHeaders* headers) OVERRIDE {
3915 TestNetworkDelegate::OnBeforeSendHeaders(request, callback, headers); 3954 TestNetworkDelegate::OnBeforeSendHeaders(request, callback, headers);
3916 return RunCallbackAsynchronously(request, callback); 3955 return RunCallbackAsynchronously(request, callback);
3917 } 3956 }
3918 3957
3919 virtual int OnHeadersReceived( 3958 virtual int OnHeadersReceived(
3920 URLRequest* request, 3959 URLRequest* request,
3921 const CompletionCallback& callback, 3960 const CompletionCallback& callback,
3922 const HttpResponseHeaders* original_response_headers, 3961 const HttpResponseHeaders* original_response_headers,
3923 scoped_refptr<HttpResponseHeaders>* override_response_headers) OVERRIDE { 3962 scoped_refptr<HttpResponseHeaders>* override_response_headers,
3924 TestNetworkDelegate::OnHeadersReceived(request, callback, 3963 GURL* allowed_unsafe_redirect_url) OVERRIDE {
3964 TestNetworkDelegate::OnHeadersReceived(request,
3965 callback,
3925 original_response_headers, 3966 original_response_headers,
3926 override_response_headers); 3967 override_response_headers,
3968 allowed_unsafe_redirect_url);
3927 return RunCallbackAsynchronously(request, callback); 3969 return RunCallbackAsynchronously(request, callback);
3928 } 3970 }
3929 3971
3930 virtual NetworkDelegate::AuthRequiredResponse OnAuthRequired( 3972 virtual NetworkDelegate::AuthRequiredResponse OnAuthRequired(
3931 URLRequest* request, 3973 URLRequest* request,
3932 const AuthChallengeInfo& auth_info, 3974 const AuthChallengeInfo& auth_info,
3933 const AuthCallback& callback, 3975 const AuthCallback& callback,
3934 AuthCredentials* credentials) OVERRIDE { 3976 AuthCredentials* credentials) OVERRIDE {
3935 AsyncDelegateLogger::Run( 3977 AsyncDelegateLogger::Run(
3936 request, 3978 request,
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after
5228 req.Start(); 5270 req.Start();
5229 base::RunLoop().Run(); 5271 base::RunLoop().Run();
5230 5272
5231 EXPECT_EQ(URLRequestStatus::SUCCESS, req.status().status()); 5273 EXPECT_EQ(URLRequestStatus::SUCCESS, req.status().status());
5232 EXPECT_FALSE(req.was_cached()); 5274 EXPECT_FALSE(req.was_cached());
5233 EXPECT_EQ(0, d.received_redirect_count()); 5275 EXPECT_EQ(0, d.received_redirect_count());
5234 EXPECT_EQ(initial_url, req.url()); 5276 EXPECT_EQ(initial_url, req.url());
5235 } 5277 }
5236 } 5278 }
5237 5279
5280 // Tests that redirection to an unsafe URL is allowed when it has been marked as
5281 // safe.
5282 TEST_F(URLRequestTestHTTP, UnsafeRedirectToWhitelistedUnsafeURL) {
5283 ASSERT_TRUE(test_server_.Start());
5284
5285 GURL unsafe_url("data:text/html,this-is-considered-an-unsafe-url");
5286 default_network_delegate_.set_redirect_on_headers_received_url(unsafe_url);
5287 default_network_delegate_.set_allowed_unsafe_redirect_url(unsafe_url);
5288
5289 TestDelegate d;
5290 {
5291 URLRequest r(test_server_.GetURL("whatever"),
5292 DEFAULT_PRIORITY,
5293 &d,
5294 &default_context_);
5295
5296 r.Start();
5297 base::RunLoop().Run();
5298
5299 EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status());
5300
5301 EXPECT_EQ(2U, r.url_chain().size());
5302 EXPECT_EQ(net::OK, r.status().error());
5303 EXPECT_EQ(unsafe_url, r.url());
5304 EXPECT_EQ("this-is-considered-an-unsafe-url", d.data_received());
5305 }
5306 }
5307
5308 // Tests that a redirect to a different unsafe URL is blocked, even after adding
5309 // some other URL to the whitelist.
5310 TEST_F(URLRequestTestHTTP, UnsafeRedirectToDifferentUnsafeURL) {
5311 ASSERT_TRUE(test_server_.Start());
5312
5313 GURL unsafe_url("data:text/html,something");
5314 GURL different_unsafe_url("data:text/html,something-else");
5315 default_network_delegate_.set_redirect_on_headers_received_url(unsafe_url);
5316 default_network_delegate_.set_allowed_unsafe_redirect_url(
5317 different_unsafe_url);
5318
5319 TestDelegate d;
5320 {
5321 URLRequest r(test_server_.GetURL("whatever"),
5322 DEFAULT_PRIORITY,
5323 &d,
5324 &default_context_);
5325
5326 r.Start();
5327 base::RunLoop().Run();
5328
5329 EXPECT_EQ(URLRequestStatus::FAILED, r.status().status());
5330 EXPECT_EQ(ERR_UNSAFE_REDIRECT, r.status().error());
5331 }
5332 }
5333
5334 // Redirects from an URL with fragment to an unsafe URL without fragment should
5335 // be allowed.
5336 TEST_F(URLRequestTestHTTP, UnsafeRedirectWithReferenceFragment) {
5337 ASSERT_TRUE(test_server_.Start());
5338
5339 GURL original_url(test_server_.GetURL("original#fragment"));
5340 GURL unsafe_url("data:,url-marked-safe-and-used-in-redirect");
5341 GURL expected_url("data:,url-marked-safe-and-used-in-redirect#fragment");
5342
5343 default_network_delegate_.set_redirect_on_headers_received_url(unsafe_url);
5344 default_network_delegate_.set_allowed_unsafe_redirect_url(unsafe_url);
5345
5346 TestDelegate d;
5347 {
5348 URLRequest r(original_url, DEFAULT_PRIORITY, &d, &default_context_);
5349
5350 r.Start();
5351 base::RunLoop().Run();
5352
5353 EXPECT_EQ(2U, r.url_chain().size());
5354 EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status());
5355 EXPECT_EQ(net::OK, r.status().error());
5356 EXPECT_EQ(original_url, r.original_url());
5357 EXPECT_EQ(expected_url, r.url());
5358 }
5359 }
5360
5361 // Redirects from an URL with fragment to an unsafe URL with fragment should
5362 // be allowed, and the reference fragment of the target URL should be preserved.
5363 TEST_F(URLRequestTestHTTP, UnsafeRedirectWithDifferentReferenceFragment) {
5364 ASSERT_TRUE(test_server_.Start());
5365
5366 GURL original_url(test_server_.GetURL("original#fragment1"));
5367 GURL unsafe_url("data:,url-marked-safe-and-used-in-redirect#fragment2");
5368 GURL expected_url("data:,url-marked-safe-and-used-in-redirect#fragment2");
5369
5370 default_network_delegate_.set_redirect_on_headers_received_url(unsafe_url);
5371 default_network_delegate_.set_allowed_unsafe_redirect_url(unsafe_url);
5372
5373 TestDelegate d;
5374 {
5375 URLRequest r(original_url, DEFAULT_PRIORITY, &d, &default_context_);
5376
5377 r.Start();
5378 base::RunLoop().Run();
5379
5380 EXPECT_EQ(2U, r.url_chain().size());
5381 EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status());
5382 EXPECT_EQ(net::OK, r.status().error());
5383 EXPECT_EQ(original_url, r.original_url());
5384 EXPECT_EQ(expected_url, r.url());
5385 }
5386 }
5387
5388 // When a delegate has specified a safe redirect URL, but it does not match the
5389 // redirect target, then do not prevent the reference fragment from being added.
5390 TEST_F(URLRequestTestHTTP, RedirectWithReferenceFragment) {
5391 ASSERT_TRUE(test_server_.Start());
5392
5393 GURL original_url(test_server_.GetURL("original#expected-fragment"));
5394 GURL unsafe_url("data:text/html,this-url-does-not-match-redirect-url");
5395 GURL redirect_url(test_server_.GetURL("target"));
5396 GURL expected_redirect_url(test_server_.GetURL("target#expected-fragment"));
5397
5398 default_network_delegate_.set_redirect_on_headers_received_url(redirect_url);
5399 default_network_delegate_.set_allowed_unsafe_redirect_url(unsafe_url);
5400
5401 TestDelegate d;
5402 {
5403 URLRequest r(original_url, DEFAULT_PRIORITY, &d, &default_context_);
5404
5405 r.Start();
5406 base::RunLoop().Run();
5407
5408 EXPECT_EQ(2U, r.url_chain().size());
5409 EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status());
5410 EXPECT_EQ(net::OK, r.status().error());
5411 EXPECT_EQ(original_url, r.original_url());
5412 EXPECT_EQ(expected_redirect_url, r.url());
5413 }
5414 }
5415
5238 TEST_F(URLRequestTestHTTP, NoUserPassInReferrer) { 5416 TEST_F(URLRequestTestHTTP, NoUserPassInReferrer) {
5239 ASSERT_TRUE(test_server_.Start()); 5417 ASSERT_TRUE(test_server_.Start());
5240 5418
5241 TestDelegate d; 5419 TestDelegate d;
5242 URLRequest req(test_server_.GetURL("echoheader?Referer"), 5420 URLRequest req(test_server_.GetURL("echoheader?Referer"),
5243 DEFAULT_PRIORITY, 5421 DEFAULT_PRIORITY,
5244 &d, 5422 &d,
5245 &default_context_); 5423 &default_context_);
5246 req.SetReferrer("http://user:pass@foo.com/"); 5424 req.SetReferrer("http://user:pass@foo.com/");
5247 req.Start(); 5425 req.Start();
(...skipping 2491 matching lines...) Expand 10 before | Expand all | Expand 10 after
7739 7917
7740 EXPECT_FALSE(r.is_pending()); 7918 EXPECT_FALSE(r.is_pending());
7741 EXPECT_EQ(1, d->response_started_count()); 7919 EXPECT_EQ(1, d->response_started_count());
7742 EXPECT_FALSE(d->received_data_before_response()); 7920 EXPECT_FALSE(d->received_data_before_response());
7743 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); 7921 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size));
7744 } 7922 }
7745 } 7923 }
7746 #endif // !defined(DISABLE_FTP_SUPPORT) 7924 #endif // !defined(DISABLE_FTP_SUPPORT)
7747 7925
7748 } // namespace net 7926 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_test_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698