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

Side by Side Diff: components/feedback/anonymizer_tool_unittest.cc

Issue 2842263005: Scrub peripheral serial numbers from logs (Closed)
Patch Set: Created 3 years, 7 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 | « components/feedback/anonymizer_tool.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/feedback/anonymizer_tool.h" 5 #include "components/feedback/anonymizer_tool.h"
6 6
7 #include <gtest/gtest.h> 7 #include <gtest/gtest.h>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 10
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 EXPECT_EQ("bssid 'aa:bb'", AnonymizeCustomPatterns("bssid 'aa:bb'")); 88 EXPECT_EQ("bssid 'aa:bb'", AnonymizeCustomPatterns("bssid 'aa:bb'"));
89 89
90 EXPECT_EQ("Scan SSID - hexdump(len=6): 1\nfoo", 90 EXPECT_EQ("Scan SSID - hexdump(len=6): 1\nfoo",
91 AnonymizeCustomPatterns( 91 AnonymizeCustomPatterns(
92 "Scan SSID - hexdump(len=6): 47 6f 6f 67 6c 65\nfoo")); 92 "Scan SSID - hexdump(len=6): 47 6f 6f 67 6c 65\nfoo"));
93 93
94 EXPECT_EQ( 94 EXPECT_EQ(
95 "a\nb [SSID=1] [SSID=2] [SSID=foo\nbar] b", 95 "a\nb [SSID=1] [SSID=2] [SSID=foo\nbar] b",
96 AnonymizeCustomPatterns("a\nb [SSID=foo] [SSID=bar] [SSID=foo\nbar] b")); 96 AnonymizeCustomPatterns("a\nb [SSID=foo] [SSID=bar] [SSID=foo\nbar] b"));
97 97
98 EXPECT_EQ("SerialNumber: 1",
99 AnonymizeCustomPatterns("SerialNumber: 1217D7EF"));
100 EXPECT_EQ("serial number: 2",
101 AnonymizeCustomPatterns("serial number: 50C971FEE7F3x010900"));
102 EXPECT_EQ("SerialNumber: 3",
103 AnonymizeCustomPatterns("SerialNumber: EVT23-17BA01-004"));
104
98 EXPECT_EQ("<email: 1>", 105 EXPECT_EQ("<email: 1>",
99 AnonymizeCustomPatterns("foo@bar.com")); 106 AnonymizeCustomPatterns("foo@bar.com"));
100 EXPECT_EQ("Email: <email: 1>.", 107 EXPECT_EQ("Email: <email: 1>.",
101 AnonymizeCustomPatterns("Email: foo@bar.com.")); 108 AnonymizeCustomPatterns("Email: foo@bar.com."));
102 EXPECT_EQ("Email:\n<email: 2>\n", 109 EXPECT_EQ("Email:\n<email: 2>\n",
103 AnonymizeCustomPatterns("Email:\nfooooo@bar.com\n")); 110 AnonymizeCustomPatterns("Email:\nfooooo@bar.com\n"));
104 111
105 EXPECT_EQ("[<IPv6: 1>]", AnonymizeCustomPatterns( 112 EXPECT_EQ("[<IPv6: 1>]", AnonymizeCustomPatterns(
106 "[2001:0db8:0000:0000:0000:ff00:0042:8329]")); 113 "[2001:0db8:0000:0000:0000:ff00:0042:8329]"));
107 EXPECT_EQ("[<IPv6: 2>]", 114 EXPECT_EQ("[<IPv6: 2>]",
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 TEST_F(AnonymizerToolTest, AnonymizeCustomPatternWithoutContext) { 179 TEST_F(AnonymizerToolTest, AnonymizeCustomPatternWithoutContext) {
173 CustomPatternWithoutContext kPattern = {"pattern", "(o+)"}; 180 CustomPatternWithoutContext kPattern = {"pattern", "(o+)"};
174 std::map<std::string, std::string> space; 181 std::map<std::string, std::string> space;
175 EXPECT_EQ("", AnonymizeCustomPatternWithoutContext("", kPattern, &space)); 182 EXPECT_EQ("", AnonymizeCustomPatternWithoutContext("", kPattern, &space));
176 EXPECT_EQ("f<pattern: 1>\nf<pattern: 2>z\nf<pattern: 1>l\n", 183 EXPECT_EQ("f<pattern: 1>\nf<pattern: 2>z\nf<pattern: 1>l\n",
177 AnonymizeCustomPatternWithoutContext("fo\nfooz\nfol\n", kPattern, 184 AnonymizeCustomPatternWithoutContext("fo\nfooz\nfol\n", kPattern,
178 &space)); 185 &space));
179 } 186 }
180 187
181 } // namespace feedback 188 } // namespace feedback
OLDNEW
« no previous file with comments | « components/feedback/anonymizer_tool.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698