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

Unified Diff: net/http/http_network_transaction_unittest.cc

Issue 2067933002: Use correct origin when prompting for proxy authentication. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: net/http/http_network_transaction_unittest.cc
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index 4db194d3a51de74451c76934a0f9b10786768a41..7cafa6a8285c4624358134ab94574a737981c13e 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -666,7 +666,7 @@ bool CheckBasicServerAuth(const AuthChallengeInfo* auth_challenge) {
if (!auth_challenge)
return false;
EXPECT_FALSE(auth_challenge->is_proxy);
- EXPECT_EQ("www.example.org:80", auth_challenge->challenger.ToString());
+ EXPECT_EQ("http://www.example.org", auth_challenge->challenger.Serialize());
EXPECT_EQ("MyRealm1", auth_challenge->realm);
EXPECT_EQ(kBasicAuthScheme, auth_challenge->scheme);
return true;
@@ -676,7 +676,17 @@ bool CheckBasicProxyAuth(const AuthChallengeInfo* auth_challenge) {
if (!auth_challenge)
return false;
EXPECT_TRUE(auth_challenge->is_proxy);
- EXPECT_EQ("myproxy:70", auth_challenge->challenger.ToString());
+ EXPECT_EQ("http://myproxy:70", auth_challenge->challenger.Serialize());
+ EXPECT_EQ("MyRealm1", auth_challenge->realm);
+ EXPECT_EQ(kBasicAuthScheme, auth_challenge->scheme);
+ return true;
+}
+
+bool CheckBasicSecureProxyAuth(const AuthChallengeInfo* auth_challenge) {
+ if (!auth_challenge)
+ return false;
+ EXPECT_TRUE(auth_challenge->is_proxy);
+ EXPECT_EQ("https://myproxy:70", auth_challenge->challenger.Serialize());
EXPECT_EQ("MyRealm1", auth_challenge->realm);
EXPECT_EQ(kBasicAuthScheme, auth_challenge->scheme);
return true;
@@ -686,7 +696,7 @@ bool CheckDigestServerAuth(const AuthChallengeInfo* auth_challenge) {
if (!auth_challenge)
return false;
EXPECT_FALSE(auth_challenge->is_proxy);
- EXPECT_EQ("www.example.org:80", auth_challenge->challenger.ToString());
+ EXPECT_EQ("http://www.example.org", auth_challenge->challenger.Serialize());
EXPECT_EQ("digestive", auth_challenge->realm);
EXPECT_EQ(kDigestAuthScheme, auth_challenge->scheme);
return true;
@@ -697,7 +707,7 @@ bool CheckNTLMServerAuth(const AuthChallengeInfo* auth_challenge) {
if (!auth_challenge)
return false;
EXPECT_FALSE(auth_challenge->is_proxy);
- EXPECT_EQ("172.22.68.17:80", auth_challenge->challenger.ToString());
+ EXPECT_EQ("http://172.22.68.17", auth_challenge->challenger.Serialize());
EXPECT_EQ(std::string(), auth_challenge->realm);
EXPECT_EQ(kNtlmAuthScheme, auth_challenge->scheme);
return true;
@@ -4685,7 +4695,7 @@ TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithProxyAuth) {
ASSERT_TRUE(response->headers);
EXPECT_EQ(407, response->headers->response_code());
EXPECT_TRUE(response->was_fetched_via_spdy);
- EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get()));
+ EXPECT_TRUE(CheckBasicSecureProxyAuth(response->auth_challenge.get()));
TestCompletionCallback callback2;
@@ -5379,7 +5389,7 @@ TEST_P(HttpNetworkTransactionTest, HttpsProxyAuthRetry) {
ASSERT_TRUE(response->headers);
EXPECT_EQ(407, response->headers->response_code());
EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion());
- EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get()));
+ EXPECT_TRUE(CheckBasicSecureProxyAuth(response->auth_challenge.get()));
TestCompletionCallback callback2;
@@ -6960,8 +6970,8 @@ TEST_P(HttpNetworkTransactionTest, BasicAuthCacheAndPreauth) {
ASSERT_TRUE(response);
ASSERT_TRUE(response->auth_challenge);
EXPECT_FALSE(response->auth_challenge->is_proxy);
- EXPECT_EQ("www.example.org:80",
- response->auth_challenge->challenger.ToString());
+ EXPECT_EQ("http://www.example.org",
+ response->auth_challenge->challenger.Serialize());
EXPECT_EQ("MyRealm2", response->auth_challenge->realm);
EXPECT_EQ(kBasicAuthScheme, response->auth_challenge->scheme);
@@ -7934,7 +7944,7 @@ TEST_P(HttpNetworkTransactionTest, BasicAuthSpdyProxy) {
EXPECT_EQ(407, response->headers->response_code());
EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion());
EXPECT_TRUE(response->auth_challenge);
- EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get()));
+ EXPECT_TRUE(CheckBasicSecureProxyAuth(response->auth_challenge.get()));
TestCompletionCallback callback2;
@@ -9876,7 +9886,7 @@ TEST_P(HttpNetworkTransactionTest, ChangeAuthRealms) {
const AuthChallengeInfo* challenge = response->auth_challenge.get();
ASSERT_TRUE(challenge);
EXPECT_FALSE(challenge->is_proxy);
- EXPECT_EQ("www.example.org:80", challenge->challenger.ToString());
+ EXPECT_EQ("http://www.example.org", challenge->challenger.Serialize());
EXPECT_EQ("first_realm", challenge->realm);
EXPECT_EQ(kBasicAuthScheme, challenge->scheme);
@@ -9894,7 +9904,7 @@ TEST_P(HttpNetworkTransactionTest, ChangeAuthRealms) {
challenge = response->auth_challenge.get();
ASSERT_TRUE(challenge);
EXPECT_FALSE(challenge->is_proxy);
- EXPECT_EQ("www.example.org:80", challenge->challenger.ToString());
+ EXPECT_EQ("http://www.example.org", challenge->challenger.Serialize());
EXPECT_EQ("second_realm", challenge->realm);
EXPECT_EQ(kBasicAuthScheme, challenge->scheme);
@@ -9913,7 +9923,7 @@ TEST_P(HttpNetworkTransactionTest, ChangeAuthRealms) {
challenge = response->auth_challenge.get();
ASSERT_TRUE(challenge);
EXPECT_FALSE(challenge->is_proxy);
- EXPECT_EQ("www.example.org:80", challenge->challenger.ToString());
+ EXPECT_EQ("http://www.example.org", challenge->challenger.Serialize());
EXPECT_EQ("first_realm", challenge->realm);
EXPECT_EQ(kBasicAuthScheme, challenge->scheme);

Powered by Google App Engine
This is Rietveld 408576698