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/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 return GetContainer(browser_)->num_browser_actions(); | 30 return GetContainer(browser_)->num_browser_actions(); |
31 } | 31 } |
32 | 32 |
33 int BrowserActionTestUtil::VisibleBrowserActions() { | 33 int BrowserActionTestUtil::VisibleBrowserActions() { |
34 return GetContainer(browser_)->VisibleBrowserActions(); | 34 return GetContainer(browser_)->VisibleBrowserActions(); |
35 } | 35 } |
36 | 36 |
37 ExtensionAction* BrowserActionTestUtil::GetExtensionAction(int index) { | 37 ExtensionAction* BrowserActionTestUtil::GetExtensionAction(int index) { |
38 return extensions::ExtensionActionManager::Get(browser_->profile())-> | 38 return extensions::ExtensionActionManager::Get(browser_->profile())-> |
39 GetBrowserAction(*GetContainer(browser_)->GetBrowserActionViewAt(index)-> | 39 GetBrowserAction(*GetContainer(browser_)->GetBrowserActionViewAt(index)-> |
40 button()->extension()); | 40 extension()); |
41 } | 41 } |
42 | 42 |
43 void BrowserActionTestUtil::InspectPopup(int index) { | 43 void BrowserActionTestUtil::InspectPopup(int index) { |
44 GetContainer(browser_)->GetBrowserActionViewAt(index)->button()-> | 44 GetContainer(browser_)->GetBrowserActionViewAt(index)-> |
45 view_controller()->InspectPopup(); | 45 view_controller()->InspectPopup(); |
46 } | 46 } |
47 | 47 |
48 bool BrowserActionTestUtil::HasIcon(int index) { | 48 bool BrowserActionTestUtil::HasIcon(int index) { |
49 return !GetContainer(browser_)->GetBrowserActionViewAt(index)->button()-> | 49 return !GetContainer(browser_)->GetBrowserActionViewAt(index)-> |
50 GetImage(views::Button::STATE_NORMAL).isNull(); | 50 GetImage(views::Button::STATE_NORMAL).isNull(); |
51 } | 51 } |
52 | 52 |
53 gfx::Image BrowserActionTestUtil::GetIcon(int index) { | 53 gfx::Image BrowserActionTestUtil::GetIcon(int index) { |
54 gfx::ImageSkia icon = GetContainer(browser_)->GetBrowserActionViewAt(index)-> | 54 gfx::ImageSkia icon = GetContainer(browser_)->GetBrowserActionViewAt(index)-> |
55 button()->GetIconForTest(); | 55 GetIconForTest(); |
56 return gfx::Image(icon); | 56 return gfx::Image(icon); |
57 } | 57 } |
58 | 58 |
59 void BrowserActionTestUtil::Press(int index) { | 59 void BrowserActionTestUtil::Press(int index) { |
60 GetContainer(browser_)->GetBrowserActionViewAt(index)-> | 60 GetContainer(browser_)->GetBrowserActionViewAt(index)-> |
61 button()->view_controller()->ExecuteActionByUser(); | 61 view_controller()->ExecuteActionByUser(); |
62 } | 62 } |
63 | 63 |
64 std::string BrowserActionTestUtil::GetExtensionId(int index) { | 64 std::string BrowserActionTestUtil::GetExtensionId(int index) { |
65 BrowserActionButton* button = | 65 return GetContainer(browser_)->GetBrowserActionViewAt(index)-> |
66 GetContainer(browser_)->GetBrowserActionViewAt(index)->button(); | 66 extension()->id(); |
67 return button->extension()->id(); | |
68 } | 67 } |
69 | 68 |
70 std::string BrowserActionTestUtil::GetTooltip(int index) { | 69 std::string BrowserActionTestUtil::GetTooltip(int index) { |
71 base::string16 text; | 70 base::string16 text; |
72 GetContainer(browser_)->GetBrowserActionViewAt(index)->button()-> | 71 GetContainer(browser_)->GetBrowserActionViewAt(index)-> |
73 GetTooltipText(gfx::Point(), &text); | 72 GetTooltipText(gfx::Point(), &text); |
74 return base::UTF16ToUTF8(text); | 73 return base::UTF16ToUTF8(text); |
75 } | 74 } |
76 | 75 |
77 gfx::NativeView BrowserActionTestUtil::GetPopupNativeView() { | 76 gfx::NativeView BrowserActionTestUtil::GetPopupNativeView() { |
78 return GetContainer(browser_)->TestGetPopup()->GetWidget()->GetNativeView(); | 77 return GetContainer(browser_)->TestGetPopup()->GetWidget()->GetNativeView(); |
79 } | 78 } |
80 | 79 |
81 bool BrowserActionTestUtil::HasPopup() { | 80 bool BrowserActionTestUtil::HasPopup() { |
82 return GetContainer(browser_)->TestGetPopup() != NULL; | 81 return GetContainer(browser_)->TestGetPopup() != NULL; |
83 } | 82 } |
(...skipping 11 matching lines...) Expand all Loading... |
95 GetContainer(browser_)->TestSetIconVisibilityCount(icons); | 94 GetContainer(browser_)->TestSetIconVisibilityCount(icons); |
96 } | 95 } |
97 | 96 |
98 gfx::Size BrowserActionTestUtil::GetMinPopupSize() { | 97 gfx::Size BrowserActionTestUtil::GetMinPopupSize() { |
99 return gfx::Size(ExtensionPopup::kMinWidth, ExtensionPopup::kMinHeight); | 98 return gfx::Size(ExtensionPopup::kMinWidth, ExtensionPopup::kMinHeight); |
100 } | 99 } |
101 | 100 |
102 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { | 101 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { |
103 return gfx::Size(ExtensionPopup::kMaxWidth, ExtensionPopup::kMaxHeight); | 102 return gfx::Size(ExtensionPopup::kMaxWidth, ExtensionPopup::kMaxHeight); |
104 } | 103 } |
OLD | NEW |