app_list: Re-enable people search.
[chromium-blink-merge.git] / chrome / browser / extensions / browser_action_test_util.h
blobd09000161115acc63e0b98fa2acf48d7d0eea36c
1 // Copyright (c) 2010 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_EXTENSIONS_BROWSER_ACTION_TEST_UTIL_H_
6 #define CHROME_BROWSER_EXTENSIONS_BROWSER_ACTION_TEST_UTIL_H_
8 #include <string>
10 #include "ui/gfx/native_widget_types.h"
12 class Browser;
13 class ToolbarActionsBarDelegate;
15 namespace gfx {
16 class Image;
17 class Rect;
18 class Size;
19 } // namespace gfx
21 class BrowserActionTestUtil {
22 public:
23 // Constructs a BrowserActionTestUtil that uses the |browser|'s default
24 // browser action container.
25 explicit BrowserActionTestUtil(Browser* browser)
26 : browser_(browser), bar_delegate_(nullptr) {}
28 // Constructs a BrowserActionTestUtil that will use the |bar_delegate| as the
29 // browser action container to test.
30 BrowserActionTestUtil(Browser* browser,
31 ToolbarActionsBarDelegate* bar_delegate)
32 : browser_(browser), bar_delegate_(bar_delegate) {}
34 // Returns the number of browser action buttons in the window toolbar.
35 int NumberOfBrowserActions();
37 // Returns the number of browser action currently visible.
38 int VisibleBrowserActions();
40 // Returns true if the overflow chevron is completely shown in the browser
41 // actions container (i.e., is visible and is within the bounds of the
42 // container).
43 bool IsChevronShowing();
45 // Inspects the extension popup for the action at the given index.
46 void InspectPopup(int index);
48 // Returns whether the browser action at |index| has a non-null icon. Note
49 // that the icon is loaded asynchronously, in which case you can wait for it
50 // to load by calling WaitForBrowserActionUpdated.
51 bool HasIcon(int index);
53 // Returns icon for the browser action at |index|.
54 gfx::Image GetIcon(int index);
56 // Simulates a user click on the browser action button at |index|.
57 void Press(int index);
59 // Returns the extension id of the extension at |index|.
60 std::string GetExtensionId(int index);
62 // Returns the current tooltip for the browser action button.
63 std::string GetTooltip(int index);
65 gfx::NativeView GetPopupNativeView();
67 // Returns whether a browser action popup is being shown currently.
68 bool HasPopup();
70 // Returns the size of the current browser action popup.
71 gfx::Size GetPopupSize();
73 // Hides the given popup and returns whether the hide was successful.
74 bool HidePopup();
76 // Tests that the button at the given |index| is displaying that it wants
77 // to run.
78 bool ActionButtonWantsToRun(size_t index);
80 // Tests that the overflow button is displaying an overflowed action wants
81 // to run.
82 bool OverflowedActionButtonWantsToRun();
84 // Returns the minimum allowed size of an extension popup.
85 static gfx::Size GetMinPopupSize();
87 // Returns the maximum allowed size of an extension popup.
88 static gfx::Size GetMaxPopupSize();
90 private:
91 Browser* browser_; // weak
93 // If non-null, this is a set view to test with, rather than using the
94 // |browser|'s default container.
95 ToolbarActionsBarDelegate* bar_delegate_; // weak
98 #endif // CHROME_BROWSER_EXTENSIONS_BROWSER_ACTION_TEST_UTIL_H_