| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "chrome/browser/extensions/browser_action_test_util.h" | 5 #include "chrome/browser/extensions/browser_action_test_util.h" |
| 6 | 6 |
| 7 #include "base/gfx/rect.h" |
| 8 #include "base/gfx/size.h" |
| 7 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/browser.h" | 10 #include "chrome/browser/browser.h" |
| 9 #include "chrome/browser/browser_window.h" | 11 #include "chrome/browser/browser_window.h" |
| 10 #include "chrome/browser/views/browser_actions_container.h" | 12 #include "chrome/browser/views/browser_actions_container.h" |
| 11 #include "chrome/browser/views/extensions/extension_popup.h" | 13 #include "chrome/browser/views/extensions/extension_popup.h" |
| 12 #include "chrome/browser/views/toolbar_view.h" | 14 #include "chrome/browser/views/toolbar_view.h" |
| 13 #include "chrome/test/in_process_browser_test.h" | 15 #include "chrome/test/in_process_browser_test.h" |
| 14 #include "chrome/test/ui_test_utils.h" | 16 #include "chrome/test/ui_test_utils.h" |
| 15 | 17 |
| 16 namespace { | 18 namespace { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 36 void BrowserActionTestUtil::Press(int index) { | 38 void BrowserActionTestUtil::Press(int index) { |
| 37 GetContainer(browser_)->TestExecuteBrowserAction(index); | 39 GetContainer(browser_)->TestExecuteBrowserAction(index); |
| 38 } | 40 } |
| 39 | 41 |
| 40 std::string BrowserActionTestUtil::GetTooltip(int index) { | 42 std::string BrowserActionTestUtil::GetTooltip(int index) { |
| 41 std::wstring text; | 43 std::wstring text; |
| 42 GetContainer(browser_)->GetBrowserActionViewAt(0)->button()-> | 44 GetContainer(browser_)->GetBrowserActionViewAt(0)->button()-> |
| 43 GetTooltipText(0, 0, &text); | 45 GetTooltipText(0, 0, &text); |
| 44 return WideToUTF8(text); | 46 return WideToUTF8(text); |
| 45 } | 47 } |
| 48 |
| 49 bool BrowserActionTestUtil::HasPopup() { |
| 50 return GetContainer(browser_)->TestGetPopup() != NULL; |
| 51 } |
| 52 |
| 53 gfx::Rect BrowserActionTestUtil::GetPopupBounds() { |
| 54 return GetContainer(browser_)->TestGetPopup()->view()->bounds(); |
| 55 } |
| 56 |
| 57 bool BrowserActionTestUtil::HidePopup() { |
| 58 BrowserActionsContainer* container = GetContainer(browser_); |
| 59 container->HidePopup(); |
| 60 return !HasPopup(); |
| 61 } |
| 62 |
| 63 gfx::Size BrowserActionTestUtil::GetMinPopupSize() { |
| 64 return gfx::Size(ExtensionPopup::kMinWidth, ExtensionPopup::kMinHeight); |
| 65 } |
| 66 |
| 67 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { |
| 68 return gfx::Size(ExtensionPopup::kMaxWidth, ExtensionPopup::kMaxHeight); |
| 69 } |
| OLD | NEW |