Skip to content

Commit

Permalink
multi user: Do not end overview mode if you cancel switching users
Browse files Browse the repository at this point in the history
Overview mode shall not end if you start to switch users during screen
casting/sharing but then decline the confirmation dialog.

Test: manual
Bug: 999691
Change-Id: Id2f6138b3e67f16cc0bb932a3ed4e009f55c7cc9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1779175
Reviewed-by: Ahmed Fakhry <afakhry@chromium.org>
Commit-Queue: Avery Musbach <amusbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#692693}
  • Loading branch information
Avery Musbach authored and Commit Bot committed Sep 3, 2019
1 parent 5d751db commit bab45fa
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 25 deletions.
2 changes: 2 additions & 0 deletions ash/multi_user/user_switch_animator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "ash/shell.h"
#include "ash/wallpaper/wallpaper_controller_impl.h"
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/overview/overview_controller.h"
#include "ash/wm/window_positioner.h"
#include "base/bind.h"
#include "ui/aura/client/aura_constants.h"
Expand Down Expand Up @@ -89,6 +90,7 @@ UserSwitchAnimator::UserSwitchAnimator(MultiUserWindowManagerImpl* owner,
animation_step_(ANIMATION_STEP_HIDE_OLD_USER),
screen_cover_(GetScreenCover(NULL)),
windows_by_account_id_() {
Shell::Get()->overview_controller()->EndOverview();
BuildUserToWindowsListMap();
AdvanceUserTransitionAnimation();

Expand Down
4 changes: 0 additions & 4 deletions ash/session/session_controller_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "ash/system/screen_security/screen_switch_check_controller.h"
#include "ash/wm/lock_state_controller.h"
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/overview/overview_controller.h"
#include "ash/wm/window_state.h"
#include "ash/wm/window_util.h"
#include "ash/wm/wm_event.h"
Expand Down Expand Up @@ -425,9 +424,6 @@ void SessionControllerImpl::SetSessionLengthLimit(base::TimeDelta length_limit,

void SessionControllerImpl::CanSwitchActiveUser(
CanSwitchActiveUserCallback callback) {
// Cancel overview mode when switching user profiles.
Shell::Get()->overview_controller()->EndOverview();

ash::Shell::Get()
->screen_switch_check_controller()
->CanSwitchAwayFromActiveUser(std::move(callback));
Expand Down
21 changes: 0 additions & 21 deletions ash/session/session_controller_impl_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "ash/shell.h"
#include "ash/system/tray/system_tray_notifier.h"
#include "ash/test/ash_test_base.h"
#include "ash/wm/overview/overview_controller.h"
#include "ash/wm/window_util.h"
#include "base/bind.h"
#include "base/callback.h"
Expand Down Expand Up @@ -612,14 +611,6 @@ class CanSwitchUserTest : public AshTestBase {
switch_callback_hit_count_++;
}

// Methods needed to test with overview mode.
bool StartOverview() {
return Shell::Get()->overview_controller()->StartOverview();
}
bool InOverviewSession() const {
return Shell::Get()->overview_controller()->InOverviewSession();
}

// Various counter accessors.
int stop_capture_callback_hit_count() const {
return stop_capture_callback_hit_count_;
Expand Down Expand Up @@ -766,18 +757,6 @@ TEST_F(CanSwitchUserTest, BothActiveAccepted) {
EXPECT_EQ(1, stop_share_callback_hit_count());
}

// Test that overview mode is dismissed before switching user profile.
TEST_F(CanSwitchUserTest, OverviewModeDismissed) {
EXPECT_EQ(0, switch_callback_hit_count());
gfx::Rect bounds(0, 0, 100, 100);
std::unique_ptr<aura::Window> w(CreateTestWindowInShellWithBounds(bounds));
ASSERT_TRUE(StartOverview());
ASSERT_TRUE(InOverviewSession());
SwitchUser(CanSwitchUserTest::NO_DIALOG);
ASSERT_FALSE(InOverviewSession());
EXPECT_EQ(1, switch_callback_hit_count());
}

using SessionControllerImplUnblockTest = NoSessionAshTestBase;

TEST_F(SessionControllerImplUnblockTest, ActiveWindowAfterUnblocking) {
Expand Down
10 changes: 10 additions & 0 deletions ash/wm/desks/desks_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "ash/wm/workspace_controller.h"
#include "base/stl_util.h"
#include "base/test/scoped_feature_list.h"
#include "components/session_manager/session_manager_types.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/window_parenting_client.h"
#include "ui/base/ui_base_types.h"
Expand Down Expand Up @@ -1930,6 +1931,7 @@ class DesksMultiUserTest : public NoSessionAshTestBase,
MultiUserWindowManager::Create(this, GetUser1AccountId());
MultiUserWindowManagerImpl::Get()->SetAnimationSpeedForTest(
MultiUserWindowManagerImpl::ANIMATION_SPEED_DISABLED);
session_controller->SetSessionState(session_manager::SessionState::ACTIVE);
}

void TearDown() override {
Expand Down Expand Up @@ -2115,6 +2117,14 @@ TEST_F(DesksMultiUserTest, RemoveDesks) {
EXPECT_TRUE(win6->IsVisible());
}

TEST_F(DesksMultiUserTest, SwitchingUsersEndsOverview) {
OverviewController* overview_controller = Shell::Get()->overview_controller();
EXPECT_TRUE(overview_controller->StartOverview());
EXPECT_TRUE(overview_controller->InOverviewSession());
SwitchActiveUser(GetUser2AccountId());
EXPECT_FALSE(overview_controller->InOverviewSession());
}

} // namespace

// Simulates the same behavior of event rewriting that key presses go through.
Expand Down

0 comments on commit bab45fa

Please sign in to comment.