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

Side by Side Diff: chrome/browser/task_management/task_manager_tester.h

Issue 2197483003: Move the Mac Task Manager to the new backend code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_TASK_MANAGER_TESTER_H_ 5 #ifndef CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_TESTER_H_
6 #define CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_TESTER_H_ 6 #define CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_TESTER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/callback_forward.h" 12 #include "base/callback_forward.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "chrome/browser/task_management/task_manager_browsertest_util.h" 14 #include "chrome/browser/task_management/task_manager_browsertest_util.h"
15 15
16 namespace task_management { 16 namespace task_management {
17 17
18 // An adapter that abstracts away the difference of old vs. new task manager. 18 // An adapter to simplify testing the task manager.
19 class TaskManagerTester { 19 class TaskManagerTester {
afakhry 2016/08/02 16:41:33 Maybe this adapter isn't needed anymore, but that'
Avi (use Gerrit) 2016/08/02 17:39:44 Acknowledged.
ncarter (slow) 2016/08/02 19:49:36 I think it's fine to leave this mostly intact. We
Avi (use Gerrit) 2016/08/02 20:06:56 For followup, if nothing else. This CL is big enou
20 public: 20 public:
21 using ColumnSpecifier = browsertest_util::ColumnSpecifier; 21 using ColumnSpecifier = browsertest_util::ColumnSpecifier;
22 22
23 // Creates a TaskManagerTester backed by the current task manager. The task 23 // Creates a TaskManagerTester backed by the current task manager. The task
24 // manager should already be visible when you call this function. |callback|, 24 // manager should already be visible when you call this function. |callback|,
25 // if not a null callback, will be invoked when the underlying model changes. 25 // if not a null callback, will be invoked when the underlying model changes.
26 static std::unique_ptr<TaskManagerTester> Create( 26 static std::unique_ptr<TaskManagerTester> Create(
27 const base::Closure& callback); 27 const base::Closure& callback);
28 28
29 // If using a legacy task manager, refresh the model.
30 static void MaybeRefreshLegacyInstance();
31
32 virtual ~TaskManagerTester() {} 29 virtual ~TaskManagerTester() {}
33 30
34 // Get the number of rows currently in the task manager. 31 // Get the number of rows currently in the task manager.
35 virtual int GetRowCount() = 0; 32 virtual int GetRowCount() = 0;
36 33
37 // Get the title text of a particular |row|. 34 // Get the title text of a particular |row|.
38 virtual base::string16 GetRowTitle(int row) = 0; 35 virtual base::string16 GetRowTitle(int row) = 0;
39 36
40 // Hide or show a column. If a column is not visible its stats are not 37 // Hide or show a column. If a column is not visible its stats are not
41 // necessarily gathered. 38 // necessarily gathered.
42 virtual void ToggleColumnVisibility(ColumnSpecifier column) = 0; 39 virtual void ToggleColumnVisibility(ColumnSpecifier column) = 0;
43 40
44 // Get the value of a column as an int64. Memory values are in bytes. 41 // Get the value of a column as an int64. Memory values are in bytes.
45 virtual int64_t GetColumnValue(ColumnSpecifier column, int row) = 0; 42 virtual int64_t GetColumnValue(ColumnSpecifier column, int row) = 0;
46 43
47 // If |row| is associated with a WebContents, return its SessionID. Otherwise, 44 // If |row| is associated with a WebContents, return its SessionID. Otherwise,
48 // return -1. 45 // return -1.
49 virtual int32_t GetTabId(int row) = 0; 46 virtual int32_t GetTabId(int row) = 0;
50 47
51 // Kill the process of |row|. 48 // Kill the process of |row|.
52 virtual void Kill(int row) = 0; 49 virtual void Kill(int row) = 0;
53 50
54 // Gets the start index and length of the group to which the task at 51 // Gets the start index and length of the group to which the task at
55 // |row_index| belongs. 52 // |row_index| belongs.
56 virtual void GetRowsGroupRange(int row, int* out_start, int* out_length) = 0; 53 virtual void GetRowsGroupRange(int row, int* out_start, int* out_length) = 0;
57
58 private:
59 // Always creates a tester for the non-legacy TaskManager.
60 static std::unique_ptr<TaskManagerTester> CreateDefault(
61 const base::Closure& callback);
62 }; 54 };
63 55
64 } // namespace task_management 56 } // namespace task_management
65 57
66 #endif // CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_TESTER_H_ 58 #endif // CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_TESTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698