| 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_TEST_TASK_MANAGER_H_ | 
 |   6 #define CHROME_BROWSER_TASK_MANAGEMENT_TEST_TASK_MANAGER_H_ | 
 |   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 | 
 |  15 // implementations of the task manager used in unit tests. | 
 |  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& GetTaskNameForRappor(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 GetProcessTotalNetworkUsage(TaskId task_id) const override; | 
 |  46   int64 GetSqliteMemoryUsed(TaskId task_id) const override; | 
 |  47   bool GetV8Memory(TaskId task_id, | 
 |  48                    int64* allocated, | 
 |  49                    int64* used) const override; | 
 |  50   bool GetWebCacheStats( | 
 |  51       TaskId task_id, | 
 |  52       blink::WebCache::ResourceTypeStats* stats) const override; | 
 |  53   const TaskIdList& GetTaskIdsList() const override; | 
 |  54   size_t GetNumberOfTasksOnSameProcess(TaskId task_id) const override; | 
 |  55  | 
 |  56   base::TimeDelta GetRefreshTime(); | 
 |  57   int64 GetEnabledFlags(); | 
 |  58  | 
 |  59  protected: | 
 |  60   // task_management::TaskManager: | 
 |  61   void Refresh() override {} | 
 |  62   void StartUpdating() override {} | 
 |  63   void StopUpdating() override {} | 
 |  64  | 
 |  65   base::ProcessHandle handle_; | 
 |  66   base::ProcessId pid_; | 
 |  67   base::string16 title_; | 
 |  68   std::string rappor_sample_; | 
 |  69   gfx::ImageSkia icon_; | 
 |  70   TaskIdList ids_; | 
 |  71  | 
 |  72  private: | 
 |  73   DISALLOW_COPY_AND_ASSIGN(TestTaskManager); | 
 |  74 }; | 
 |  75  | 
 |  76 }  // namespace task_management | 
 |  77  | 
 |  78 #endif  // CHROME_BROWSER_TASK_MANAGEMENT_TEST_TASK_MANAGER_H_ | 
| OLD | NEW |