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

Unified Diff: ash/common/session/session_controller_unittest.cc

Issue 2734933004: ash: Use SessionController instead of SessionStateDelegate (Closed)
Patch Set: rebase to get WorkspaceLayoutManagerSoloTest change Created 3 years, 9 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/common/session/session_controller.cc ('k') | ash/common/session/session_state_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/session/session_controller_unittest.cc
diff --git a/ash/common/session/session_controller_unittest.cc b/ash/common/session/session_controller_unittest.cc
index d6a986a6833d412ffb68fd7bca53b327c9a78655..9da35fd1f4d7dba6f6e6e55364448720ac04b508 100644
--- a/ash/common/session/session_controller_unittest.cc
+++ b/ash/common/session/session_controller_unittest.cc
@@ -123,6 +123,7 @@ TEST_F(SessionControllerTest, SimpleSessionInfo) {
mojom::SessionInfo info;
FillDefaultSessionInfo(&info);
SetSessionInfo(info);
+ UpdateSession(1u, "user1@test.com");
EXPECT_EQ(session_manager::kMaxmiumNumberOfUserSessions,
controller()->GetMaximumNumberOfLoggedInUsers());
@@ -140,6 +141,22 @@ TEST_F(SessionControllerTest, SimpleSessionInfo) {
EXPECT_FALSE(controller()->ShouldLockScreenAutomatically());
}
+// Tests that the CanLockScreen is only true with an active user session.
+TEST_F(SessionControllerTest, CanLockScreen) {
+ mojom::SessionInfo info;
+ FillDefaultSessionInfo(&info);
+ ASSERT_TRUE(info.can_lock_screen); // Check can_lock_screen default to true.
+ SetSessionInfo(info);
+
+ // Cannot lock screen when there is no active user session.
+ EXPECT_FALSE(controller()->IsActiveUserSessionStarted());
+ EXPECT_FALSE(controller()->CanLockScreen());
+
+ UpdateSession(1u, "user1@test.com");
+ EXPECT_TRUE(controller()->IsActiveUserSessionStarted());
+ EXPECT_TRUE(controller()->CanLockScreen());
+}
+
// Tests that AddUserSessionPolicy is set properly.
TEST_F(SessionControllerTest, AddUserPolicy) {
const AddUserSessionPolicy kTestCases[] = {
« no previous file with comments | « ash/common/session/session_controller.cc ('k') | ash/common/session/session_state_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698