OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/extensions/extension_action_manager.h" | 8 #include "chrome/browser/extensions/extension_action_manager.h" |
9 #include "chrome/browser/extensions/extension_toolbar_model.h" | 9 #include "chrome/browser/extensions/extension_toolbar_model.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/browser_window.h" | 11 #include "chrome/browser/ui/browser_window.h" |
12 #include "chrome/browser/ui/browser_window_testing_views.h" | 12 #include "chrome/browser/ui/browser_window_testing_views.h" |
13 #include "chrome/browser/ui/views/extensions/extension_action_view_controller.h" | 13 #include "chrome/browser/ui/views/extensions/extension_action_view_controller_vi
ews.h" |
14 #include "chrome/browser/ui/views/extensions/extension_popup.h" | 14 #include "chrome/browser/ui/views/extensions/extension_popup.h" |
15 #include "chrome/browser/ui/views/toolbar/browser_action_view.h" | 15 #include "chrome/browser/ui/views/toolbar/browser_action_view.h" |
16 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" | 16 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
17 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 17 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
18 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
19 #include "ui/gfx/image/image.h" | 19 #include "ui/gfx/image/image.h" |
20 #include "ui/gfx/rect.h" | 20 #include "ui/gfx/rect.h" |
21 #include "ui/gfx/size.h" | 21 #include "ui/gfx/size.h" |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 BrowserActionsContainer* GetContainer(Browser* browser) { | 25 BrowserActionsContainer* GetContainer(Browser* browser) { |
26 return browser->window()->GetBrowserWindowTesting()->GetToolbarView()-> | 26 return browser->window()->GetBrowserWindowTesting()->GetToolbarView()-> |
27 browser_actions(); | 27 browser_actions(); |
28 } | 28 } |
29 | 29 |
30 } // namespace | 30 } // namespace |
31 | 31 |
32 int BrowserActionTestUtil::NumberOfBrowserActions() { | 32 int BrowserActionTestUtil::NumberOfBrowserActions() { |
33 return GetContainer(browser_)->num_browser_actions(); | 33 return GetContainer(browser_)->num_browser_actions(); |
34 } | 34 } |
35 | 35 |
36 int BrowserActionTestUtil::VisibleBrowserActions() { | 36 int BrowserActionTestUtil::VisibleBrowserActions() { |
37 return GetContainer(browser_)->VisibleBrowserActions(); | 37 return GetContainer(browser_)->VisibleBrowserActions(); |
38 } | 38 } |
39 | 39 |
40 void BrowserActionTestUtil::InspectPopup(int index) { | 40 void BrowserActionTestUtil::InspectPopup(int index) { |
41 BrowserActionView* view = | 41 BrowserActionView* view = |
42 GetContainer(browser_)->GetBrowserActionViewAt(index); | 42 GetContainer(browser_)->GetBrowserActionViewAt(index); |
43 static_cast<ExtensionActionViewController*>(view->view_controller())-> | 43 static_cast<ExtensionActionViewControllerViews*>(view->view_controller())-> |
44 InspectPopup(); | 44 InspectPopup(); |
45 } | 45 } |
46 | 46 |
47 bool BrowserActionTestUtil::HasIcon(int index) { | 47 bool BrowserActionTestUtil::HasIcon(int index) { |
48 return !GetContainer(browser_)->GetBrowserActionViewAt(index)-> | 48 return !GetContainer(browser_)->GetBrowserActionViewAt(index)-> |
49 GetImage(views::Button::STATE_NORMAL).isNull(); | 49 GetImage(views::Button::STATE_NORMAL).isNull(); |
50 } | 50 } |
51 | 51 |
52 gfx::Image BrowserActionTestUtil::GetIcon(int index) { | 52 gfx::Image BrowserActionTestUtil::GetIcon(int index) { |
53 gfx::ImageSkia icon = GetContainer(browser_)->GetBrowserActionViewAt(index)-> | 53 gfx::ImageSkia icon = GetContainer(browser_)->GetBrowserActionViewAt(index)-> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 // static | 107 // static |
108 gfx::Size BrowserActionTestUtil::GetMinPopupSize() { | 108 gfx::Size BrowserActionTestUtil::GetMinPopupSize() { |
109 return gfx::Size(ExtensionPopup::kMinWidth, ExtensionPopup::kMinHeight); | 109 return gfx::Size(ExtensionPopup::kMinWidth, ExtensionPopup::kMinHeight); |
110 } | 110 } |
111 | 111 |
112 // static | 112 // static |
113 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { | 113 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { |
114 return gfx::Size(ExtensionPopup::kMaxWidth, ExtensionPopup::kMaxHeight); | 114 return gfx::Size(ExtensionPopup::kMaxWidth, ExtensionPopup::kMaxHeight); |
115 } | 115 } |
OLD | NEW |