Index: ash/common/system/tray/tray_details_view_unittest.cc |
diff --git a/ash/common/system/tray/tray_details_view_unittest.cc b/ash/common/system/tray/tray_details_view_unittest.cc |
index 054adf1f62ce93a4791bbfccaa7eba2d7843a2e6..42c4efb7974dd7792f5d3538de2c4c09ca1523f6 100644 |
--- a/ash/common/system/tray/tray_details_view_unittest.cc |
+++ b/ash/common/system/tray/tray_details_view_unittest.cc |
@@ -4,7 +4,6 @@ |
#include "ash/common/system/tray/tray_details_view.h" |
-#include "ash/common/material_design/material_design_controller.h" |
#include "ash/common/system/tray/hover_highlight_view.h" |
#include "ash/common/system/tray/special_popup_row.h" |
#include "ash/common/system/tray/system_tray.h" |
@@ -25,37 +24,36 @@ |
namespace { |
-class TestDetailsView : public TrayDetailsView { |
+class TestDetailsView : public TrayDetailsView, |
+ public ViewClickListener, |
+ public views::ButtonListener { |
public: |
explicit TestDetailsView(SystemTrayItem* owner) : TrayDetailsView(owner) { |
// Uses bluetooth label for testing purpose. It can be changed to any |
// string_id. |
- CreateTitleRow(IDS_ASH_STATUS_TRAY_BLUETOOTH); |
- } |
- |
- ~TestDetailsView() override {} |
- |
- TrayPopupHeaderButton* tray_popup_header_button() { |
- return tray_popup_header_button_; |
- } |
- |
- void FocusTitleRow() { title_row()->content()->RequestFocus(); } |
- |
- // TrayDetailsView: |
- void CreateExtraTitleRowButtons() override { |
- // TODO(tdanderson): Add test coverage for material design buttons in the |
- // title row once they are implemented. |
- if (MaterialDesignController::IsSystemTrayMenuMaterial()) |
- return; |
- |
+ CreateSpecialRow(IDS_ASH_STATUS_TRAY_BLUETOOTH, this); |
tray_popup_header_button_ = |
new TrayPopupHeaderButton(this, IDR_AURA_UBER_TRAY_BLUETOOTH_ENABLED, |
IDR_AURA_UBER_TRAY_BLUETOOTH_DISABLED, |
IDR_AURA_UBER_TRAY_BLUETOOTH_ENABLED_HOVER, |
IDR_AURA_UBER_TRAY_BLUETOOTH_DISABLED_HOVER, |
IDS_ASH_STATUS_TRAY_BLUETOOTH); |
- title_row()->AddButton(tray_popup_header_button_); |
- } |
+ footer()->AddButton(tray_popup_header_button_); |
+ } |
+ |
+ ~TestDetailsView() override {} |
+ |
+ TrayPopupHeaderButton* tray_popup_header_button() { |
+ return tray_popup_header_button_; |
+ } |
+ |
+ void FocusFooter() { footer()->content()->RequestFocus(); } |
+ |
+ // ViewClickListener: |
+ void OnViewClicked(views::View* sender) override {} |
+ |
+ // views::ButtonListener: |
+ void ButtonPressed(views::Button* sender, const ui::Event& event) override {} |
private: |
TrayPopupHeaderButton* tray_popup_header_button_; |
@@ -119,7 +117,7 @@ |
RunAllPendingInMessageLoop(); |
return static_cast<HoverHighlightView*>( |
- test_item->detailed_view()->title_row()->content()); |
+ test_item->detailed_view()->footer()->content()); |
} |
TrayPopupHeaderButton* CreateAndShowTrayPopupHeaderButton() { |
@@ -134,10 +132,6 @@ |
return test_item->detailed_view()->tray_popup_header_button(); |
} |
- void TransitionFromDetailedToDefaultView(TestDetailsView* detailed) { |
- detailed->TransitionToDefaultView(); |
- } |
- |
private: |
DISALLOW_COPY_AND_ASSIGN(TrayDetailsViewTest); |
}; |
@@ -167,8 +161,8 @@ |
// Transition back to default view, the default view of item 2 should have |
// focus. |
- test_item_2->detailed_view()->FocusTitleRow(); |
- TransitionFromDetailedToDefaultView(test_item_2->detailed_view()); |
+ test_item_2->detailed_view()->FocusFooter(); |
+ test_item_2->detailed_view()->TransitionToDefaultView(); |
RunAllPendingInMessageLoop(); |
EXPECT_TRUE(test_item_2->default_view()); |
@@ -183,7 +177,7 @@ |
// Transition back to default view, the default view of item 2 should NOT have |
// focus. |
- TransitionFromDetailedToDefaultView(test_item_2->detailed_view()); |
+ test_item_2->detailed_view()->TransitionToDefaultView(); |
RunAllPendingInMessageLoop(); |
EXPECT_TRUE(test_item_2->default_view()); |
@@ -227,10 +221,6 @@ |
// Tests that TrayPopupHeaderButton renders a background in response to touch. |
TEST_F(TrayDetailsViewTest, TrayPopupHeaderButtonTouchFeedback) { |
- // Material design detailed views will not use TrayPopupHeaderButton. |
- if (MaterialDesignController::IsSystemTrayMenuMaterial()) |
- return; |
- |
TrayPopupHeaderButton* button = CreateAndShowTrayPopupHeaderButton(); |
EXPECT_FALSE(button->background()); |
@@ -246,10 +236,6 @@ |
// Tests that touch events leaving TrayPopupHeaderButton cancel the touch |
// feedback background. |
TEST_F(TrayDetailsViewTest, TrayPopupHeaderButtonTouchFeedbackCancellation) { |
- // Material design detailed views will not use TrayPopupHeaderButton. |
- if (MaterialDesignController::IsSystemTrayMenuMaterial()) |
- return; |
- |
TrayPopupHeaderButton* button = CreateAndShowTrayPopupHeaderButton(); |
EXPECT_FALSE(button->background()); |
@@ -271,10 +257,6 @@ |
// Tests that a mouse entering TrayPopupHeaderButton renders a background as |
// visual feedback. |
TEST_F(TrayDetailsViewTest, TrayPopupHeaderButtonMouseHoverFeedback) { |
- // Material design detailed views will not use TrayPopupHeaderButton. |
- if (MaterialDesignController::IsSystemTrayMenuMaterial()) |
- return; |
- |
TrayPopupHeaderButton* button = CreateAndShowTrayPopupHeaderButton(); |
EXPECT_FALSE(button->background()); |