1 // Copyright 2015 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.
5 #ifndef CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGEMENT_BROWSERTEST_UTIL_H_
6 #define CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGEMENT_BROWSERTEST_UTIL_H_
8 #include "chrome/browser/task_management/providers/task_provider_observer.h"
9 #include "chrome/browser/task_management/providers/web_contents/web_contents_tags_manager.h"
10 #include "chrome/browser/task_management/providers/web_contents/web_contents_task_provider.h"
12 namespace task_management
{
14 // Defines a test class that will act as a task manager that is designed to
15 // only observe the WebContents-based tasks.
16 class MockWebContentsTaskManager
: public TaskProviderObserver
{
18 MockWebContentsTaskManager();
19 ~MockWebContentsTaskManager() override
;
21 // task_management::TaskProviderObserver:
22 void TaskAdded(Task
* task
) override
;
23 void TaskRemoved(Task
* task
) override
;
25 // Start / Stop observing the WebContentsTaskProvider.
26 void StartObserving();
29 const std::vector
<Task
*>& tasks() const { return tasks_
; }
32 std::vector
<Task
*> tasks_
;
33 WebContentsTaskProvider provider_
;
35 DISALLOW_COPY_AND_ASSIGN(MockWebContentsTaskManager
);
38 } // namespace task_management
40 #endif // CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGEMENT_BROWSERTEST_UTIL_H_