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" |
(...skipping 19 matching lines...) Expand all Loading... |
30 int BrowserActionTestUtil::NumberOfBrowserActions() { | 30 int BrowserActionTestUtil::NumberOfBrowserActions() { |
31 return GetContainer(browser_)->num_browser_actions(); | 31 return GetContainer(browser_)->num_browser_actions(); |
32 } | 32 } |
33 | 33 |
34 int BrowserActionTestUtil::VisibleBrowserActions() { | 34 int BrowserActionTestUtil::VisibleBrowserActions() { |
35 return GetContainer(browser_)->VisibleBrowserActions(); | 35 return GetContainer(browser_)->VisibleBrowserActions(); |
36 } | 36 } |
37 | 37 |
38 ExtensionAction* BrowserActionTestUtil::GetExtensionAction(int index) { | 38 ExtensionAction* BrowserActionTestUtil::GetExtensionAction(int index) { |
39 return extensions::ExtensionActionManager::Get(browser_->profile())-> | 39 return extensions::ExtensionActionManager::Get(browser_->profile())-> |
40 GetBrowserAction(*GetContainer(browser_)->GetBrowserActionViewAt(index)-> | 40 GetBrowserAction(*GetContainer(browser_)->GetExtensionAt(index)); |
41 extension()); | |
42 } | 41 } |
43 | 42 |
44 void BrowserActionTestUtil::InspectPopup(int index) { | 43 void BrowserActionTestUtil::InspectPopup(int index) { |
45 GetContainer(browser_)->GetBrowserActionViewAt(index)-> | 44 GetContainer(browser_)->GetBrowserActionViewAt(index)-> |
46 view_controller()->InspectPopup(); | 45 GetExtensionActionViewController()->InspectPopup(); |
47 } | 46 } |
48 | 47 |
49 bool BrowserActionTestUtil::HasIcon(int index) { | 48 bool BrowserActionTestUtil::HasIcon(int index) { |
50 return !GetContainer(browser_)->GetBrowserActionViewAt(index)-> | 49 return !GetContainer(browser_)->GetBrowserActionViewAt(index)-> |
51 GetImage(views::Button::STATE_NORMAL).isNull(); | 50 GetImage(views::Button::STATE_NORMAL).isNull(); |
52 } | 51 } |
53 | 52 |
54 gfx::Image BrowserActionTestUtil::GetIcon(int index) { | 53 gfx::Image BrowserActionTestUtil::GetIcon(int index) { |
55 gfx::ImageSkia icon = GetContainer(browser_)->GetBrowserActionViewAt(index)-> | 54 gfx::ImageSkia icon = GetContainer(browser_)->GetBrowserActionViewAt(index)-> |
56 GetIconForTest(); | 55 GetIconForTest(); |
57 return gfx::Image(icon); | 56 return gfx::Image(icon); |
58 } | 57 } |
59 | 58 |
60 void BrowserActionTestUtil::Press(int index) { | 59 void BrowserActionTestUtil::Press(int index) { |
61 GetContainer(browser_)->GetBrowserActionViewAt(index)-> | 60 GetContainer(browser_)->GetBrowserActionViewAt(index)-> |
62 view_controller()->ExecuteActionByUser(); | 61 view_controller()->ExecuteActionByUser(); |
63 } | 62 } |
64 | 63 |
65 std::string BrowserActionTestUtil::GetExtensionId(int index) { | 64 std::string BrowserActionTestUtil::GetExtensionId(int index) { |
66 return GetContainer(browser_)->GetBrowserActionViewAt(index)-> | 65 return GetContainer(browser_)->GetExtensionAt(index)->id(); |
67 extension()->id(); | |
68 } | 66 } |
69 | 67 |
70 std::string BrowserActionTestUtil::GetTooltip(int index) { | 68 std::string BrowserActionTestUtil::GetTooltip(int index) { |
71 base::string16 text; | 69 base::string16 text; |
72 GetContainer(browser_)->GetBrowserActionViewAt(index)-> | 70 GetContainer(browser_)->GetBrowserActionViewAt(index)-> |
73 GetTooltipText(gfx::Point(), &text); | 71 GetTooltipText(gfx::Point(), &text); |
74 return base::UTF16ToUTF8(text); | 72 return base::UTF16ToUTF8(text); |
75 } | 73 } |
76 | 74 |
77 gfx::NativeView BrowserActionTestUtil::GetPopupNativeView() { | 75 gfx::NativeView BrowserActionTestUtil::GetPopupNativeView() { |
(...skipping 30 matching lines...) Expand all Loading... |
108 | 106 |
109 // static | 107 // static |
110 gfx::Size BrowserActionTestUtil::GetMinPopupSize() { | 108 gfx::Size BrowserActionTestUtil::GetMinPopupSize() { |
111 return gfx::Size(ExtensionPopup::kMinWidth, ExtensionPopup::kMinHeight); | 109 return gfx::Size(ExtensionPopup::kMinWidth, ExtensionPopup::kMinHeight); |
112 } | 110 } |
113 | 111 |
114 // static | 112 // static |
115 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { | 113 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { |
116 return gfx::Size(ExtensionPopup::kMaxWidth, ExtensionPopup::kMaxHeight); | 114 return gfx::Size(ExtensionPopup::kMaxWidth, ExtensionPopup::kMaxHeight); |
117 } | 115 } |
OLD | NEW |