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

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

Issue 769043003: Sanitize headers in Proxy Authentication Required responses (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rearrange some things Created 6 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
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 "net/http/http_proxy_client_socket_pool.h" 5 #include "net/http/http_proxy_client_socket_pool.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 EXPECT_FALSE(handle_.is_initialized()); 422 EXPECT_FALSE(handle_.is_initialized());
423 EXPECT_FALSE(handle_.socket()); 423 EXPECT_FALSE(handle_.socket());
424 424
425 data_->RunFor(GetParam().proxy_type == SPDY ? 2 : 4); 425 data_->RunFor(GetParam().proxy_type == SPDY ? 2 : 4);
426 rv = callback_.WaitForResult(); 426 rv = callback_.WaitForResult();
427 EXPECT_EQ(ERR_PROXY_AUTH_REQUESTED, rv); 427 EXPECT_EQ(ERR_PROXY_AUTH_REQUESTED, rv);
428 EXPECT_TRUE(handle_.is_initialized()); 428 EXPECT_TRUE(handle_.is_initialized());
429 ASSERT_TRUE(handle_.socket()); 429 ASSERT_TRUE(handle_.socket());
430 ProxyClientSocket* tunnel_socket = 430 ProxyClientSocket* tunnel_socket =
431 static_cast<ProxyClientSocket*>(handle_.socket()); 431 static_cast<ProxyClientSocket*>(handle_.socket());
432 EXPECT_FALSE(tunnel_socket->IsConnected());
432 if (GetParam().proxy_type == SPDY) { 433 if (GetParam().proxy_type == SPDY) {
433 EXPECT_TRUE(tunnel_socket->IsConnected());
434 EXPECT_TRUE(tunnel_socket->IsUsingSpdy()); 434 EXPECT_TRUE(tunnel_socket->IsUsingSpdy());
435 } else { 435 } else {
436 EXPECT_FALSE(tunnel_socket->IsConnected());
437 EXPECT_FALSE(tunnel_socket->IsUsingSpdy()); 436 EXPECT_FALSE(tunnel_socket->IsUsingSpdy());
438 } 437 }
439 } 438 }
440 439
441 TEST_P(HttpProxyClientSocketPoolTest, HaveAuth) { 440 TEST_P(HttpProxyClientSocketPoolTest, HaveAuth) {
442 // It's pretty much impossible to make the SPDY case behave synchronously 441 // It's pretty much impossible to make the SPDY case behave synchronously
443 // so we skip this test for SPDY 442 // so we skip this test for SPDY
444 if (GetParam().proxy_type == SPDY) 443 if (GetParam().proxy_type == SPDY)
445 return; 444 return;
446 std::string proxy_host_port = 445 std::string proxy_host_port =
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 EXPECT_TRUE(headers->IsRedirect(&location)); 840 EXPECT_TRUE(headers->IsRedirect(&location));
842 EXPECT_EQ(location, redirectTarget); 841 EXPECT_EQ(location, redirectTarget);
843 } 842 }
844 } 843 }
845 844
846 // It would be nice to also test the timeouts in HttpProxyClientSocketPool. 845 // It would be nice to also test the timeouts in HttpProxyClientSocketPool.
847 846
848 } // namespace 847 } // namespace
849 848
850 } // namespace net 849 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698