OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_log_util.h" | 5 #include "net/http/http_log_util.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 | 7 |
8 namespace net { | 8 namespace net { |
9 | 9 |
10 TEST(HttpLogUtilTest, ElideHeaderValueForNetLog) { | 10 TEST(HttpLogUtilTest, ElideHeaderValueForNetLog) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 // Multi-round mechanisms partially elided. | 47 // Multi-round mechanisms partially elided. |
48 EXPECT_EQ("NTLM [4 bytes were stripped]", ElideHeaderValueForNetLog( | 48 EXPECT_EQ("NTLM [4 bytes were stripped]", ElideHeaderValueForNetLog( |
49 NetLog::LOG_STRIP_PRIVATE_DATA, "WWW-Authenticate", "NTLM 1234")); | 49 NetLog::LOG_STRIP_PRIVATE_DATA, "WWW-Authenticate", "NTLM 1234")); |
50 EXPECT_EQ("NTLM [4 bytes were stripped]", ElideHeaderValueForNetLog( | 50 EXPECT_EQ("NTLM [4 bytes were stripped]", ElideHeaderValueForNetLog( |
51 NetLog::LOG_STRIP_PRIVATE_DATA, "Proxy-Authenticate", "NTLM 1234")); | 51 NetLog::LOG_STRIP_PRIVATE_DATA, "Proxy-Authenticate", "NTLM 1234")); |
52 | 52 |
53 // Leave whitespace intact. | 53 // Leave whitespace intact. |
54 EXPECT_EQ("NTLM [4 bytes were stripped] ", ElideHeaderValueForNetLog( | 54 EXPECT_EQ("NTLM [4 bytes were stripped] ", ElideHeaderValueForNetLog( |
55 NetLog::LOG_STRIP_PRIVATE_DATA, "WWW-Authenticate", "NTLM 1234 ")); | 55 NetLog::LOG_STRIP_PRIVATE_DATA, "WWW-Authenticate", "NTLM 1234 ")); |
56 | |
57 // Extra elisions for SPDY_PROXY_AUTH_ORIGIN. | |
58 #if defined(SPDY_PROXY_AUTH_ORIGIN) | |
59 EXPECT_EQ("ps=123, [7 bytes were stripped], c=foo, v=bar", | |
60 ElideHeaderValueForNetLog( | |
61 NetLog::LOG_STRIP_PRIVATE_DATA, | |
62 "Chrome-Proxy", "ps=123, sid=456, c=foo, v=bar")); | |
63 EXPECT_EQ("[7 bytes were stripped], ps=123, c=foo, v=bar", | |
64 ElideHeaderValueForNetLog( | |
65 NetLog::LOG_STRIP_PRIVATE_DATA, | |
66 "Chrome-Proxy", "sid=456, ps=123, c=foo, v=bar")); | |
67 EXPECT_EQ("ps=123, c=foo, v=bar, [7 bytes were stripped]", | |
68 ElideHeaderValueForNetLog( | |
69 NetLog::LOG_STRIP_PRIVATE_DATA, | |
70 "Chrome-Proxy", "ps=123, c=foo, v=bar, sid=456")); | |
71 #endif | |
72 } | 56 } |
73 | 57 |
74 } // namspace net | 58 } // namspace net |
OLD | NEW |