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

Unified Diff: blimp/client/core/session/identity_source_unittest.cc

Issue 2403913003: Add user name in the feedback data. (Closed)
Patch Set: Version check only in Java layer. Created 4 years, 1 month 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
Index: blimp/client/core/session/identity_source_unittest.cc
diff --git a/blimp/client/core/session/identity_source_unittest.cc b/blimp/client/core/session/identity_source_unittest.cc
index 61d9b1b2fdde0004326b735020be7e7c9ca97ca2..4edc7bf5732763f0591651154346b9c674d856e8 100644
--- a/blimp/client/core/session/identity_source_unittest.cc
+++ b/blimp/client/core/session/identity_source_unittest.cc
@@ -263,6 +263,32 @@ TEST_F(IdentitySourceTest, TestConnectFailDelegateCallback) {
DCHECK_EQ(auth.Failed(), 1);
}
+TEST_F(IdentitySourceTest, CheckUserName) {
+ TestBlimpClientContextDelegate mock_blimp_delegate;
+ MockIdentitySource auth(
+ mock_blimp_delegate.CreateIdentityProvider(),
+ base::Bind(&TestBlimpClientContextDelegate::OnAuthenticationError,
+ base::Unretained(&mock_blimp_delegate)),
+ base::Bind(&MockIdentitySource::MockTokenCall, base::Unretained(&auth)));
+
+ FakeIdentityProvider* id_provider =
+ static_cast<FakeIdentityProvider*>(auth.GetIdentityProvider());
+ std::string account = "mock_account";
+
+ // Verify the user name before the login.
+ EXPECT_EQ("", auth.GetActiveUsername());
+
+ // Log in the mock user.
+ id_provider->LogIn(account);
+
+ // Verify that the identity source can return the correct user name.
+ EXPECT_EQ(account, auth.GetActiveUsername());
+
+ // Verify the user name after the logout.
+ id_provider->LogOut();
+ EXPECT_EQ("", auth.GetActiveUsername());
+}
+
} // namespace
} // namespace client
} // namespace blimp

Powered by Google App Engine
This is Rietveld 408576698