#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "ash/system/status_area_widget.h"
+#include "ash/system/user/login_status.h"
#include "ash/test/ash_test_base.h"
+#include "ash/test/status_area_widget_test_helper.h"
#include "ash/wm/overview/window_selector_controller.h"
#include "base/time/time.h"
#include "ui/events/event.h"
namespace {
OverviewButtonTray* GetTray() {
- return Shell::GetPrimaryRootWindowController()->shelf()->
- status_area_widget()->overview_button_tray();
+ return StatusAreaWidgetTestHelper::GetStatusAreaWidget()->
+ overview_button_tray();
}
OverviewButtonTray* GetSecondaryTray() {
- internal::RootWindowController* primary_controller =
- Shell::GetPrimaryRootWindowController();
- Shell::RootWindowControllerList controllers =
- Shell::GetAllRootWindowControllers();
- for (size_t i = 0; i < controllers.size(); ++i) {
- if (controllers[i] != primary_controller) {
- return controllers[i]->shelf()->
- status_area_widget()->overview_button_tray();
- }
- }
-
- return NULL;
+ return StatusAreaWidgetTestHelper::GetSecondaryStatusAreaWidget()->
+ overview_button_tray();
}
} // namespace
Shell::GetInstance()->EnableMaximizeModeWindowManager(false);
}
+// Tests that the tray loses visibility when a user logs out, and that it
+// regains visibility when a user logs back in.
+TEST_F(OverviewButtonTrayTest, VisibilityChangesForLoginStatus) {
+ Shell::GetInstance()->EnableMaximizeModeWindowManager(true);
+ SetUserLoggedIn(false);
+ Shell::GetInstance()->UpdateAfterLoginStatusChange(user::LOGGED_IN_NONE);
+ EXPECT_FALSE(GetTray()->visible());
+ SetUserLoggedIn(true);
+ SetSessionStarted(true);
+ Shell::GetInstance()->UpdateAfterLoginStatusChange(user::LOGGED_IN_USER);
+ EXPECT_TRUE(GetTray()->visible());
+ Shell::GetInstance()->EnableMaximizeModeWindowManager(false);
+}
+
} // namespace ash