Commit 834fcb0a authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

chromeos: adds option for TestSessionControllerClient not to use lower-case

I'm converting some tests, and would like to avoid having to update a bunch
of places to use lower case strings.

BUG=756085
TEST=none

Change-Id: I4beba5088736a6f1c9dbf040741073ce19016097
Reviewed-on: https://chromium-review.googlesource.com/c/1329930Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606986}
parent 5cb75d74
...@@ -139,7 +139,9 @@ void TestSessionControllerClient::AddUserSession( ...@@ -139,7 +139,9 @@ void TestSessionControllerClient::AddUserSession(
bool provide_pref_service, bool provide_pref_service,
bool is_new_profile, bool is_new_profile,
const std::string& service_user_id) { const std::string& service_user_id) {
auto account_id = AccountId::FromUserEmail(GetUserIdFromEmail(display_email)); auto account_id = AccountId::FromUserEmail(
use_lower_case_user_id_ ? GetUserIdFromEmail(display_email)
: display_email);
mojom::UserSessionPtr session = mojom::UserSession::New(); mojom::UserSessionPtr session = mojom::UserSession::New();
session->session_id = ++fake_session_id_; session->session_id = ++fake_session_id_;
session->user_info = mojom::UserInfo::New(); session->user_info = mojom::UserInfo::New();
......
...@@ -41,6 +41,10 @@ class TestSessionControllerClient : public ash::mojom::SessionControllerClient { ...@@ -41,6 +41,10 @@ class TestSessionControllerClient : public ash::mojom::SessionControllerClient {
// Sets up the default state of SessionController. // Sets up the default state of SessionController.
void Reset(); void Reset();
void set_use_lower_case_user_id(bool value) {
use_lower_case_user_id_ = value;
}
// Helpers to set SessionController state. // Helpers to set SessionController state.
void SetCanLockScreen(bool can_lock); void SetCanLockScreen(bool can_lock);
void SetShouldLockScreenAutomatically(bool should_lock); void SetShouldLockScreenAutomatically(bool should_lock);
...@@ -92,6 +96,8 @@ class TestSessionControllerClient : public ash::mojom::SessionControllerClient { ...@@ -92,6 +96,8 @@ class TestSessionControllerClient : public ash::mojom::SessionControllerClient {
int fake_session_id_ = 0; int fake_session_id_ = 0;
mojom::SessionInfoPtr session_info_; mojom::SessionInfoPtr session_info_;
bool use_lower_case_user_id_ = true;
DISALLOW_COPY_AND_ASSIGN(TestSessionControllerClient); DISALLOW_COPY_AND_ASSIGN(TestSessionControllerClient);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment