OLD | NEW |
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 "http://@example.com", | 121 "http://@example.com", |
122 "http://192.168.0.1", | 122 "http://192.168.0.1", |
123 "http://192.168.0.1/", | 123 "http://192.168.0.1/", |
124 "http://اختبار.com", | 124 "http://اختبار.com", |
125 "http://test.com/foo(bar)baz.html", | 125 "http://test.com/foo(bar)baz.html", |
126 "http://test.com/foo%20bar", | 126 "http://test.com/foo%20bar", |
127 "ftp://test:tester@test.com", | 127 "ftp://test:tester@test.com", |
128 "chrome://extensions/", | 128 "chrome://extensions/", |
129 "chrome-extension://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/options.html", | 129 "chrome-extension://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/options.html", |
130 "http://example.com/foo?email=foo@bar.com", | 130 "http://example.com/foo?email=foo@bar.com", |
| 131 "rtsp://root@example.com/", |
| 132 "https://aaaaaaaaaaaaaaaa.com", |
131 }; | 133 }; |
132 for (size_t i = 0; i < arraysize(kURLs); ++i) { | 134 for (size_t i = 0; i < arraysize(kURLs); ++i) { |
133 SCOPED_TRACE(kURLs[i]); | 135 SCOPED_TRACE(kURLs[i]); |
134 std::string got = AnonymizeCustomPatterns(kURLs[i]); | 136 std::string got = AnonymizeCustomPatterns(kURLs[i]); |
135 EXPECT_TRUE( | 137 EXPECT_TRUE( |
136 base::StartsWith(got, "<URL: ", base::CompareCase::INSENSITIVE_ASCII)); | 138 base::StartsWith(got, "<URL: ", base::CompareCase::INSENSITIVE_ASCII)); |
137 EXPECT_TRUE(base::EndsWith(got, ">", base::CompareCase::INSENSITIVE_ASCII)); | 139 EXPECT_TRUE(base::EndsWith(got, ">", base::CompareCase::INSENSITIVE_ASCII)); |
138 } | 140 } |
139 // Test that "Android:" is not considered a schema with empty hier part. | 141 // Test that "Android:" is not considered a schema with empty hier part. |
140 EXPECT_EQ("The following applies to Android:", | 142 EXPECT_EQ("The following applies to Android:", |
(...skipping 29 matching lines...) Expand all Loading... |
170 TEST_F(AnonymizerToolTest, AnonymizeCustomPatternWithoutContext) { | 172 TEST_F(AnonymizerToolTest, AnonymizeCustomPatternWithoutContext) { |
171 CustomPatternWithoutContext kPattern = {"pattern", "(o+)"}; | 173 CustomPatternWithoutContext kPattern = {"pattern", "(o+)"}; |
172 std::map<std::string, std::string> space; | 174 std::map<std::string, std::string> space; |
173 EXPECT_EQ("", AnonymizeCustomPatternWithoutContext("", kPattern, &space)); | 175 EXPECT_EQ("", AnonymizeCustomPatternWithoutContext("", kPattern, &space)); |
174 EXPECT_EQ("f<pattern: 1>\nf<pattern: 2>z\nf<pattern: 1>l\n", | 176 EXPECT_EQ("f<pattern: 1>\nf<pattern: 2>z\nf<pattern: 1>l\n", |
175 AnonymizeCustomPatternWithoutContext("fo\nfooz\nfol\n", kPattern, | 177 AnonymizeCustomPatternWithoutContext("fo\nfooz\nfol\n", kPattern, |
176 &space)); | 178 &space)); |
177 } | 179 } |
178 | 180 |
179 } // namespace feedback | 181 } // namespace feedback |
OLD | NEW |