1 // Copyright (c) 2011 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_MANAGER_TASK_MANAGER_BROWSERTEST_UTIL_H_
6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_BROWSERTEST_UTIL_H_
8 #include "base/strings/string16.h"
10 namespace task_manager
{
11 namespace browsertest_util
{
13 // Runs the message loop, observing the task manager, until there are exactly
14 // |resource_count| many resources whose titles match the pattern
15 // |title_pattern|. The match is done via string_util's base::MatchPattern, so
16 // |title_pattern| may contain wildcards like "*".
18 // If the wait times out, this test will trigger a gtest failure. To get
19 // meaningful errors, tests should wrap invocations of this function with
20 // ASSERT_NO_FATAL_FAILURE().
21 void WaitForTaskManagerRows(int resource_count
,
22 const base::string16
& title_pattern
);
24 // ASCII matcher convenience functions for use with WaitForTaskManagerRows()
25 base::string16
MatchTab(const char* title
); // "Tab: " + title
26 base::string16
MatchAnyTab(); // "Tab: *"
27 base::string16
MatchAboutBlankTab(); // "Tab: about:blank"
28 base::string16
MatchExtension(const char* title
); // "Extension: " + title
29 base::string16
MatchAnyExtension(); // "Extension: *"
30 base::string16
MatchApp(const char* title
); // "App: " + title
31 base::string16
MatchAnyApp(); // "App: *"
32 base::string16
MatchWebView(const char* title
); // "WebView: " + title
33 base::string16
MatchAnyWebView(); // "WebView: *"
34 base::string16
MatchBackground(const char* title
); // "Background: " + title
35 base::string16
MatchAnyBackground(); // "Background: *"
36 base::string16
MatchPrint(const char* title
); // "Print: " + title
37 base::string16
MatchAnyPrint(); // "Print: *"
38 base::string16
MatchSubframe(const char* title
); // "Subframe: " + title
39 base::string16
MatchAnySubframe(); // "Subframe: *"
41 } // namespace browsertest_util
42 } // namespace task_manager
44 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_BROWSERTEST_UTIL_H_