| 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 "ash/system/tray/tray_details_view.h" | 5 #include "ash/system/tray/tray_details_view.h" |
| 6 | 6 |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/shelf/shelf_widget.h" | 8 #include "ash/shelf/shelf_widget.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/system/status_area_widget.h" | 10 #include "ash/system/status_area_widget.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 namespace ash { | 22 namespace ash { |
| 23 namespace test { | 23 namespace test { |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 SystemTray* GetSystemTray() { | 27 SystemTray* GetSystemTray() { |
| 28 return Shell::GetPrimaryRootWindowController()->shelf()-> | 28 return Shell::GetPrimaryRootWindowController()->shelf()-> |
| 29 status_area_widget()->system_tray(); | 29 status_area_widget()->system_tray(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 class TestDetailsView : public internal::TrayDetailsView, | 32 class TestDetailsView : public TrayDetailsView, public ViewClickListener { |
| 33 public internal::ViewClickListener { | |
| 34 public: | 33 public: |
| 35 explicit TestDetailsView(SystemTrayItem* owner) | 34 explicit TestDetailsView(SystemTrayItem* owner) : TrayDetailsView(owner) {} |
| 36 : internal::TrayDetailsView(owner) {} | |
| 37 | 35 |
| 38 virtual ~TestDetailsView() {} | 36 virtual ~TestDetailsView() {} |
| 39 | 37 |
| 40 void CreateFooterAndFocus() { | 38 void CreateFooterAndFocus() { |
| 41 // Uses bluetooth label for testing purpose. It can be changed to any | 39 // Uses bluetooth label for testing purpose. It can be changed to any |
| 42 // string_id. | 40 // string_id. |
| 43 CreateSpecialRow(IDS_ASH_STATUS_TRAY_BLUETOOTH, this); | 41 CreateSpecialRow(IDS_ASH_STATUS_TRAY_BLUETOOTH, this); |
| 44 footer()->content()->RequestFocus(); | 42 footer()->content()->RequestFocus(); |
| 45 } | 43 } |
| 46 | 44 |
| 47 // Overridden from internal::ViewClickListener: | 45 // Overridden from ViewClickListener: |
| 48 virtual void OnViewClicked(views::View* sender) OVERRIDE {} | 46 virtual void OnViewClicked(views::View* sender) OVERRIDE {} |
| 49 | 47 |
| 50 private: | 48 private: |
| 51 DISALLOW_COPY_AND_ASSIGN(TestDetailsView); | 49 DISALLOW_COPY_AND_ASSIGN(TestDetailsView); |
| 52 }; | 50 }; |
| 53 | 51 |
| 54 // Trivial item implementation that tracks its views for testing. | 52 // Trivial item implementation that tracks its views for testing. |
| 55 class TestItem : public SystemTrayItem { | 53 class TestItem : public SystemTrayItem { |
| 56 public: | 54 public: |
| 57 TestItem() : SystemTrayItem(GetSystemTray()), tray_view_(NULL) {} | 55 TestItem() : SystemTrayItem(GetSystemTray()), tray_view_(NULL) {} |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 test_item_2->detailed_view()->TransitionToDefaultView(); | 138 test_item_2->detailed_view()->TransitionToDefaultView(); |
| 141 RunAllPendingInMessageLoop(); | 139 RunAllPendingInMessageLoop(); |
| 142 | 140 |
| 143 EXPECT_TRUE(test_item_2->default_view()); | 141 EXPECT_TRUE(test_item_2->default_view()); |
| 144 EXPECT_FALSE(test_item_2->detailed_view()); | 142 EXPECT_FALSE(test_item_2->detailed_view()); |
| 145 EXPECT_FALSE(test_item_2->default_view()->HasFocus()); | 143 EXPECT_FALSE(test_item_2->default_view()->HasFocus()); |
| 146 } | 144 } |
| 147 | 145 |
| 148 } // namespace test | 146 } // namespace test |
| 149 } // namespace ash | 147 } // namespace ash |
| OLD | NEW |