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

Unified Diff: chromeos/login/login_state_unittest.cc

Issue 242983004: Disable some API calls in networkingPrivate for non-primary user (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test Created 6 years, 6 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 | « chromeos/login/login_state.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/login/login_state_unittest.cc
diff --git a/chromeos/login/login_state_unittest.cc b/chromeos/login/login_state_unittest.cc
index 431b419ee01f0fb0c9d6a33e732a95c426629d3d..50dfdb6e12cd9442d16fd3bfcbb0be579d4ac21a 100644
--- a/chromeos/login/login_state_unittest.cc
+++ b/chromeos/login/login_state_unittest.cc
@@ -9,6 +9,10 @@
#include "chromeos/chromeos_switches.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace {
+const char kTestUserHash[] = "testuserhash";
+} // namespace
+
namespace chromeos {
class LoginStateTest : public testing::Test,
@@ -124,4 +128,26 @@ TEST_F(LoginStateTest, TestLoggedInStateChangedObserverOnUserTypeChange) {
LoginState::Get()->GetLoggedInUserType());
}
+TEST_F(LoginStateTest, TestPrimaryUser) {
+ EXPECT_FALSE(LoginState::Get()->IsUserLoggedIn());
+ EXPECT_FALSE(LoginState::Get()->IsInSafeMode());
+ EXPECT_EQ(LoginState::LOGGED_IN_USER_NONE, logged_in_user_type_);
+ EXPECT_EQ(LoginState::LOGGED_IN_USER_NONE,
+ LoginState::Get()->GetLoggedInUserType());
+
+ // Setting login state to ACTIVE and setting the primary user.
+ LoginState::Get()->SetLoggedInStateAndPrimaryUser(
+ LoginState::LOGGED_IN_ACTIVE,
+ LoginState::LOGGED_IN_USER_REGULAR,
+ kTestUserHash);
+ EXPECT_EQ(LoginState::LOGGED_IN_USER_REGULAR,
+ LoginState::Get()->GetLoggedInUserType());
+ EXPECT_TRUE(LoginState::Get()->IsUserLoggedIn());
+ EXPECT_FALSE(LoginState::Get()->IsInSafeMode());
+ EXPECT_EQ(kTestUserHash, LoginState::Get()->primary_user_hash());
+
+ EXPECT_EQ(1U, GetNewLoginStateChangesCount());
+ EXPECT_EQ(LoginState::LOGGED_IN_USER_REGULAR, logged_in_user_type_);
+}
+
} // namespace chromeos
« no previous file with comments | « chromeos/login/login_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698