- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / extensions / browser_action_test_util.h
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.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_BROWSER_ACTION_TEST_UTIL_H_
6 #define CHROME_BROWSER_EXTENSIONS_BROWSER_ACTION_TEST_UTIL_H_
7
8 #include <string>
9
10 #include "build/build_config.h"
11
12 class Browser;
13 class ExtensionAction;
14
15 namespace gfx {
16 class Image;
17 class Rect;
18 class Size;
19 }  // namespace gfx
20
21 class BrowserActionTestUtil {
22  public:
23   explicit BrowserActionTestUtil(Browser* browser) : browser_(browser) {}
24
25   // Returns the number of browser action buttons in the window toolbar.
26   int NumberOfBrowserActions();
27
28   // Returns the number of browser action currently visible.
29   int VisibleBrowserActions();
30
31 #if defined(TOOLKIT_VIEWS)
32   // Returns the ExtensionAction for the given index.
33   ExtensionAction* GetExtensionAction(int index);
34 #endif
35
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);
40
41   // Returns icon for the browser action at |index|.
42   gfx::Image GetIcon(int index);
43
44   // Simulates a user click on the browser action button at |index|.
45   void Press(int index);
46
47   // Returns the extension id of the extension at |index|.
48   std::string GetExtensionId(int index);
49
50   // Returns the current tooltip for the browser action button.
51   std::string GetTooltip(int index);
52
53   // Returns whether a browser action popup is being shown currently.
54   bool HasPopup();
55
56   // Returns the bounds of the current browser action popup.
57   gfx::Rect GetPopupBounds();
58
59   // Hides the given popup and returns whether the hide was successful.
60   bool HidePopup();
61
62   // Set how many icons should be visible.
63   void SetIconVisibilityCount(size_t icons);
64
65   // Returns the minimum allowed size of an extension popup.
66   static gfx::Size GetMinPopupSize();
67
68   // Returns the maximum allowed size of an extension popup.
69   static gfx::Size GetMaxPopupSize();
70
71  private:
72   Browser* browser_;  // weak
73 };
74
75 #endif  // CHROME_BROWSER_EXTENSIONS_BROWSER_ACTION_TEST_UTIL_H_