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

Unified Diff: net/http/http_log_util_unittest.cc

Issue 202113005: Fix HttpLogUtilTest.ElideHeaderValueForNetLog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cut down on redundancy 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_log_util_unittest.cc
diff --git a/net/http/http_log_util_unittest.cc b/net/http/http_log_util_unittest.cc
index 1b8cdf26609d72a4aee4a85c27beb131ff15a20e..1b0e9dbbfa255c403b181c760a47560532f4ee4e 100644
--- a/net/http/http_log_util_unittest.cc
+++ b/net/http/http_log_util_unittest.cc
@@ -25,9 +25,11 @@ TEST(HttpLogUtilTest, ElideHeaderValueForNetLog) {
net::NetLog::LOG_STRIP_PRIVATE_DATA, "Set-Cookie2", "name=value"));
EXPECT_EQ("[10 bytes were stripped]", ElideHeaderValueForNetLog(
net::NetLog::LOG_STRIP_PRIVATE_DATA, "Authorization", "Basic 1234"));
+#if !defined(SPDY_PROXY_AUTH_ORIGIN)
EXPECT_EQ("[10 bytes were stripped]", ElideHeaderValueForNetLog(
net::NetLog::LOG_STRIP_PRIVATE_DATA,
"Proxy-Authorization", "Basic 1234"));
+#endif
// Unknown headers should pass through.
EXPECT_EQ("value", ElideHeaderValueForNetLog(
@@ -40,28 +42,33 @@ TEST(HttpLogUtilTest, ElideHeaderValueForNetLog) {
EXPECT_EQ("Digest realm=test", ElideHeaderValueForNetLog(
net::NetLog::LOG_STRIP_PRIVATE_DATA,
"WWW-Authenticate", "Digest realm=test"));
+#if !defined(SPDY_PROXY_AUTH_ORIGIN)
EXPECT_EQ("Basic realm=test", ElideHeaderValueForNetLog(
net::NetLog::LOG_STRIP_PRIVATE_DATA,
"Proxy-Authenticate", "Basic realm=test"));
EXPECT_EQ("Digest realm=test", ElideHeaderValueForNetLog(
net::NetLog::LOG_STRIP_PRIVATE_DATA,
"Proxy-Authenticate", "Digest realm=test"));
+#endif
// Multi-round mechanisms partially elided.
EXPECT_EQ("NTLM [4 bytes were stripped]", ElideHeaderValueForNetLog(
net::NetLog::LOG_STRIP_PRIVATE_DATA, "WWW-Authenticate", "NTLM 1234"));
+#if !defined(SPDY_PROXY_AUTH_ORIGIN)
EXPECT_EQ("NTLM [4 bytes were stripped]", ElideHeaderValueForNetLog(
net::NetLog::LOG_STRIP_PRIVATE_DATA, "Proxy-Authenticate", "NTLM 1234"));
+#endif
// Leave whitespace intact.
EXPECT_EQ("NTLM [4 bytes were stripped] ", ElideHeaderValueForNetLog(
net::NetLog::LOG_STRIP_PRIVATE_DATA, "WWW-Authenticate", "NTLM 1234 "));
+ // Extra elisions for SPDY_PROXY_AUTH_ORIGIN.
#if defined(SPDY_PROXY_AUTH_ORIGIN)
EXPECT_EQ("[elided]", ElideHeaderValueForNetLog(
- net::NetLog::LOG_ALL_BUT_BYTES, "Proxy-Authorization", "Basic 1234"));
-#else
- EXPECT_EQ("Basic 1234", ElideHeaderValueForNetLog(
+ net::NetLog::LOG_ALL_BUT_BYTES,
+ "Proxy-Authenticate", "Basic realm=test"));
+ EXPECT_EQ("[elided]", ElideHeaderValueForNetLog(
net::NetLog::LOG_ALL_BUT_BYTES, "Proxy-Authorization", "Basic 1234"));
#endif
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698