summaryrefslogtreecommitdiffstats
path: root/ash/test/test_session_state_delegate.cc
diff options
context:
space:
mode:
authorskuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-19 18:25:06 +0000
committerskuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-19 18:25:06 +0000
commitd12cc5eb9f07b73701a42ebceefed4780a7e20b6 (patch)
treee9938eaba7cd2a1c3f949dd4eebb935499b693c2 /ash/test/test_session_state_delegate.cc
parent60d0f74ac0bda4cd007fd4800ee8941bb2746d0d (diff)
downloadchromium_src-d12cc5eb9f07b73701a42ebceefed4780a7e20b6.zip
chromium_src-d12cc5eb9f07b73701a42ebceefed4780a7e20b6.tar.gz
chromium_src-d12cc5eb9f07b73701a42ebceefed4780a7e20b6.tar.bz2
Adding "teleport windows to user X" context menu
This adds the teleport items to the context menu. At the same time I was also adding a GetUserID function to the SessionStateController to avoid adding the sanitization of the user names all over the place. BUG=306143 TEST=visual, a few things got handled by unit tests Review URL: https://codereview.chromium.org/27217003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229607 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/test/test_session_state_delegate.cc')
-rw-r--r--ash/test/test_session_state_delegate.cc30
1 files changed, 26 insertions, 4 deletions
diff --git a/ash/test/test_session_state_delegate.cc b/ash/test/test_session_state_delegate.cc
index abed8e6..e18f7d1 100644
--- a/ash/test/test_session_state_delegate.cc
+++ b/ash/test/test_session_state_delegate.cc
@@ -4,10 +4,25 @@
#include "ash/test/test_session_state_delegate.h"
+#include <algorithm>
+#include <string>
+
#include "ash/shell.h"
#include "ash/system/user/login_status.h"
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace {
+
+// The the "canonicalized" user ID from a given |email| address.
+std::string GetUserIDFromEmail(const std::string& email) {
+ std::string user_id = email;
+ std::transform(user_id.begin(), user_id.end(), user_id.begin(), ::tolower);
+ return user_id;
+}
+
+} // namespace
namespace ash {
namespace test {
@@ -99,13 +114,18 @@ const base::string16 TestSessionStateDelegate::GetUserDisplayName(
const std::string TestSessionStateDelegate::GetUserEmail(
MultiProfileIndex index) const {
switch (index) {
- case 0: return "first@tray";
- case 1: return "second@tray";
+ case 0: return "First@tray"; // This is intended to be capitalized.
+ case 1: return "Second@tray"; // This is intended to be capitalized.
case 2: return "third@tray";
default: return "someone@tray";
}
}
+const std::string TestSessionStateDelegate::GetUserID(
+ MultiProfileIndex index) const {
+ return GetUserIDFromEmail(GetUserEmail(index));
+}
+
const gfx::ImageSkia& TestSessionStateDelegate::GetUserImage(
MultiProfileIndex index) const {
return null_image_;
@@ -114,8 +134,10 @@ const gfx::ImageSkia& TestSessionStateDelegate::GetUserImage(
void TestSessionStateDelegate::GetLoggedInUsers(UserIdList* users) {
}
-void TestSessionStateDelegate::SwitchActiveUser(const std::string& email) {
- activated_user_ = email;
+void TestSessionStateDelegate::SwitchActiveUser(const std::string& user_id) {
+ // Make sure this is a user id and not an email address.
+ EXPECT_EQ(user_id, GetUserIDFromEmail(user_id));
+ activated_user_ = user_id;
}
void TestSessionStateDelegate::SwitchActiveUserToNext() {