| OLD | NEW |
| 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/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "base/test/test_simple_task_runner.h" | 11 #include "base/test/test_simple_task_runner.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "chrome/browser/chromeos/settings/scoped_cros_settings_test_helper.h" | 13 #include "chrome/browser/chromeos/settings/scoped_cros_settings_test_helper.h" |
| 14 #include "components/feedback/anonymizer_tool.h" | 14 #include "components/feedback/anonymizer_tool.h" |
| 15 #include "content/public/test/test_browser_thread_bundle.h" | 15 #include "content/public/test/test_browser_thread_bundle.h" |
| 16 #include "content/public/test/test_utils.h" | 16 #include "content/public/test/test_utils.h" |
| 17 #include "net/http/http_request_headers.h" | 17 #include "net/http/http_request_headers.h" |
| 18 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
| 19 | 19 |
| 20 namespace policy { | 20 namespace policy { |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 // The list of tested system log file names. | 24 // The list of tested system log file names. |
| 25 const char* const kTestSystemLogFileNames[] = {"name1.txt", "name32.txt"}; | 25 const char* const kTestSystemLogFileNames[] = {"name1.txt", "name32.txt"}; |
| 26 | 26 |
| 27 // Generate the fake system log files. | 27 // Generate the fake system log files. |
| 28 SystemLogUploader::SystemLogs GenerateTestSystemLogFiles() { | 28 SystemLogUploader::SystemLogs GenerateTestSystemLogFiles() { |
| 29 SystemLogUploader::SystemLogs system_logs; | 29 SystemLogUploader::SystemLogs system_logs; |
| 30 for (auto const file_path : kTestSystemLogFileNames) { | 30 for (auto* file_path : kTestSystemLogFileNames) { |
| 31 system_logs.push_back(std::make_pair(file_path, file_path)); | 31 system_logs.push_back(std::make_pair(file_path, file_path)); |
| 32 } | 32 } |
| 33 return system_logs; | 33 return system_logs; |
| 34 } | 34 } |
| 35 | 35 |
| 36 class MockUploadJob : public UploadJob { | 36 class MockUploadJob : public UploadJob { |
| 37 public: | 37 public: |
| 38 // If is_upload_error is false OnSuccess() will be invoked when the | 38 // If is_upload_error is false OnSuccess() will be invoked when the |
| 39 // Start() method is called, otherwise OnFailure() will be invoked. | 39 // Start() method is called, otherwise OnFailure() will be invoked. |
| 40 MockUploadJob(const GURL& upload_url, | 40 MockUploadJob(const GURL& upload_url, |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 "<IPv4: 1>55\n" | 311 "<IPv4: 1>55\n" |
| 312 "aaaa<IPv4: 2>aaa\n" | 312 "aaaa<IPv4: 2>aaa\n" |
| 313 "11:11;<IPv6: 1>\n" | 313 "11:11;<IPv6: 1>\n" |
| 314 "<IPv6: 1>\n" | 314 "<IPv6: 1>\n" |
| 315 "11:11:abcdef:0:0:0:0:0\n" | 315 "11:11:abcdef:0:0:0:0:0\n" |
| 316 "aa:aa:aa:00:00:01"; | 316 "aa:aa:aa:00:00:01"; |
| 317 EXPECT_EQ(result, SystemLogUploader::RemoveSensitiveData(&anonymizer, data)); | 317 EXPECT_EQ(result, SystemLogUploader::RemoveSensitiveData(&anonymizer, data)); |
| 318 } | 318 } |
| 319 | 319 |
| 320 } // namespace policy | 320 } // namespace policy |
| OLD | NEW |