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_
10 #include "build/build_config.h"
13 class ExtensionAction
;
21 class BrowserActionTestUtil
{
23 explicit BrowserActionTestUtil(Browser
* browser
) : browser_(browser
) {}
25 // Returns the number of browser action buttons in the window toolbar.
26 int NumberOfBrowserActions();
28 // Returns the number of browser action currently visible.
29 int VisibleBrowserActions();
31 #if defined(TOOLKIT_VIEWS)
32 // Returns the ExtensionAction for the given index.
33 ExtensionAction
* GetExtensionAction(int index
);
36 // Returns whether the browser action at |index| has a non-null icon. Note
37 // that the icon is loaded asynchronously, in which case you can wait for it
38 // to load by calling WaitForBrowserActionUpdated.
39 bool HasIcon(int index
);
41 // Returns icon for the browser action at |index|.
42 gfx::Image
GetIcon(int index
);
44 // Simulates a user click on the browser action button at |index|.
45 void Press(int index
);
47 // Returns the extension id of the extension at |index|.
48 std::string
GetExtensionId(int index
);
50 // Returns the current tooltip for the browser action button.
51 std::string
GetTooltip(int index
);
53 // Returns whether a browser action popup is being shown currently.
56 // Returns the bounds of the current browser action popup.
57 gfx::Rect
GetPopupBounds();
59 // Hides the given popup and returns whether the hide was successful.
62 // Set how many icons should be visible.
63 void SetIconVisibilityCount(size_t icons
);
65 // Returns the minimum allowed size of an extension popup.
66 static gfx::Size
GetMinPopupSize();
68 // Returns the maximum allowed size of an extension popup.
69 static gfx::Size
GetMaxPopupSize();
72 Browser
* browser_
; // weak
75 #endif // CHROME_BROWSER_EXTENSIONS_BROWSER_ACTION_TEST_UTIL_H_