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

Unified Diff: ash/system/overview/overview_button_tray_unittest.cc

Issue 1149833006: Stop the OverviewButton from appearing on the Add-User screen (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: ash/system/overview/overview_button_tray_unittest.cc
diff --git a/ash/system/overview/overview_button_tray_unittest.cc b/ash/system/overview/overview_button_tray_unittest.cc
index a7e6a3e17fe4ba9c87a6e654e576fc0b7ae8eff2..4468aae627edc11773c7c3cf94c8373850d50912 100644
--- a/ash/system/overview/overview_button_tray_unittest.cc
+++ b/ash/system/overview/overview_button_tray_unittest.cc
@@ -14,12 +14,16 @@
#include "ash/system/status_area_widget.h"
#include "ash/system/user/login_status.h"
#include "ash/test/ash_test_base.h"
+#include "ash/test/ash_test_helper.h"
#include "ash/test/status_area_widget_test_helper.h"
+#include "ash/test/test_session_state_delegate.h"
#include "ash/wm/maximize_mode/maximize_mode_controller.h"
#include "ash/wm/overview/window_selector_controller.h"
#include "base/command_line.h"
#include "base/test/user_action_tester.h"
#include "base/time/time.h"
+#include "ui/aura/client/aura_constants.h"
+#include "ui/aura/window.h"
#include "ui/compositor/scoped_animation_duration_scale_mode.h"
#include "ui/events/event.h"
#include "ui/events/event_constants.h"
@@ -51,6 +55,8 @@ class OverviewButtonTrayTest : public test::AshTestBase {
void SetUp() override;
+ void NotifySessionStateChanged();
+
protected:
views::ImageView* GetImageView(OverviewButtonTray* tray) {
return tray->icon_;
@@ -68,6 +74,11 @@ void OverviewButtonTrayTest::SetUp() {
AshTestBase::SetUp();
}
+void OverviewButtonTrayTest::NotifySessionStateChanged() {
+ GetTray()->SessionStateChanged(
+ ash_test_helper()->GetTestSessionStateDelegate()->GetSessionState());
+}
+
// Ensures that creation doesn't cause any crashes and adds the image icon.
TEST_F(OverviewButtonTrayTest, BasicConstruction) {
EXPECT_TRUE(GetImageView(GetTray()) != NULL);
@@ -178,6 +189,12 @@ TEST_F(OverviewButtonTrayTest, VisibilityChangesForLoginStatus) {
SetSessionStarted(true);
Shell::GetInstance()->UpdateAfterLoginStatusChange(user::LOGGED_IN_USER);
EXPECT_TRUE(GetTray()->visible());
+ SetUserAddingScreenRunning(true);
+ NotifySessionStateChanged();
+ EXPECT_FALSE(GetTray()->visible());
+ SetUserAddingScreenRunning(false);
+ NotifySessionStateChanged();
+ EXPECT_TRUE(GetTray()->visible());
Shell::GetInstance()->maximize_mode_controller()->
EnableMaximizeModeWindowManager(false);
}
@@ -230,4 +247,28 @@ TEST_F(OverviewButtonTrayTest, HideAnimationAlwaysCompletes) {
EXPECT_FALSE(GetTray()->visible());
}
+// Tests that the overview button becomes visible when the user enters
+// maximize mode with a system modal window open, and that it hides once
+// the user exits maximize mode.
+TEST_F(OverviewButtonTrayTest, VisibilityChangesForSystemModalWindow) {
+ // TODO(jonross): When CreateTestWindow*() have been unified, use the
+ // appropriate method to replace this setup. (crbug.com/483503)
+ scoped_ptr<aura::Window> window(new aura::Window(nullptr));
+ window->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_SYSTEM);
+ window->SetType(ui::wm::WINDOW_TYPE_NORMAL);
+ window->Init(ui::LAYER_TEXTURED);
+ window->Show();
+ ParentWindowInPrimaryRootWindow(window.get());
+
+ ASSERT_TRUE(Shell::GetInstance()->IsSystemModalWindowOpen());
+ Shell::GetInstance()
+ ->maximize_mode_controller()
+ ->EnableMaximizeModeWindowManager(true);
+ EXPECT_TRUE(GetTray()->visible());
+ Shell::GetInstance()
+ ->maximize_mode_controller()
+ ->EnableMaximizeModeWindowManager(false);
+ EXPECT_FALSE(GetTray()->visible());
+}
+
} // namespace ash
« ash/system/overview/overview_button_tray.cc ('K') | « ash/system/overview/overview_button_tray.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698