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 25 matching lines...) Expand all Loading... |
36 virtual ~TestDetailsView() {} | 36 virtual ~TestDetailsView() {} |
37 | 37 |
38 void CreateFooterAndFocus() { | 38 void CreateFooterAndFocus() { |
39 // 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 |
40 // string_id. | 40 // string_id. |
41 CreateSpecialRow(IDS_ASH_STATUS_TRAY_BLUETOOTH, this); | 41 CreateSpecialRow(IDS_ASH_STATUS_TRAY_BLUETOOTH, this); |
42 footer()->content()->RequestFocus(); | 42 footer()->content()->RequestFocus(); |
43 } | 43 } |
44 | 44 |
45 // Overridden from ViewClickListener: | 45 // Overridden from ViewClickListener: |
46 virtual void OnViewClicked(views::View* sender) OVERRIDE {} | 46 virtual void OnViewClicked(views::View* sender) override {} |
47 | 47 |
48 private: | 48 private: |
49 DISALLOW_COPY_AND_ASSIGN(TestDetailsView); | 49 DISALLOW_COPY_AND_ASSIGN(TestDetailsView); |
50 }; | 50 }; |
51 | 51 |
52 // Trivial item implementation that tracks its views for testing. | 52 // Trivial item implementation that tracks its views for testing. |
53 class TestItem : public SystemTrayItem { | 53 class TestItem : public SystemTrayItem { |
54 public: | 54 public: |
55 TestItem() : SystemTrayItem(GetSystemTray()), tray_view_(NULL) {} | 55 TestItem() : SystemTrayItem(GetSystemTray()), tray_view_(NULL) {} |
56 | 56 |
57 // Overridden from SystemTrayItem: | 57 // Overridden from SystemTrayItem: |
58 virtual views::View* CreateTrayView(user::LoginStatus status) OVERRIDE { | 58 virtual views::View* CreateTrayView(user::LoginStatus status) override { |
59 tray_view_ = new views::View; | 59 tray_view_ = new views::View; |
60 return tray_view_; | 60 return tray_view_; |
61 } | 61 } |
62 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE { | 62 virtual views::View* CreateDefaultView(user::LoginStatus status) override { |
63 default_view_ = new views::View; | 63 default_view_ = new views::View; |
64 default_view_->SetFocusable(true); | 64 default_view_->SetFocusable(true); |
65 return default_view_; | 65 return default_view_; |
66 } | 66 } |
67 virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE { | 67 virtual views::View* CreateDetailedView(user::LoginStatus status) override { |
68 detailed_view_ = new TestDetailsView(this); | 68 detailed_view_ = new TestDetailsView(this); |
69 return detailed_view_; | 69 return detailed_view_; |
70 } | 70 } |
71 virtual void DestroyTrayView() OVERRIDE { | 71 virtual void DestroyTrayView() override { |
72 tray_view_ = NULL; | 72 tray_view_ = NULL; |
73 } | 73 } |
74 virtual void DestroyDefaultView() OVERRIDE { | 74 virtual void DestroyDefaultView() override { |
75 default_view_ = NULL; | 75 default_view_ = NULL; |
76 } | 76 } |
77 virtual void DestroyDetailedView() OVERRIDE { | 77 virtual void DestroyDetailedView() override { |
78 detailed_view_ = NULL; | 78 detailed_view_ = NULL; |
79 } | 79 } |
80 | 80 |
81 views::View* tray_view() const { return tray_view_; } | 81 views::View* tray_view() const { return tray_view_; } |
82 views::View* default_view() const { return default_view_; } | 82 views::View* default_view() const { return default_view_; } |
83 TestDetailsView* detailed_view() const { return detailed_view_; } | 83 TestDetailsView* detailed_view() const { return detailed_view_; } |
84 | 84 |
85 private: | 85 private: |
86 views::View* tray_view_; | 86 views::View* tray_view_; |
87 views::View* default_view_; | 87 views::View* default_view_; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 test_item_2->detailed_view()->TransitionToDefaultView(); | 138 test_item_2->detailed_view()->TransitionToDefaultView(); |
139 RunAllPendingInMessageLoop(); | 139 RunAllPendingInMessageLoop(); |
140 | 140 |
141 EXPECT_TRUE(test_item_2->default_view()); | 141 EXPECT_TRUE(test_item_2->default_view()); |
142 EXPECT_FALSE(test_item_2->detailed_view()); | 142 EXPECT_FALSE(test_item_2->detailed_view()); |
143 EXPECT_FALSE(test_item_2->default_view()->HasFocus()); | 143 EXPECT_FALSE(test_item_2->default_view()->HasFocus()); |
144 } | 144 } |
145 | 145 |
146 } // namespace test | 146 } // namespace test |
147 } // namespace ash | 147 } // namespace ash |
OLD | NEW |