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 | 6 |
7 #include "net/log/net_log_capture_mode.h" | |
8 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
9 | 8 |
10 namespace net { | 9 namespace net { |
11 | 10 |
12 TEST(HttpLogUtilTest, ElideHeaderValueForNetLog) { | 11 TEST(HttpLogUtilTest, ElideHeaderValueForNetLog) { |
13 // Only elide for appropriate log level. | 12 // Only elide for appropriate log level. |
14 EXPECT_EQ("[10 bytes were stripped]", | 13 EXPECT_EQ("[10 bytes were stripped]", |
15 ElideHeaderValueForNetLog(NetLogCaptureMode::Default(), "Cookie", | 14 ElideHeaderValueForNetLog(NetLogCaptureMode::Default(), "Cookie", |
16 "name=value")); | 15 "name=value")); |
17 EXPECT_EQ("name=value", ElideHeaderValueForNetLog( | 16 EXPECT_EQ("name=value", ElideHeaderValueForNetLog( |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 EXPECT_EQ("NTLM [4 bytes were stripped]", | 62 EXPECT_EQ("NTLM [4 bytes were stripped]", |
64 ElideHeaderValueForNetLog(NetLogCaptureMode::Default(), | 63 ElideHeaderValueForNetLog(NetLogCaptureMode::Default(), |
65 "Proxy-Authenticate", "NTLM 1234")); | 64 "Proxy-Authenticate", "NTLM 1234")); |
66 | 65 |
67 // Leave whitespace intact. | 66 // Leave whitespace intact. |
68 EXPECT_EQ("NTLM [4 bytes were stripped] ", | 67 EXPECT_EQ("NTLM [4 bytes were stripped] ", |
69 ElideHeaderValueForNetLog(NetLogCaptureMode::Default(), | 68 ElideHeaderValueForNetLog(NetLogCaptureMode::Default(), |
70 "WWW-Authenticate", "NTLM 1234 ")); | 69 "WWW-Authenticate", "NTLM 1234 ")); |
71 } | 70 } |
72 | 71 |
73 TEST(HttpLogUtilTest, ElideGoAwayDebugDataForNetLog) { | 72 } // namespace net |
74 // Only elide for appropriate log level. | |
75 EXPECT_EQ( | |
76 "[6 bytes were stripped]", | |
77 ElideGoAwayDebugDataForNetLog(NetLogCaptureMode::Default(), "foobar")); | |
78 EXPECT_EQ("foobar", | |
79 ElideGoAwayDebugDataForNetLog( | |
80 NetLogCaptureMode::IncludeCookiesAndCredentials(), "foobar")); | |
81 } | |
82 | |
83 } // namspace net | |
OLD | NEW |