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"
11 #include "ui/gfx/native_widget_types.h"
14 class ExtensionAction;
22 class BrowserActionTestUtil {
24 explicit BrowserActionTestUtil(Browser* browser) : browser_(browser) {}
26 // Returns the number of browser action buttons in the window toolbar.
27 int NumberOfBrowserActions();
29 // Returns the number of browser action currently visible.
30 int VisibleBrowserActions();
32 // Inspects the extension popup for the action at the given index.
33 void InspectPopup(int index);
35 // Returns whether the browser action at |index| has a non-null icon. Note
36 // that the icon is loaded asynchronously, in which case you can wait for it
37 // to load by calling WaitForBrowserActionUpdated.
38 bool HasIcon(int index);
40 // Returns icon for the browser action at |index|.
41 gfx::Image GetIcon(int index);
43 // Simulates a user click on the browser action button at |index|.
44 void Press(int index);
46 // Returns the extension id of the extension at |index|.
47 std::string GetExtensionId(int index);
49 // Returns the current tooltip for the browser action button.
50 std::string GetTooltip(int index);
52 gfx::NativeView GetPopupNativeView();
54 // Returns whether a browser action popup is being shown currently.
57 // Returns the size of the current browser action popup.
58 gfx::Size GetPopupSize();
60 // Hides the given popup and returns whether the hide was successful.
63 // Set how many icons should be visible.
64 void SetIconVisibilityCount(size_t icons);
66 // Disables animation.
67 static void DisableAnimations();
70 static void EnableAnimations();
72 // Returns the minimum allowed size of an extension popup.
73 static gfx::Size GetMinPopupSize();
75 // Returns the maximum allowed size of an extension popup.
76 static gfx::Size GetMaxPopupSize();
79 Browser* browser_; // weak
82 #endif // CHROME_BROWSER_EXTENSIONS_BROWSER_ACTION_TEST_UTIL_H_