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

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

Issue 2573703003: chromeos: Fix shelf appearing at login screen under mash (Closed)
Patch Set: msw comments Created 4 years 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/ash_test_impl_mus.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/ash_test_impl_mus.cc
diff --git a/ash/mus/test/ash_test_impl_mus.cc b/ash/mus/test/ash_test_impl_mus.cc
index 0f85cb703f290dcc04c4f1e408827b48405d78f9..043a4ed52010e8af3b3a007cff2002326adaddfc 100644
--- a/ash/mus/test/ash_test_impl_mus.cc
+++ b/ash/mus/test/ash_test_impl_mus.cc
@@ -4,8 +4,12 @@
#include "ash/mus/test/ash_test_impl_mus.h"
+#include "ash/common/session/session_controller.h"
#include "ash/common/test/ash_test.h"
+#include "ash/common/wm_shell.h"
#include "ash/mus/bridge/wm_window_mus.h"
+#include "ash/public/cpp/session_types.h"
+#include "ash/public/interfaces/session_controller.mojom.h"
#include "base/memory/ptr_util.h"
#include "services/ui/public/cpp/property_type_converters.h"
#include "services/ui/public/interfaces/window_manager.mojom.h"
@@ -40,6 +44,9 @@ AshTestImplMus::~AshTestImplMus() {}
void AshTestImplMus::SetUp() {
wm_test_base_->SetUp();
+
+ // Most tests assume the user is logged in (and hence the shelf is created).
+ SimulateUserLogin();
}
void AshTestImplMus::TearDown() {
@@ -100,6 +107,29 @@ void AshTestImplMus::AddTransientChild(WmWindow* parent, WmWindow* window) {
WmWindowAura::GetAuraWindow(window));
}
+void AshTestImplMus::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
// static
« no previous file with comments | « ash/mus/test/ash_test_impl_mus.h ('k') | ash/mus/window_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698