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

Side by Side Diff: chrome/browser/chromeos/policy/system_log_uploader_unittest.cc

Issue 1610123003: Added anonymizer to SystemLogUploader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "chrome/browser/chromeos/policy/system_log_uploader.h" 5 #include "chrome/browser/chromeos/policy/system_log_uploader.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/test/test_simple_task_runner.h" 10 #include "base/test/test_simple_task_runner.h"
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 task_runner_->RunPendingTasks(); 279 task_runner_->RunPendingTasks();
280 280
281 RunPendingUploadTaskAndCheckNext( 281 RunPendingUploadTaskAndCheckNext(
282 uploader, base::TimeDelta::FromMilliseconds( 282 uploader, base::TimeDelta::FromMilliseconds(
283 SystemLogUploader::kDefaultUploadDelayMs)); 283 SystemLogUploader::kDefaultUploadDelayMs));
284 RunPendingUploadTaskAndCheckNext( 284 RunPendingUploadTaskAndCheckNext(
285 uploader, base::TimeDelta::FromMilliseconds( 285 uploader, base::TimeDelta::FromMilliseconds(
286 SystemLogUploader::kDefaultUploadDelayMs)); 286 SystemLogUploader::kDefaultUploadDelayMs));
287 } 287 }
288 288
289 // Test RemovePII function. 289 // Test RemovePII function: ensure that AnonymizerTool handles IPv4, IPv6,
290 // SSID, BSSID/MAC address, Email address, URL.
290 TEST_F(SystemLogUploaderTest, TestPII) { 291 TEST_F(SystemLogUploaderTest, TestPII) {
292 SystemLogUploader uploader(nullptr, task_runner_);
291 std::string data = 293 std::string data =
292 "aaaaaaaaSSID=123aaaaaaaaaaa\n" // SSID. 294 "aaaaaaaa SSID='123aaaaaaaaaaa'\n" // SSID.
293 "aaaaaaaahttp://tets.comaaaaaaa\n" // URL. 295 "aaaaaaaahttp://tets.comaaaaaaa\n" // URL.
294 "aaaaaemail@example.comaaa\n" // Email address. 296 "aaaaaemail@example.comaaa\n" // Email address.
295 "example@@1234\n" // No PII, it is not valid email address. 297 "example@@1234\n" // No PII, it is not valid email address.
296 "255.255.355.255\n" // No PII, it is not valid IP address format. 298 "255.255.355.255\n" // No PII, it is not valid IP address format.
297 "aaaa123.123.45.4aaa\n" // IP address. 299 "aaaa123.123.45.4aaa\n" // IP address.
298 "11:11;11::11\n" // IP address. 300 "11:11;11::11\n" // IP address.
299 "11::11\n" // IP address. 301 "11::11\n" // IP address.
300 "11:11:abcdef:0:0:0:0:0"; // No PII, it is not valid IP address format. 302 "11:11:abcdef:0:0:1:2:3\n" // No PII, it is not valid IP address format.
303 "00:80:c8:e3:4c:BD"; // MAC address.
301 304
302 std::string result = 305 std::string result =
306 "aaaaaaaa SSID='1'\n"
307 "aaaaaaaa<URL: 1>\n"
308 "<email: 1>\n"
303 "example@@1234\n" 309 "example@@1234\n"
304 "255.255.355.255\n" 310 "255.255.355.255\n"
305 "11:11:abcdef:0:0:0:0:0\n"; 311 "aaaa<IPv4: 1>aaa\n"
312 "11:11;<IPv6: 1>\n"
313 "<IPv6: 1>\n"
314 "11:11:abcdef:0:0:1:2:3\n"
315 "00:80:c8:00:00:01";
306 316
307 EXPECT_EQ(result, SystemLogUploader::RemoveSensitiveData(data)); 317 EXPECT_EQ(result, uploader.RemoveSensitiveData(data));
308 } 318 }
309 319
310 } // namespace policy 320 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698