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

Side by Side Diff: snapshot/test/test_process_snapshot.h

Issue 998033002: Carry the client ID from the database all the way through upload (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 9 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 | « snapshot/process_snapshot.h ('k') | snapshot/test/test_process_snapshot.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 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 12 matching lines...) Expand all
23 #include <string> 23 #include <string>
24 #include <vector> 24 #include <vector>
25 25
26 #include "base/basictypes.h" 26 #include "base/basictypes.h"
27 #include "base/memory/scoped_ptr.h" 27 #include "base/memory/scoped_ptr.h"
28 #include "snapshot/exception_snapshot.h" 28 #include "snapshot/exception_snapshot.h"
29 #include "snapshot/module_snapshot.h" 29 #include "snapshot/module_snapshot.h"
30 #include "snapshot/process_snapshot.h" 30 #include "snapshot/process_snapshot.h"
31 #include "snapshot/system_snapshot.h" 31 #include "snapshot/system_snapshot.h"
32 #include "snapshot/thread_snapshot.h" 32 #include "snapshot/thread_snapshot.h"
33 #include "util/misc/uuid.h"
33 #include "util/stdlib/pointer_container.h" 34 #include "util/stdlib/pointer_container.h"
34 35
35 namespace crashpad { 36 namespace crashpad {
36 namespace test { 37 namespace test {
37 38
38 //! \brief A test ProcessSnapshot that can carry arbitrary data for testing 39 //! \brief A test ProcessSnapshot that can carry arbitrary data for testing
39 //! purposes. 40 //! purposes.
40 class TestProcessSnapshot final : public ProcessSnapshot { 41 class TestProcessSnapshot final : public ProcessSnapshot {
41 public: 42 public:
42 TestProcessSnapshot(); 43 TestProcessSnapshot();
43 ~TestProcessSnapshot() override; 44 ~TestProcessSnapshot() override;
44 45
45 void SetProcessID(pid_t process_id) { process_id_ = process_id; } 46 void SetProcessID(pid_t process_id) { process_id_ = process_id; }
46 void SetParentProcessID(pid_t parent_process_id) { 47 void SetParentProcessID(pid_t parent_process_id) {
47 parent_process_id_ = parent_process_id; 48 parent_process_id_ = parent_process_id;
48 } 49 }
49 void SetSnapshotTime(const timeval& snapshot_time) { 50 void SetSnapshotTime(const timeval& snapshot_time) {
50 snapshot_time_ = snapshot_time; 51 snapshot_time_ = snapshot_time;
51 } 52 }
52 void SetProcessStartTime(const timeval& start_time) { 53 void SetProcessStartTime(const timeval& start_time) {
53 process_start_time_ = start_time; 54 process_start_time_ = start_time;
54 } 55 }
55 void SetProcessCPUTimes(const timeval& user_time, 56 void SetProcessCPUTimes(const timeval& user_time,
56 const timeval& system_time) { 57 const timeval& system_time) {
57 process_cpu_user_time_ = user_time; 58 process_cpu_user_time_ = user_time;
58 process_cpu_system_time_ = system_time; 59 process_cpu_system_time_ = system_time;
59 } 60 }
61 void SetClientID(const UUID& client_id) { client_id_ = client_id; }
60 void SetAnnotationsSimpleMap( 62 void SetAnnotationsSimpleMap(
61 const std::map<std::string, std::string>& annotations_simple_map) { 63 const std::map<std::string, std::string>& annotations_simple_map) {
62 annotations_simple_map_ = annotations_simple_map; 64 annotations_simple_map_ = annotations_simple_map;
63 } 65 }
64 66
65 //! \brief Sets the system snapshot to be returned by System(). 67 //! \brief Sets the system snapshot to be returned by System().
66 //! 68 //!
67 //! \param[in] system The system snapshot that System() will return. The 69 //! \param[in] system The system snapshot that System() will return. The
68 //! TestProcessSnapshot object takes ownership of \a system. 70 //! TestProcessSnapshot object takes ownership of \a system.
69 void SetSystem(scoped_ptr<SystemSnapshot> system) { system_ = system.Pass(); } 71 void SetSystem(scoped_ptr<SystemSnapshot> system) { system_ = system.Pass(); }
(...skipping 22 matching lines...) Expand all
92 exception_ = exception.Pass(); 94 exception_ = exception.Pass();
93 } 95 }
94 96
95 // ProcessSnapshot: 97 // ProcessSnapshot:
96 98
97 pid_t ProcessID() const override; 99 pid_t ProcessID() const override;
98 pid_t ParentProcessID() const override; 100 pid_t ParentProcessID() const override;
99 void SnapshotTime(timeval* snapshot_time) const override; 101 void SnapshotTime(timeval* snapshot_time) const override;
100 void ProcessStartTime(timeval* start_time) const override; 102 void ProcessStartTime(timeval* start_time) const override;
101 void ProcessCPUTimes(timeval* user_time, timeval* system_time) const override; 103 void ProcessCPUTimes(timeval* user_time, timeval* system_time) const override;
104 void ClientID(UUID* client_id) const override;
102 const std::map<std::string, std::string>& AnnotationsSimpleMap() 105 const std::map<std::string, std::string>& AnnotationsSimpleMap()
103 const override; 106 const override;
104 const SystemSnapshot* System() const override; 107 const SystemSnapshot* System() const override;
105 std::vector<const ThreadSnapshot*> Threads() const override; 108 std::vector<const ThreadSnapshot*> Threads() const override;
106 std::vector<const ModuleSnapshot*> Modules() const override; 109 std::vector<const ModuleSnapshot*> Modules() const override;
107 const ExceptionSnapshot* Exception() const override; 110 const ExceptionSnapshot* Exception() const override;
108 111
109 private: 112 private:
110 pid_t process_id_; 113 pid_t process_id_;
111 pid_t parent_process_id_; 114 pid_t parent_process_id_;
112 timeval snapshot_time_; 115 timeval snapshot_time_;
113 timeval process_start_time_; 116 timeval process_start_time_;
114 timeval process_cpu_user_time_; 117 timeval process_cpu_user_time_;
115 timeval process_cpu_system_time_; 118 timeval process_cpu_system_time_;
119 UUID client_id_;
116 std::map<std::string, std::string> annotations_simple_map_; 120 std::map<std::string, std::string> annotations_simple_map_;
117 scoped_ptr<SystemSnapshot> system_; 121 scoped_ptr<SystemSnapshot> system_;
118 PointerVector<ThreadSnapshot> threads_; 122 PointerVector<ThreadSnapshot> threads_;
119 PointerVector<ModuleSnapshot> modules_; 123 PointerVector<ModuleSnapshot> modules_;
120 scoped_ptr<ExceptionSnapshot> exception_; 124 scoped_ptr<ExceptionSnapshot> exception_;
121 125
122 DISALLOW_COPY_AND_ASSIGN(TestProcessSnapshot); 126 DISALLOW_COPY_AND_ASSIGN(TestProcessSnapshot);
123 }; 127 };
124 128
125 } // namespace test 129 } // namespace test
126 } // namespace crashpad 130 } // namespace crashpad
127 131
128 #endif // CRASHPAD_SNAPSHOT_TEST_TEST_PROCESS_SNAPSHOT_H_ 132 #endif // CRASHPAD_SNAPSHOT_TEST_TEST_PROCESS_SNAPSHOT_H_
OLDNEW
« no previous file with comments | « snapshot/process_snapshot.h ('k') | snapshot/test/test_process_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698