OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/common/system/overview/overview_button_tray.h" | 5 #include "ash/common/system/overview/overview_button_tray.h" |
6 | 6 |
7 #include "ash/common/login_status.h" | 7 #include "ash/common/login_status.h" |
8 #include "ash/common/session/session_controller.h" | 8 #include "ash/common/session/session_controller.h" |
9 #include "ash/common/system/status_area_widget.h" | 9 #include "ash/common/system/status_area_widget.h" |
10 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 10 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 }; | 67 }; |
68 | 68 |
69 void OverviewButtonTrayTest::SetUp() { | 69 void OverviewButtonTrayTest::SetUp() { |
70 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 70 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
71 ::switches::kUseFirstDisplayAsInternal); | 71 ::switches::kUseFirstDisplayAsInternal); |
72 AshTestBase::SetUp(); | 72 AshTestBase::SetUp(); |
73 } | 73 } |
74 | 74 |
75 void OverviewButtonTrayTest::NotifySessionStateChanged() { | 75 void OverviewButtonTrayTest::NotifySessionStateChanged() { |
76 GetTray()->SessionStateChanged( | 76 GetTray()->SessionStateChanged( |
77 WmShell::Get()->session_controller()->GetSessionState()); | 77 Shell::Get()->session_controller()->GetSessionState()); |
78 } | 78 } |
79 | 79 |
80 // Ensures that creation doesn't cause any crashes and adds the image icon. | 80 // Ensures that creation doesn't cause any crashes and adds the image icon. |
81 TEST_F(OverviewButtonTrayTest, BasicConstruction) { | 81 TEST_F(OverviewButtonTrayTest, BasicConstruction) { |
82 EXPECT_TRUE(GetImageView(GetTray()) != NULL); | 82 EXPECT_TRUE(GetImageView(GetTray()) != NULL); |
83 } | 83 } |
84 | 84 |
85 // Test that maximize mode toggle changes visibility. | 85 // Test that maximize mode toggle changes visibility. |
86 // OverviewButtonTray should only be visible when MaximizeMode is enabled. | 86 // OverviewButtonTray should only be visible when MaximizeMode is enabled. |
87 // By default the system should not have MaximizeMode enabled. | 87 // By default the system should not have MaximizeMode enabled. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 166 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
167 false); | 167 false); |
168 } | 168 } |
169 | 169 |
170 // Tests that the tray loses visibility when a user logs out, and that it | 170 // Tests that the tray loses visibility when a user logs out, and that it |
171 // regains visibility when a user logs back in. | 171 // regains visibility when a user logs back in. |
172 TEST_F(OverviewButtonTrayTest, VisibilityChangesForLoginStatus) { | 172 TEST_F(OverviewButtonTrayTest, VisibilityChangesForLoginStatus) { |
173 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 173 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
174 true); | 174 true); |
175 SetUserLoggedIn(false); | 175 SetUserLoggedIn(false); |
176 WmShell::Get()->UpdateAfterLoginStatusChange(LoginStatus::NOT_LOGGED_IN); | 176 Shell::Get()->UpdateAfterLoginStatusChange(LoginStatus::NOT_LOGGED_IN); |
177 EXPECT_FALSE(GetTray()->visible()); | 177 EXPECT_FALSE(GetTray()->visible()); |
178 SetUserLoggedIn(true); | 178 SetUserLoggedIn(true); |
179 SetSessionStarted(true); | 179 SetSessionStarted(true); |
180 WmShell::Get()->UpdateAfterLoginStatusChange(LoginStatus::USER); | 180 Shell::Get()->UpdateAfterLoginStatusChange(LoginStatus::USER); |
181 EXPECT_TRUE(GetTray()->visible()); | 181 EXPECT_TRUE(GetTray()->visible()); |
182 SetUserAddingScreenRunning(true); | 182 SetUserAddingScreenRunning(true); |
183 NotifySessionStateChanged(); | 183 NotifySessionStateChanged(); |
184 EXPECT_FALSE(GetTray()->visible()); | 184 EXPECT_FALSE(GetTray()->visible()); |
185 SetUserAddingScreenRunning(false); | 185 SetUserAddingScreenRunning(false); |
186 NotifySessionStateChanged(); | 186 NotifySessionStateChanged(); |
187 EXPECT_TRUE(GetTray()->visible()); | 187 EXPECT_TRUE(GetTray()->visible()); |
188 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 188 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
189 false); | 189 false); |
190 } | 190 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 ASSERT_TRUE(WmShell::Get()->IsSystemModalWindowOpen()); | 254 ASSERT_TRUE(WmShell::Get()->IsSystemModalWindowOpen()); |
255 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 255 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
256 true); | 256 true); |
257 EXPECT_TRUE(GetTray()->visible()); | 257 EXPECT_TRUE(GetTray()->visible()); |
258 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 258 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
259 false); | 259 false); |
260 EXPECT_FALSE(GetTray()->visible()); | 260 EXPECT_FALSE(GetTray()->visible()); |
261 } | 261 } |
262 | 262 |
263 } // namespace ash | 263 } // namespace ash |
OLD | NEW |