summaryrefslogtreecommitdiffstats
path: root/chrome/browser/task_management/test_task_manager.cc
blob: ffd7202b509aa0b3b34745ac4c160b67cf4ea510 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/task_management/test_task_manager.h"

namespace task_management {

TestTaskManager::TestTaskManager()
    : handle_(base::kNullProcessHandle),
      pid_(base::kNullProcessId) {
  set_timer_for_testing(scoped_ptr<base::Timer>(new base::MockTimer(true,
                                                                    true)));
}

TestTaskManager::~TestTaskManager() {
}

// task_management::TaskManagerInterface:
void TestTaskManager::ActivateTask(TaskId task_id) {
}

double TestTaskManager::GetCpuUsage(TaskId task_id) const {
  return 0.0;
}

int64 TestTaskManager::GetPhysicalMemoryUsage(TaskId task_id) const {
  return -1;
}

int64 TestTaskManager::GetPrivateMemoryUsage(TaskId task_id) const {
  return -1;
}

int64 TestTaskManager::GetSharedMemoryUsage(TaskId task_id) const {
  return -1;
}

int64 TestTaskManager::GetGpuMemoryUsage(TaskId task_id,
                                         bool* has_duplicates) const {
  return -1;
}

int TestTaskManager::GetIdleWakeupsPerSecond(TaskId task_id) const {
  return -1;
}

int TestTaskManager::GetNaClDebugStubPort(TaskId task_id) const {
  return -1;
}

void TestTaskManager::GetGDIHandles(TaskId task_id,
                                    int64* current,
                                    int64* peak) const {
}

void TestTaskManager::GetUSERHandles(TaskId task_id,
                                     int64* current,
                                     int64* peak) const {
}

int TestTaskManager::GetOpenFdCount(TaskId task_id) const {
  return -1;
}

bool TestTaskManager::IsTaskOnBackgroundedProcess(TaskId task_id) const {
  return false;
}

const base::string16& TestTaskManager::GetTitle(TaskId task_id) const {
  return title_;
}

const std::string& TestTaskManager::GetTaskNameForRappor(TaskId task_id) const {
  return rappor_sample_;
}

base::string16 TestTaskManager::GetProfileName(TaskId task_id) const {
  return base::string16();
}

const gfx::ImageSkia& TestTaskManager::GetIcon(TaskId task_id) const {
  return icon_;
}

const base::ProcessHandle& TestTaskManager::GetProcessHandle(
    TaskId task_id) const {
  return handle_;
}

const base::ProcessId& TestTaskManager::GetProcessId(TaskId task_id) const {
  return pid_;
}

Task::Type TestTaskManager::GetType(TaskId task_id) const {
  return Task::UNKNOWN;
}

int64 TestTaskManager::GetNetworkUsage(TaskId task_id) const {
  return -1;
}

int64 TestTaskManager::GetProcessTotalNetworkUsage(TaskId task_id) const {
  return -1;
}

int64 TestTaskManager::GetSqliteMemoryUsed(TaskId task_id) const {
  return -1;
}

bool TestTaskManager::GetV8Memory(TaskId task_id,
                                  int64* allocated,
                                  int64* used) const {
  return false;
}

bool TestTaskManager::GetWebCacheStats(
    TaskId task_id,
    blink::WebCache::ResourceTypeStats* stats) const {
  return false;
}

const TaskIdList& TestTaskManager::GetTaskIdsList() const {
  return ids_;
}

size_t TestTaskManager::GetNumberOfTasksOnSameProcess(TaskId task_id) const {
  return 1;
}

base::TimeDelta TestTaskManager::GetRefreshTime() {
  return GetCurrentRefreshTime();
}

int64 TestTaskManager::GetEnabledFlags() {
  return enabled_resources_flags();
}

}  // namespace task_management