| 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 24 matching lines...) Expand all Loading... |
| 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_)->GetBrowserActionViewAt(index)->button()-> | 44 GetContainer(browser_)->GetBrowserActionViewAt(index)->button()-> |
| 45 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)->button()-> |
| 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 button()->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()->ExecuteBrowserAction(); | 61 button()->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 BrowserActionButton* button = |
| 66 GetContainer(browser_)->GetBrowserActionViewAt(index)->button(); | 66 GetContainer(browser_)->GetBrowserActionViewAt(index)->button(); |
| 67 return button->extension()->id(); | 67 return button->extension()->id(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 std::string BrowserActionTestUtil::GetTooltip(int index) { | 70 std::string BrowserActionTestUtil::GetTooltip(int index) { |
| 71 base::string16 text; | 71 base::string16 text; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 95 GetContainer(browser_)->TestSetIconVisibilityCount(icons); | 95 GetContainer(browser_)->TestSetIconVisibilityCount(icons); |
| 96 } | 96 } |
| 97 | 97 |
| 98 gfx::Size BrowserActionTestUtil::GetMinPopupSize() { | 98 gfx::Size BrowserActionTestUtil::GetMinPopupSize() { |
| 99 return gfx::Size(ExtensionPopup::kMinWidth, ExtensionPopup::kMinHeight); | 99 return gfx::Size(ExtensionPopup::kMinWidth, ExtensionPopup::kMinHeight); |
| 100 } | 100 } |
| 101 | 101 |
| 102 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { | 102 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { |
| 103 return gfx::Size(ExtensionPopup::kMaxWidth, ExtensionPopup::kMaxHeight); | 103 return gfx::Size(ExtensionPopup::kMaxWidth, ExtensionPopup::kMaxHeight); |
| 104 } | 104 } |
| OLD | NEW |