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

Side by Side Diff: chrome/browser/chromeos/policy/system_log_uploader.h

Issue 1216643002: Added unittests for SystemLogUploader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased patch. Created 5 years, 4 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 | « no previous file | chrome/browser/chromeos/policy/system_log_uploader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_SYSTEM_LOG_UPLOADER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_SYSTEM_LOG_UPLOADER_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_SYSTEM_LOG_UPLOADER_H_ 6 #define CHROME_BROWSER_CHROMEOS_POLICY_SYSTEM_LOG_UPLOADER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/ref_counted_memory.h" 10 #include "base/memory/ref_counted_memory.h"
(...skipping 10 matching lines...) Expand all
21 namespace policy { 21 namespace policy {
22 22
23 // Class responsible for periodically uploading system logs, it handles the 23 // Class responsible for periodically uploading system logs, it handles the
24 // server responses by UploadJob:Delegate callbacks. 24 // server responses by UploadJob:Delegate callbacks.
25 class SystemLogUploader : public UploadJob::Delegate { 25 class SystemLogUploader : public UploadJob::Delegate {
26 public: 26 public:
27 // Structure that stores the system log files as pairs: (file name, loaded 27 // Structure that stores the system log files as pairs: (file name, loaded
28 // from the disk binary file data). 28 // from the disk binary file data).
29 typedef std::vector<std::pair<std::string, std::string>> SystemLogs; 29 typedef std::vector<std::pair<std::string, std::string>> SystemLogs;
30 30
31 // Refresh constants.
32 static const int64 kDefaultUploadDelayMs;
33 static const int64 kErrorUploadDelayMs;
34
35 // Http header constants to upload.
36 static const char* const kNameFieldTemplate;
37 static const char* const kFileTypeHeaderName;
38 static const char* const kFileTypeLogFile;
39 static const char* const kContentTypePlainText;
40
31 // A delegate interface used by SystemLogUploader to read the system logs 41 // A delegate interface used by SystemLogUploader to read the system logs
32 // from the disk and create an upload job. 42 // from the disk and create an upload job.
33 class Delegate { 43 class Delegate {
34 public: 44 public:
35 typedef base::Callback<void(scoped_ptr<SystemLogs> system_logs)> 45 typedef base::Callback<void(scoped_ptr<SystemLogs> system_logs)>
36 LogUploadCallback; 46 LogUploadCallback;
37 47
38 virtual ~Delegate() {} 48 virtual ~Delegate() {}
39 49
40 // Loads system logs and invokes |upload_callback|. 50 // Loads system logs and invokes |upload_callback|.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // Note: This should remain the last member so it'll be destroyed and 110 // Note: This should remain the last member so it'll be destroyed and
101 // invalidate the weak pointers before any other members are destroyed. 111 // invalidate the weak pointers before any other members are destroyed.
102 base::WeakPtrFactory<SystemLogUploader> weak_factory_; 112 base::WeakPtrFactory<SystemLogUploader> weak_factory_;
103 113
104 DISALLOW_COPY_AND_ASSIGN(SystemLogUploader); 114 DISALLOW_COPY_AND_ASSIGN(SystemLogUploader);
105 }; 115 };
106 116
107 } // namespace policy 117 } // namespace policy
108 118
109 #endif // CHROME_BROWSER_CHROMEOS_POLICY_SYSTEM_LOG_UPLOADER_H_ 119 #endif // CHROME_BROWSER_CHROMEOS_POLICY_SYSTEM_LOG_UPLOADER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/policy/system_log_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698