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

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: Fix content_shell build. 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
« no previous file with comments | « net/http/http_auth_controller.cc ('k') | net/url_request/url_request_ftp_job.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8f59f36108f6e925a529b6d320dd1d856b274ba9..7486324cc22a413ddb0c0cbb7253f75a011b7ef1 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -677,7 +677,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;
@@ -687,7 +687,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;
@@ -697,7 +707,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;
@@ -708,7 +718,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;
@@ -4697,7 +4707,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;
@@ -5391,7 +5401,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;
@@ -6972,8 +6982,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);
@@ -7946,7 +7956,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;
@@ -9888,7 +9898,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);
@@ -9906,7 +9916,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);
@@ -9925,7 +9935,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);
« no previous file with comments | « net/http/http_auth_controller.cc ('k') | net/url_request/url_request_ftp_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698