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

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: Created 4 years, 8 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..cfb2e779d36a14efcc656b00db5b186b5e746874 100644
--- a/chrome/browser/task_manager/task_manager_browsertest_util.h
+++ b/chrome/browser/task_manager/task_manager_browsertest_util.h
@@ -7,14 +7,51 @@
#include <stddef.h>
+#include <memory>
+
#include "base/strings/string16.h"
+namespace content {
+class WebContents;
+}
+
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 TaskManagerTesterInterface {
+ public:
+ virtual ~TaskManagerTesterInterface() {}
+
+ // 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;
+
+ // 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 TaskManagerTesterInterface backed by the current task manager.
+std::unique_ptr<TaskManagerTesterInterface> GetTaskManagerTester();
// Runs the message loop, observing the task manager, until there are exactly
// |resource_count| many resources whose titles match the pattern
@@ -27,16 +64,6 @@ 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.
-};
-
// 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
// |column_specifier|. As with WaitForTaskManagerRows(), |title_pattern| is

Powered by Google App Engine
This is Rietveld 408576698