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

Unified Diff: chrome/browser/task_manager/task_manager_browsertest_util.h

Issue 1922683003: Make old task manager tests work against new task manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix OSX function call namespace Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/task_manager/task_manager_browsertest_util.h
diff --git a/chrome/browser/task_manager/task_manager_browsertest_util.h b/chrome/browser/task_manager/task_manager_browsertest_util.h
index 7f9902a164b3b9993c22194cb9d9fff32df62b1c..c6805aafb119815667858ec60478a39f8a9d5aa4 100644
--- a/chrome/browser/task_manager/task_manager_browsertest_util.h
+++ b/chrome/browser/task_manager/task_manager_browsertest_util.h
@@ -7,14 +7,58 @@
#include <stddef.h>
+#include <memory>
+
#include "base/strings/string16.h"
+namespace content {
+class WebContents;
+}
+
+// TODO(nick): Move everything here (except for LegacyTaskManagerTesterImpl)
+// into the task_management namespace.
namespace task_manager {
namespace browsertest_util {
-// For the old task manager browser tests, we must call this to disable the
-// use of the new implementation and revert back to the old one.
-void EnableOldTaskManager();
+// Specifies some integer-valued column of numeric data reported by the task
+// manager model. Please add more here as needed by tests.
+enum ColumnSpecifier {
+ V8_MEMORY,
+ V8_MEMORY_USED,
+ SQLITE_MEMORY_USED,
+
+ COLUMN_NONE, // Default value.
+};
+
+// An adapter that abstracts away the difference of old vs. new task manager.
+class TaskManagerTester {
+ public:
+ virtual ~TaskManagerTester() {}
+
+ // Get the number of rows currently in the task manager.
+ virtual int GetRowCount() = 0;
+
+ // Get the title text of a particular |row|.
+ virtual base::string16 GetRowTitle(int row) = 0;
+
+ // Hide or show a column. If a column is not visible its stats are not
+ // necessarily gathered.
+ virtual void ToggleColumnVisibility(ColumnSpecifier column) = 0;
+
+ // Get the value of a column as an int64. Memory values are in bytes.
+ virtual int64_t GetColumnValue(ColumnSpecifier column, int row) = 0;
+
+ // If |row| is associated with a WebContents, return its SessionID. Otherwise,
+ // return -1.
+ virtual int32_t GetTabId(int row) = 0;
+
+ // Kill the process of |row|.
+ virtual void Kill(int row) = 0;
+};
+
+// Creates a TaskManagerTester backed by the current task manager. The task
+// manager should already be visible when you call this function.
+std::unique_ptr<TaskManagerTester> GetTaskManagerTester();
// Runs the message loop, observing the task manager, until there are exactly
// |resource_count| many resources whose titles match the pattern
@@ -27,15 +71,8 @@ void EnableOldTaskManager();
void WaitForTaskManagerRows(int resource_count,
const base::string16& title_pattern);
-// Specifies some integer-valued column of numeric data reported by the task
-// manager model. Please add more here as needed by tests.
-enum ColumnSpecifier {
- V8_MEMORY,
- V8_MEMORY_USED,
- SQLITE_MEMORY_USED,
-
- COLUMN_NONE, // Default value.
-};
+// Make the indicated TaskManager column be visible.
+void ShowColumn(ColumnSpecifier column_specifier);
// Waits for the row identified by |title_pattern| to be showing a numeric data
// value of at least |min_column_value| in the task manager column identified by
« no previous file with comments | « chrome/browser/task_manager/task_manager_browsertest.cc ('k') | chrome/browser/task_manager/task_manager_browsertest_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698