| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_BROWSER_ACTION_TEST_UTIL_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_BROWSER_ACTION_TEST_UTIL_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_BROWSER_ACTION_TEST_UTIL_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_BROWSER_ACTION_TEST_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" |
| 10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 11 | 12 |
| 12 class Browser; | 13 class Browser; |
| 13 class ExtensionAction; | 14 class ExtensionAction; |
| 14 | 15 |
| 15 namespace gfx { | 16 namespace gfx { |
| 17 class Image; |
| 16 class Rect; | 18 class Rect; |
| 17 class Size; | 19 class Size; |
| 18 } // namespace gfx | 20 } // namespace gfx |
| 19 | 21 |
| 20 class BrowserActionTestUtil { | 22 class BrowserActionTestUtil { |
| 21 public: | 23 public: |
| 22 explicit BrowserActionTestUtil(Browser* browser) : browser_(browser) {} | 24 explicit BrowserActionTestUtil(Browser* browser) : browser_(browser) {} |
| 23 | 25 |
| 24 // Returns the number of browser action buttons in the window toolbar. | 26 // Returns the number of browser action buttons in the window toolbar. |
| 25 int NumberOfBrowserActions(); | 27 int NumberOfBrowserActions(); |
| 26 | 28 |
| 27 // Returns the number of browser action currently visible. | 29 // Returns the number of browser action currently visible. |
| 28 int VisibleBrowserActions(); | 30 int VisibleBrowserActions(); |
| 29 | 31 |
| 30 #if defined(TOOLKIT_VIEWS) | 32 #if defined(TOOLKIT_VIEWS) |
| 31 // Returns the ExtensionAction for the given index. | 33 // Returns the ExtensionAction for the given index. |
| 32 ExtensionAction* GetExtensionAction(int index); | 34 ExtensionAction* GetExtensionAction(int index); |
| 33 #endif | 35 #endif |
| 34 | 36 |
| 35 // Returns whether the browser action at |index| has a non-null icon. Note | 37 // 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 | 38 // that the icon is loaded asynchronously, in which case you can wait for it |
| 37 // to load by calling WaitForBrowserActionUpdated. | 39 // to load by calling WaitForBrowserActionUpdated. |
| 38 bool HasIcon(int index); | 40 bool HasIcon(int index); |
| 39 | 41 |
| 42 // Returns icon for the browser action at |index|. |
| 43 gfx::Image GetIcon(int index); |
| 44 |
| 40 // Simulates a user click on the browser action button at |index|. | 45 // Simulates a user click on the browser action button at |index|. |
| 41 void Press(int index); | 46 void Press(int index); |
| 42 | 47 |
| 43 // Returns the extension id of the extension at |index|. | 48 // Returns the extension id of the extension at |index|. |
| 44 std::string GetExtensionId(int index); | 49 std::string GetExtensionId(int index); |
| 45 | 50 |
| 46 // Returns the current tooltip for the browser action button. | 51 // Returns the current tooltip for the browser action button. |
| 47 std::string GetTooltip(int index); | 52 std::string GetTooltip(int index); |
| 48 | 53 |
| 49 // Returns whether a browser action popup is being shown currently. | 54 // Returns whether a browser action popup is being shown currently. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 62 static gfx::Size GetMinPopupSize(); | 67 static gfx::Size GetMinPopupSize(); |
| 63 | 68 |
| 64 // Returns the maximum allowed size of an extension popup. | 69 // Returns the maximum allowed size of an extension popup. |
| 65 static gfx::Size GetMaxPopupSize(); | 70 static gfx::Size GetMaxPopupSize(); |
| 66 | 71 |
| 67 private: | 72 private: |
| 68 Browser* browser_; // weak | 73 Browser* browser_; // weak |
| 69 }; | 74 }; |
| 70 | 75 |
| 71 #endif // CHROME_BROWSER_EXTENSIONS_BROWSER_ACTION_TEST_UTIL_H_ | 76 #endif // CHROME_BROWSER_EXTENSIONS_BROWSER_ACTION_TEST_UTIL_H_ |
| OLD | NEW |