Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1272)

Side by Side Diff: ash/system/tray/system_tray_unittest.cc

Issue 2041233005: Moves ash::user::LoginStatus to ash/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/system/tray/system_tray_item.cc ('k') | ash/system/tray/tray_details_view_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/system_tray.h" 5 #include "ash/system/tray/system_tray.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/common/accessibility_delegate.h" 9 #include "ash/common/accessibility_delegate.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 ->shelf_widget() 47 ->shelf_widget()
48 ->status_area_widget() 48 ->status_area_widget()
49 ->system_tray(); 49 ->system_tray();
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 views::View* CreateTrayView(user::LoginStatus status) override { 57 views::View* CreateTrayView(LoginStatus status) override {
58 tray_view_ = new views::View; 58 tray_view_ = new views::View;
59 // Add a label so it has non-zero width. 59 // Add a label so it has non-zero width.
60 tray_view_->SetLayoutManager(new views::FillLayout); 60 tray_view_->SetLayoutManager(new views::FillLayout);
61 tray_view_->AddChildView(new views::Label(base::UTF8ToUTF16("Tray"))); 61 tray_view_->AddChildView(new views::Label(base::UTF8ToUTF16("Tray")));
62 return tray_view_; 62 return tray_view_;
63 } 63 }
64 64
65 views::View* CreateDefaultView(user::LoginStatus status) override { 65 views::View* CreateDefaultView(LoginStatus status) override {
66 default_view_ = new views::View; 66 default_view_ = new views::View;
67 default_view_->SetLayoutManager(new views::FillLayout); 67 default_view_->SetLayoutManager(new views::FillLayout);
68 default_view_->AddChildView(new views::Label(base::UTF8ToUTF16("Default"))); 68 default_view_->AddChildView(new views::Label(base::UTF8ToUTF16("Default")));
69 return default_view_; 69 return default_view_;
70 } 70 }
71 71
72 views::View* CreateDetailedView(user::LoginStatus status) override { 72 views::View* CreateDetailedView(LoginStatus status) override {
73 detailed_view_ = new views::View; 73 detailed_view_ = new views::View;
74 detailed_view_->SetLayoutManager(new views::FillLayout); 74 detailed_view_->SetLayoutManager(new views::FillLayout);
75 detailed_view_->AddChildView( 75 detailed_view_->AddChildView(
76 new views::Label(base::UTF8ToUTF16("Detailed"))); 76 new views::Label(base::UTF8ToUTF16("Detailed")));
77 return detailed_view_; 77 return detailed_view_;
78 } 78 }
79 79
80 views::View* CreateNotificationView(user::LoginStatus status) override { 80 views::View* CreateNotificationView(LoginStatus status) override {
81 notification_view_ = new views::View; 81 notification_view_ = new views::View;
82 return notification_view_; 82 return notification_view_;
83 } 83 }
84 84
85 void DestroyTrayView() override { tray_view_ = NULL; } 85 void DestroyTrayView() override { tray_view_ = NULL; }
86 86
87 void DestroyDefaultView() override { default_view_ = NULL; } 87 void DestroyDefaultView() override { default_view_ = NULL; }
88 88
89 void DestroyDetailedView() override { detailed_view_ = NULL; } 89 void DestroyDetailedView() override { detailed_view_ = NULL; }
90 90
91 void DestroyNotificationView() override { notification_view_ = NULL; } 91 void DestroyNotificationView() override { notification_view_ = NULL; }
92 92
93 void UpdateAfterLoginStatusChange(user::LoginStatus status) override {} 93 void UpdateAfterLoginStatusChange(LoginStatus status) override {}
94 94
95 views::View* tray_view() const { return tray_view_; } 95 views::View* tray_view() const { return tray_view_; }
96 views::View* default_view() const { return default_view_; } 96 views::View* default_view() const { return default_view_; }
97 views::View* detailed_view() const { return detailed_view_; } 97 views::View* detailed_view() const { return detailed_view_; }
98 views::View* notification_view() const { return notification_view_; } 98 views::View* notification_view() const { return notification_view_; }
99 99
100 private: 100 private:
101 views::View* tray_view_; 101 views::View* tray_view_;
102 views::View* default_view_; 102 views::View* default_view_;
103 views::View* detailed_view_; 103 views::View* detailed_view_;
104 views::View* notification_view_; 104 views::View* notification_view_;
105 }; 105 };
106 106
107 // Trivial item implementation that returns NULL from tray/default/detailed 107 // Trivial item implementation that returns NULL from tray/default/detailed
108 // view creation methods. 108 // view creation methods.
109 class TestNoViewItem : public SystemTrayItem { 109 class TestNoViewItem : public SystemTrayItem {
110 public: 110 public:
111 TestNoViewItem() : SystemTrayItem(GetSystemTray()) {} 111 TestNoViewItem() : SystemTrayItem(GetSystemTray()) {}
112 112
113 views::View* CreateTrayView(user::LoginStatus status) override { 113 views::View* CreateTrayView(LoginStatus status) override { return nullptr; }
114 return NULL; 114
115 views::View* CreateDefaultView(LoginStatus status) override {
116 return nullptr;
115 } 117 }
116 118
117 views::View* CreateDefaultView(user::LoginStatus status) override { 119 views::View* CreateDetailedView(LoginStatus status) override {
118 return NULL; 120 return nullptr;
119 } 121 }
120 122
121 views::View* CreateDetailedView(user::LoginStatus status) override { 123 views::View* CreateNotificationView(LoginStatus status) override {
122 return NULL; 124 return nullptr;
123 }
124
125 views::View* CreateNotificationView(user::LoginStatus status) override {
126 return NULL;
127 } 125 }
128 126
129 void DestroyTrayView() override {} 127 void DestroyTrayView() override {}
130 void DestroyDefaultView() override {} 128 void DestroyDefaultView() override {}
131 void DestroyDetailedView() override {} 129 void DestroyDetailedView() override {}
132 void DestroyNotificationView() override {} 130 void DestroyNotificationView() override {}
133 void UpdateAfterLoginStatusChange(user::LoginStatus status) override {} 131 void UpdateAfterLoginStatusChange(LoginStatus status) override {}
134 }; 132 };
135 133
136 class ModalWidgetDelegate : public views::WidgetDelegateView { 134 class ModalWidgetDelegate : public views::WidgetDelegateView {
137 public: 135 public:
138 ModalWidgetDelegate() {} 136 ModalWidgetDelegate() {}
139 ~ModalWidgetDelegate() override {} 137 ~ModalWidgetDelegate() override {}
140 138
141 views::View* GetContentsView() override { return this; } 139 views::View* GetContentsView() override { return this; }
142 ui::ModalType GetModalType() const override { return ui::MODAL_TYPE_SYSTEM; } 140 ui::ModalType GetModalType() const override { return ui::MODAL_TYPE_SYSTEM; }
143 141
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 // Hide the default view, ensure the system tray height is back to zero. 567 // Hide the default view, ensure the system tray height is back to zero.
570 ASSERT_TRUE(tray->CloseSystemBubble()); 568 ASSERT_TRUE(tray->CloseSystemBubble());
571 RunAllPendingInMessageLoop(); 569 RunAllPendingInMessageLoop();
572 570
573 EXPECT_EQ(0, notification_tray->system_tray_height_for_test()); 571 EXPECT_EQ(0, notification_tray->system_tray_height_for_test());
574 } 572 }
575 #endif // OS_CHROMEOS 573 #endif // OS_CHROMEOS
576 574
577 } // namespace test 575 } // namespace test
578 } // namespace ash 576 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/system_tray_item.cc ('k') | ash/system/tray/tray_details_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698