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

Side by Side Diff: net/http/http_log_util_unittest.cc

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « net/http/http_log_util.cc ('k') | net/http/http_network_layer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "net/http/http_log_util.h"
6 #include "testing/gtest/include/gtest/gtest.h"
7
8 namespace net {
9
10 TEST(HttpLogUtilTest, ElideHeaderValueForNetLog) {
11 // Only elide for appropriate log level.
12 EXPECT_EQ("[10 bytes were stripped]", ElideHeaderValueForNetLog(
13 NetLog::LOG_STRIP_PRIVATE_DATA, "Cookie", "name=value"));
14 EXPECT_EQ("name=value", ElideHeaderValueForNetLog(
15 NetLog::LOG_ALL_BUT_BYTES, "Cookie", "name=value"));
16
17 // Headers are compared case insensitively.
18 EXPECT_EQ("[10 bytes were stripped]", ElideHeaderValueForNetLog(
19 NetLog::LOG_STRIP_PRIVATE_DATA, "cOoKiE", "name=value"));
20
21 // These headers should be completely elided.
22 EXPECT_EQ("[10 bytes were stripped]", ElideHeaderValueForNetLog(
23 NetLog::LOG_STRIP_PRIVATE_DATA, "Set-Cookie", "name=value"));
24 EXPECT_EQ("[10 bytes were stripped]", ElideHeaderValueForNetLog(
25 NetLog::LOG_STRIP_PRIVATE_DATA, "Set-Cookie2", "name=value"));
26 EXPECT_EQ("[10 bytes were stripped]", ElideHeaderValueForNetLog(
27 NetLog::LOG_STRIP_PRIVATE_DATA, "Authorization", "Basic 1234"));
28 EXPECT_EQ("[10 bytes were stripped]", ElideHeaderValueForNetLog(
29 NetLog::LOG_STRIP_PRIVATE_DATA, "Proxy-Authorization", "Basic 1234"));
30
31 // Unknown headers should pass through.
32 EXPECT_EQ("value", ElideHeaderValueForNetLog(
33 NetLog::LOG_STRIP_PRIVATE_DATA, "Boring", "value"));
34
35 // Basic and Digest auth challenges are public.
36 EXPECT_EQ("Basic realm=test", ElideHeaderValueForNetLog(
37 NetLog::LOG_STRIP_PRIVATE_DATA, "WWW-Authenticate", "Basic realm=test"));
38 EXPECT_EQ("Digest realm=test", ElideHeaderValueForNetLog(
39 NetLog::LOG_STRIP_PRIVATE_DATA, "WWW-Authenticate", "Digest realm=test"));
40 EXPECT_EQ("Basic realm=test", ElideHeaderValueForNetLog(
41 NetLog::LOG_STRIP_PRIVATE_DATA,
42 "Proxy-Authenticate", "Basic realm=test"));
43 EXPECT_EQ("Digest realm=test", ElideHeaderValueForNetLog(
44 NetLog::LOG_STRIP_PRIVATE_DATA,
45 "Proxy-Authenticate", "Digest realm=test"));
46
47 // Multi-round mechanisms partially elided.
48 EXPECT_EQ("NTLM [4 bytes were stripped]", ElideHeaderValueForNetLog(
49 NetLog::LOG_STRIP_PRIVATE_DATA, "WWW-Authenticate", "NTLM 1234"));
50 EXPECT_EQ("NTLM [4 bytes were stripped]", ElideHeaderValueForNetLog(
51 NetLog::LOG_STRIP_PRIVATE_DATA, "Proxy-Authenticate", "NTLM 1234"));
52
53 // Leave whitespace intact.
54 EXPECT_EQ("NTLM [4 bytes were stripped] ", ElideHeaderValueForNetLog(
55 NetLog::LOG_STRIP_PRIVATE_DATA, "WWW-Authenticate", "NTLM 1234 "));
56 }
57
58 } // namspace net
OLDNEW
« no previous file with comments | « net/http/http_log_util.cc ('k') | net/http/http_network_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698