OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_TEST_UTIL_H_ | |
6 #define CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_TEST_UTIL_H_ | |
ncarter (slow)
2015/11/10 23:29:57
This filename ought to be test_task_manager or fak
afakhry
2015/11/12 00:21:28
Done.
| |
7 | |
8 #include "base/macros.h" | |
9 #include "base/timer/mock_timer.h" | |
10 #include "chrome/browser/task_management/task_manager_interface.h" | |
11 | |
12 namespace task_management { | |
13 | |
14 // This is a partial stub implementation that can be used as a base class for | |
ncarter (slow)
2015/11/10 23:29:57
What's the guiding principle behind what behavior
afakhry
2015/11/12 00:21:28
I'm not sure what you mean. Most of the below func
| |
15 // implementations of the task manager used in unit tests. | |
ncarter (slow)
2015/11/10 23:29:57
Ideally this object would be useful without furthe
afakhry
2015/11/12 00:21:28
Yes it is possible. Subclassing is sometimes neede
| |
16 class TestTaskManager : public TaskManagerInterface { | |
17 public: | |
18 TestTaskManager(); | |
19 ~TestTaskManager() override; | |
20 | |
21 // task_management::TaskManagerInterface: | |
22 void ActivateTask(TaskId task_id) override; | |
23 double GetCpuUsage(TaskId task_id) const override; | |
24 int64 GetPhysicalMemoryUsage(TaskId task_id) const override; | |
25 int64 GetPrivateMemoryUsage(TaskId task_id) const override; | |
26 int64 GetSharedMemoryUsage(TaskId task_id) const override; | |
27 int64 GetGpuMemoryUsage(TaskId task_id, bool* has_duplicates) const override; | |
28 int GetIdleWakeupsPerSecond(TaskId task_id) const override; | |
29 int GetNaClDebugStubPort(TaskId task_id) const override; | |
30 void GetGDIHandles(TaskId task_id, | |
31 int64* current, | |
32 int64* peak) const override; | |
33 void GetUSERHandles(TaskId task_id, | |
34 int64* current, | |
35 int64* peak) const override; | |
36 bool IsTaskOnBackgroundedProcess(TaskId task_id) const override; | |
37 const base::string16& GetTitle(TaskId task_id) const override; | |
38 const std::string& GetRapporSampleName(TaskId task_id) const override; | |
39 base::string16 GetProfileName(TaskId task_id) const override; | |
40 const gfx::ImageSkia& GetIcon(TaskId task_id) const override; | |
41 const base::ProcessHandle& GetProcessHandle(TaskId task_id) const override; | |
42 const base::ProcessId& GetProcessId(TaskId task_id) const override; | |
43 Task::Type GetType(TaskId task_id) const override; | |
44 int64 GetNetworkUsage(TaskId task_id) const override; | |
45 int64 GetSqliteMemoryUsed(TaskId task_id) const override; | |
46 bool GetV8Memory(TaskId task_id, | |
47 int64* allocated, | |
48 int64* used) const override; | |
49 bool GetWebCacheStats( | |
50 TaskId task_id, | |
51 blink::WebCache::ResourceTypeStats* stats) const override; | |
52 const TaskIdList& GetTaskIdsList() const override; | |
53 size_t GetNumberOfTasksOnSameProcess(TaskId task_id) const override; | |
54 | |
55 base::TimeDelta GetRefreshTime(); | |
56 int64 GetEnabledFlags(); | |
57 | |
58 protected: | |
59 // task_management::TaskManager: | |
60 void Refresh() override {} | |
61 void StartUpdating() override {} | |
62 void StopUpdating() override {} | |
63 | |
64 base::ProcessHandle handle_; | |
65 base::ProcessId pid_; | |
66 base::string16 title_; | |
67 std::string rappor_sample_; | |
68 gfx::ImageSkia icon_; | |
69 TaskIdList ids_; | |
70 | |
71 private: | |
72 DISALLOW_COPY_AND_ASSIGN(TestTaskManager); | |
73 }; | |
74 | |
75 } // namespace task_management | |
76 | |
77 #endif // CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_TEST_UTIL_H_ | |
OLD | NEW |