| 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 42c4efb7974dd7792f5d3538de2c4c09ca1523f6..b0ce5b70ee03b0415659a046d1ee45e732d3092f 100644
|
| --- a/ash/common/system/tray/tray_details_view_unittest.cc
|
| +++ b/ash/common/system/tray/tray_details_view_unittest.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #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"
|
| @@ -24,21 +25,12 @@ namespace test {
|
|
|
| namespace {
|
|
|
| -class TestDetailsView : public TrayDetailsView,
|
| - public ViewClickListener,
|
| - public views::ButtonListener {
|
| +class TestDetailsView : public TrayDetailsView {
|
| public:
|
| explicit TestDetailsView(SystemTrayItem* owner) : TrayDetailsView(owner) {
|
| // Uses bluetooth label for testing purpose. It can be changed to any
|
| // string_id.
|
| - 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);
|
| - footer()->AddButton(tray_popup_header_button_);
|
| + CreateTitleRow(IDS_ASH_STATUS_TRAY_BLUETOOTH, this);
|
| }
|
|
|
| ~TestDetailsView() override {}
|
| @@ -47,13 +39,23 @@ class TestDetailsView : public TrayDetailsView,
|
| return tray_popup_header_button_;
|
| }
|
|
|
| - void FocusFooter() { footer()->content()->RequestFocus(); }
|
| + void FocusTitleRow() { title_row()->content()->RequestFocus(); }
|
|
|
| - // ViewClickListener:
|
| - void OnViewClicked(views::View* sender) override {}
|
| + // 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;
|
|
|
| - // views::ButtonListener:
|
| - void ButtonPressed(views::Button* sender, const ui::Event& event) override {}
|
| + 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_);
|
| + }
|
|
|
| private:
|
| TrayPopupHeaderButton* tray_popup_header_button_;
|
| @@ -117,7 +119,7 @@ class TrayDetailsViewTest : public AshTestBase {
|
| RunAllPendingInMessageLoop();
|
|
|
| return static_cast<HoverHighlightView*>(
|
| - test_item->detailed_view()->footer()->content());
|
| + test_item->detailed_view()->title_row()->content());
|
| }
|
|
|
| TrayPopupHeaderButton* CreateAndShowTrayPopupHeaderButton() {
|
| @@ -132,6 +134,10 @@ class TrayDetailsViewTest : public AshTestBase {
|
| return test_item->detailed_view()->tray_popup_header_button();
|
| }
|
|
|
| + void TransitionFromDetailedToDefaultView(TestDetailsView* detailed) {
|
| + detailed->TransitionToDefaultView();
|
| + }
|
| +
|
| private:
|
| DISALLOW_COPY_AND_ASSIGN(TrayDetailsViewTest);
|
| };
|
| @@ -161,8 +167,8 @@ TEST_F(TrayDetailsViewTest, TransitionToDefaultViewTest) {
|
|
|
| // Transition back to default view, the default view of item 2 should have
|
| // focus.
|
| - test_item_2->detailed_view()->FocusFooter();
|
| - test_item_2->detailed_view()->TransitionToDefaultView();
|
| + test_item_2->detailed_view()->FocusTitleRow();
|
| + TransitionFromDetailedToDefaultView(test_item_2->detailed_view());
|
| RunAllPendingInMessageLoop();
|
|
|
| EXPECT_TRUE(test_item_2->default_view());
|
| @@ -177,7 +183,7 @@ TEST_F(TrayDetailsViewTest, TransitionToDefaultViewTest) {
|
|
|
| // Transition back to default view, the default view of item 2 should NOT have
|
| // focus.
|
| - test_item_2->detailed_view()->TransitionToDefaultView();
|
| + TransitionFromDetailedToDefaultView(test_item_2->detailed_view());
|
| RunAllPendingInMessageLoop();
|
|
|
| EXPECT_TRUE(test_item_2->default_view());
|
| @@ -221,6 +227,10 @@ TEST_F(TrayDetailsViewTest, HoverHighlightViewTouchFeedbackCancellation) {
|
|
|
| // 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());
|
|
|
| @@ -236,6 +246,10 @@ TEST_F(TrayDetailsViewTest, TrayPopupHeaderButtonTouchFeedback) {
|
| // 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());
|
|
|
| @@ -257,6 +271,10 @@ TEST_F(TrayDetailsViewTest, TrayPopupHeaderButtonTouchFeedbackCancellation) {
|
| // 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());
|
|
|
|
|