blob: 2983ca50392922b66aa10429f3a3cc09d3a93dd1 [file] [log] [blame]
nick22bcc7722016-05-10 18:43:411// Copyright 2016 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_TESTER_H_
6#define CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_TESTER_H_
7
nick50b06492016-05-10 23:40:278#include <stdint.h>
nick22bcc7722016-05-10 18:43:419
10#include <memory>
11
12#include "base/callback_forward.h"
13#include "base/strings/string16.h"
nick50b06492016-05-10 23:40:2714#include "chrome/browser/task_management/task_manager_browsertest_util.h"
nick22bcc7722016-05-10 18:43:4115
16namespace task_management {
17
18// An adapter that abstracts away the difference of old vs. new task manager.
19class TaskManagerTester {
20 public:
nick50b06492016-05-10 23:40:2721 using ColumnSpecifier = browsertest_util::ColumnSpecifier;
nick22bcc7722016-05-10 18:43:4122
23 // Creates a TaskManagerTester backed by the current task manager. The task
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.
26 static std::unique_ptr<TaskManagerTester> Create(
27 const base::Closure& callback);
28
29 virtual ~TaskManagerTester() {}
30
31 // Get the number of rows currently in the task manager.
32 virtual int GetRowCount() = 0;
33
34 // Get the title text of a particular |row|.
35 virtual base::string16 GetRowTitle(int row) = 0;
36
37 // Hide or show a column. If a column is not visible its stats are not
38 // necessarily gathered.
39 virtual void ToggleColumnVisibility(ColumnSpecifier column) = 0;
40
41 // Get the value of a column as an int64. Memory values are in bytes.
42 virtual int64_t GetColumnValue(ColumnSpecifier column, int row) = 0;
43
44 // If |row| is associated with a WebContents, return its SessionID. Otherwise,
45 // return -1.
46 virtual int32_t GetTabId(int row) = 0;
47
48 // Kill the process of |row|.
49 virtual void Kill(int row) = 0;
50};
51
52} // namespace task_management
53
54#endif // CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_TESTER_H_