Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Side by Side Diff: chrome/browser/ui/views/toolbar/browser_action_test_util_views.cc

Issue 419023002: Move ShowPopup logic from BrowserActionsContainer to BrowserActionView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 23 matching lines...) Expand all
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 button()->extension());
41 } 41 }
42 42
43 void BrowserActionTestUtil::InspectPopup(int index) { 43 void BrowserActionTestUtil::InspectPopup(int index) {
44 GetContainer(browser_)->InspectPopup(GetExtensionAction(index)); 44 BrowserActionButton* button =
45 GetContainer(browser_)->GetBrowserActionViewAt(index)->button();
46 static_cast<ExtensionContextMenuModel::PopupDelegate*>(button)->InspectPopup(
47 button->browser_action());
45 } 48 }
46 49
47 bool BrowserActionTestUtil::HasIcon(int index) { 50 bool BrowserActionTestUtil::HasIcon(int index) {
48 return !GetContainer(browser_)->GetBrowserActionViewAt(index)->button()-> 51 return !GetContainer(browser_)->GetBrowserActionViewAt(index)->button()->
49 GetImage(views::Button::STATE_NORMAL).isNull(); 52 GetImage(views::Button::STATE_NORMAL).isNull();
50 } 53 }
51 54
52 gfx::Image BrowserActionTestUtil::GetIcon(int index) { 55 gfx::Image BrowserActionTestUtil::GetIcon(int index) {
53 gfx::ImageSkia icon = GetContainer(browser_)->GetBrowserActionViewAt(index)-> 56 gfx::ImageSkia icon = GetContainer(browser_)->GetBrowserActionViewAt(index)->
54 button()->GetIconForTest(); 57 button()->GetIconForTest();
55 return gfx::Image(icon); 58 return gfx::Image(icon);
56 } 59 }
57 60
58 void BrowserActionTestUtil::Press(int index) { 61 void BrowserActionTestUtil::Press(int index) {
59 GetContainer(browser_)->TestExecuteBrowserAction(index); 62 GetContainer(browser_)->GetBrowserActionViewAt(index)
63 ->button()->ExecuteBrowserAction();
Peter Kasting 2014/07/26 02:33:20 Nit: Personally, "operators go on the ends of line
Devlin 2014/07/29 19:07:14 Yeah, git cl format formed a bad habit before we d
60 } 64 }
61 65
62 std::string BrowserActionTestUtil::GetExtensionId(int index) { 66 std::string BrowserActionTestUtil::GetExtensionId(int index) {
63 BrowserActionButton* button = 67 BrowserActionButton* button =
64 GetContainer(browser_)->GetBrowserActionViewAt(index)->button(); 68 GetContainer(browser_)->GetBrowserActionViewAt(index)->button();
65 return button->extension()->id(); 69 return button->extension()->id();
66 } 70 }
67 71
68 std::string BrowserActionTestUtil::GetTooltip(int index) { 72 std::string BrowserActionTestUtil::GetTooltip(int index) {
69 base::string16 text; 73 base::string16 text;
70 GetContainer(browser_)->GetBrowserActionViewAt(index)->button()-> 74 GetContainer(browser_)->GetBrowserActionViewAt(index)->button()->
71 GetTooltipText(gfx::Point(), &text); 75 GetTooltipText(gfx::Point(), &text);
72 return base::UTF16ToUTF8(text); 76 return base::UTF16ToUTF8(text);
73 } 77 }
74 78
75 gfx::NativeView BrowserActionTestUtil::GetPopupNativeView() { 79 gfx::NativeView BrowserActionTestUtil::GetPopupNativeView() {
76 return GetContainer(browser_)->TestGetPopup()->GetWidget()->GetNativeView(); 80 return GetContainer(browser_)->TestGetPopup()->GetWidget()->GetNativeView();
77 } 81 }
78 82
79 bool BrowserActionTestUtil::HasPopup() { 83 bool BrowserActionTestUtil::HasPopup() {
80 return GetContainer(browser_)->TestGetPopup() != NULL; 84 return GetContainer(browser_)->TestGetPopup() != NULL;
81 } 85 }
82 86
83 gfx::Rect BrowserActionTestUtil::GetPopupBounds() { 87 gfx::Rect BrowserActionTestUtil::GetPopupBounds() {
84 return GetContainer(browser_)->TestGetPopup()->bounds(); 88 return GetContainer(browser_)->TestGetPopup()->bounds();
85 } 89 }
86 90
87 bool BrowserActionTestUtil::HidePopup() { 91 bool BrowserActionTestUtil::HidePopup() {
88 GetContainer(browser_)->HidePopup(); 92 GetContainer(browser_)->HideActivePopup();
89 return !HasPopup(); 93 return !HasPopup();
90 } 94 }
91 95
92 void BrowserActionTestUtil::SetIconVisibilityCount(size_t icons) { 96 void BrowserActionTestUtil::SetIconVisibilityCount(size_t icons) {
93 GetContainer(browser_)->TestSetIconVisibilityCount(icons); 97 GetContainer(browser_)->TestSetIconVisibilityCount(icons);
94 } 98 }
95 99
96 gfx::Size BrowserActionTestUtil::GetMinPopupSize() { 100 gfx::Size BrowserActionTestUtil::GetMinPopupSize() {
97 return gfx::Size(ExtensionPopup::kMinWidth, ExtensionPopup::kMinHeight); 101 return gfx::Size(ExtensionPopup::kMinWidth, ExtensionPopup::kMinHeight);
98 } 102 }
99 103
100 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { 104 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() {
101 return gfx::Size(ExtensionPopup::kMaxWidth, ExtensionPopup::kMaxHeight); 105 return gfx::Size(ExtensionPopup::kMaxWidth, ExtensionPopup::kMaxHeight);
102 } 106 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698