| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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_TASK_MANAGEMENT_TEST_TASK_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGEMENT_TEST_TASK_MANAGER_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGEMENT_TEST_TASK_MANAGER_H_ | 6 #define CHROME_BROWSER_TASK_MANAGEMENT_TEST_TASK_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
| 8 #include "base/macros.h" | 11 #include "base/macros.h" |
| 9 #include "base/timer/mock_timer.h" | 12 #include "base/timer/mock_timer.h" |
| 10 #include "chrome/browser/task_management/task_manager_interface.h" | 13 #include "chrome/browser/task_management/task_manager_interface.h" |
| 11 | 14 |
| 12 namespace task_management { | 15 namespace task_management { |
| 13 | 16 |
| 14 // This is a partial stub implementation that can be used as a base class for | 17 // This is a partial stub implementation that can be used as a base class for |
| 15 // implementations of the task manager used in unit tests. | 18 // implementations of the task manager used in unit tests. |
| 16 class TestTaskManager : public TaskManagerInterface { | 19 class TestTaskManager : public TaskManagerInterface { |
| 17 public: | 20 public: |
| 18 TestTaskManager(); | 21 TestTaskManager(); |
| 19 ~TestTaskManager() override; | 22 ~TestTaskManager() override; |
| 20 | 23 |
| 21 // task_management::TaskManagerInterface: | 24 // task_management::TaskManagerInterface: |
| 22 void ActivateTask(TaskId task_id) override; | 25 void ActivateTask(TaskId task_id) override; |
| 23 double GetCpuUsage(TaskId task_id) const override; | 26 double GetCpuUsage(TaskId task_id) const override; |
| 24 int64 GetPhysicalMemoryUsage(TaskId task_id) const override; | 27 int64_t GetPhysicalMemoryUsage(TaskId task_id) const override; |
| 25 int64 GetPrivateMemoryUsage(TaskId task_id) const override; | 28 int64_t GetPrivateMemoryUsage(TaskId task_id) const override; |
| 26 int64 GetSharedMemoryUsage(TaskId task_id) const override; | 29 int64_t GetSharedMemoryUsage(TaskId task_id) const override; |
| 27 int64 GetGpuMemoryUsage(TaskId task_id, bool* has_duplicates) const override; | 30 int64_t GetGpuMemoryUsage(TaskId task_id, |
| 31 bool* has_duplicates) const override; |
| 28 int GetIdleWakeupsPerSecond(TaskId task_id) const override; | 32 int GetIdleWakeupsPerSecond(TaskId task_id) const override; |
| 29 int GetNaClDebugStubPort(TaskId task_id) const override; | 33 int GetNaClDebugStubPort(TaskId task_id) const override; |
| 30 void GetGDIHandles(TaskId task_id, | 34 void GetGDIHandles(TaskId task_id, |
| 31 int64* current, | 35 int64_t* current, |
| 32 int64* peak) const override; | 36 int64_t* peak) const override; |
| 33 void GetUSERHandles(TaskId task_id, | 37 void GetUSERHandles(TaskId task_id, |
| 34 int64* current, | 38 int64_t* current, |
| 35 int64* peak) const override; | 39 int64_t* peak) const override; |
| 36 int GetOpenFdCount(TaskId task_id) const override; | 40 int GetOpenFdCount(TaskId task_id) const override; |
| 37 bool IsTaskOnBackgroundedProcess(TaskId task_id) const override; | 41 bool IsTaskOnBackgroundedProcess(TaskId task_id) const override; |
| 38 const base::string16& GetTitle(TaskId task_id) const override; | 42 const base::string16& GetTitle(TaskId task_id) const override; |
| 39 const std::string& GetTaskNameForRappor(TaskId task_id) const override; | 43 const std::string& GetTaskNameForRappor(TaskId task_id) const override; |
| 40 base::string16 GetProfileName(TaskId task_id) const override; | 44 base::string16 GetProfileName(TaskId task_id) const override; |
| 41 const gfx::ImageSkia& GetIcon(TaskId task_id) const override; | 45 const gfx::ImageSkia& GetIcon(TaskId task_id) const override; |
| 42 const base::ProcessHandle& GetProcessHandle(TaskId task_id) const override; | 46 const base::ProcessHandle& GetProcessHandle(TaskId task_id) const override; |
| 43 const base::ProcessId& GetProcessId(TaskId task_id) const override; | 47 const base::ProcessId& GetProcessId(TaskId task_id) const override; |
| 44 Task::Type GetType(TaskId task_id) const override; | 48 Task::Type GetType(TaskId task_id) const override; |
| 45 int64 GetNetworkUsage(TaskId task_id) const override; | 49 int64_t GetNetworkUsage(TaskId task_id) const override; |
| 46 int64 GetProcessTotalNetworkUsage(TaskId task_id) const override; | 50 int64_t GetProcessTotalNetworkUsage(TaskId task_id) const override; |
| 47 int64 GetSqliteMemoryUsed(TaskId task_id) const override; | 51 int64_t GetSqliteMemoryUsed(TaskId task_id) const override; |
| 48 bool GetV8Memory(TaskId task_id, | 52 bool GetV8Memory(TaskId task_id, |
| 49 int64* allocated, | 53 int64_t* allocated, |
| 50 int64* used) const override; | 54 int64_t* used) const override; |
| 51 bool GetWebCacheStats( | 55 bool GetWebCacheStats( |
| 52 TaskId task_id, | 56 TaskId task_id, |
| 53 blink::WebCache::ResourceTypeStats* stats) const override; | 57 blink::WebCache::ResourceTypeStats* stats) const override; |
| 54 const TaskIdList& GetTaskIdsList() const override; | 58 const TaskIdList& GetTaskIdsList() const override; |
| 55 size_t GetNumberOfTasksOnSameProcess(TaskId task_id) const override; | 59 size_t GetNumberOfTasksOnSameProcess(TaskId task_id) const override; |
| 56 | 60 |
| 57 base::TimeDelta GetRefreshTime(); | 61 base::TimeDelta GetRefreshTime(); |
| 58 int64 GetEnabledFlags(); | 62 int64_t GetEnabledFlags(); |
| 59 | 63 |
| 60 protected: | 64 protected: |
| 61 // task_management::TaskManager: | 65 // task_management::TaskManager: |
| 62 void Refresh() override {} | 66 void Refresh() override {} |
| 63 void StartUpdating() override {} | 67 void StartUpdating() override {} |
| 64 void StopUpdating() override {} | 68 void StopUpdating() override {} |
| 65 | 69 |
| 66 base::ProcessHandle handle_; | 70 base::ProcessHandle handle_; |
| 67 base::ProcessId pid_; | 71 base::ProcessId pid_; |
| 68 base::string16 title_; | 72 base::string16 title_; |
| 69 std::string rappor_sample_; | 73 std::string rappor_sample_; |
| 70 gfx::ImageSkia icon_; | 74 gfx::ImageSkia icon_; |
| 71 TaskIdList ids_; | 75 TaskIdList ids_; |
| 72 | 76 |
| 73 private: | 77 private: |
| 74 DISALLOW_COPY_AND_ASSIGN(TestTaskManager); | 78 DISALLOW_COPY_AND_ASSIGN(TestTaskManager); |
| 75 }; | 79 }; |
| 76 | 80 |
| 77 } // namespace task_management | 81 } // namespace task_management |
| 78 | 82 |
| 79 #endif // CHROME_BROWSER_TASK_MANAGEMENT_TEST_TASK_MANAGER_H_ | 83 #endif // CHROME_BROWSER_TASK_MANAGEMENT_TEST_TASK_MANAGER_H_ |
| OLD | NEW |