Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / extensions / browser_action_test_util.h
blob556661f52a9f0f3b3185442e35816673405dbe69
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 "build/build_config.h"
12 class Browser;
13 class ExtensionAction;
15 namespace gfx {
16 class Image;
17 class Rect;
18 class Size;
19 } // namespace gfx
21 class BrowserActionTestUtil {
22 public:
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);
34 #endif
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.
54 bool HasPopup();
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.
60 bool HidePopup();
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();
71 private:
72 Browser* browser_; // weak
75 #endif // CHROME_BROWSER_EXTENSIONS_BROWSER_ACTION_TEST_UTIL_H_