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

Unified Diff: ash/mus/test/wm_test_base.cc

Issue 2625733003: Re-reland: chromeos: Fix shelf appearing at login screen under mash (Closed)
Patch Set: rebase, fix conflict with sky Created 3 years, 11 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
« no previous file with comments | « ash/mus/test/wm_test_base.h ('k') | ash/mus/window_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/mus/test/wm_test_base.cc
diff --git a/ash/mus/test/wm_test_base.cc b/ash/mus/test/wm_test_base.cc
index 71795527ebb40a24f62527225e3bc067281b30b9..4acbe724d91a57266828da9a04cfac065eec060f 100644
--- a/ash/mus/test/wm_test_base.cc
+++ b/ash/mus/test/wm_test_base.cc
@@ -7,10 +7,14 @@
#include <algorithm>
#include <vector>
+#include "ash/common/session/session_controller.h"
+#include "ash/common/wm_shell.h"
#include "ash/mus/root_window_controller.h"
#include "ash/mus/test/wm_test_helper.h"
#include "ash/mus/window_manager.h"
#include "ash/mus/window_manager_application.h"
+#include "ash/public/cpp/session_types.h"
+#include "ash/public/interfaces/session_controller.mojom.h"
#include "ash/test/wm_window_aura_test_api.h"
#include "base/memory/ptr_util.h"
#include "services/ui/public/cpp/property_type_converters.h"
@@ -165,6 +169,9 @@ void WmTestBase::SetUp() {
base::MakeUnique<WmWindowAuraTestApi::GlobalMinimumSizeLock>();
test_helper_.reset(new WmTestHelper);
test_helper_->Init();
+
+ // Most tests assume the user is logged in (and hence the shelf is created).
+ SimulateUserLogin();
}
void WmTestBase::TearDown() {
@@ -174,5 +181,29 @@ void WmTestBase::TearDown() {
zero_duration_mode_.reset();
}
+void WmTestBase::SimulateUserLogin() {
+ SessionController* session_controller = WmShell::Get()->session_controller();
+
+ // Simulate the first user logging in.
+ mojom::UserSessionPtr session = mojom::UserSession::New();
+ session->session_id = 1;
+ session->type = user_manager::USER_TYPE_REGULAR;
+ const std::string email("ash.user@example.com");
+ session->serialized_account_id = AccountId::FromUserEmail(email).Serialize();
+ session->display_name = "Ash User";
+ session->display_email = email;
+ session_controller->UpdateUserSession(std::move(session));
+
+ // Simulate the user session becoming active.
+ mojom::SessionInfoPtr info = mojom::SessionInfo::New();
+ info->max_users = 10;
+ info->can_lock_screen = true;
+ info->should_lock_screen_automatically = false;
+ info->add_user_session_policy = AddUserSessionPolicy::ALLOWED;
+ info->state = session_manager::SessionState::ACTIVE;
+ session_controller->SetSessionInfo(std::move(info));
+}
+
+
} // namespace mus
} // namespace ash
« no previous file with comments | « ash/mus/test/wm_test_base.h ('k') | ash/mus/window_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698