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

Unified Diff: chrome/browser/chromeos/arc/arc_auth_service_unittest.cc

Issue 2490093002: Migrate opt-in auth flow to re-auth flow. (Closed)
Patch Set: 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: chrome/browser/chromeos/arc/arc_auth_service_unittest.cc
diff --git a/chrome/browser/chromeos/arc/arc_auth_service_unittest.cc b/chrome/browser/chromeos/arc/arc_auth_service_unittest.cc
index 1c4f73a2f3f897a09062f657cdaf0a7293454e75..d20ad61f734e6d1dfa65a7c5ca3b3d33f8da1af2 100644
--- a/chrome/browser/chromeos/arc/arc_auth_service_unittest.cc
+++ b/chrome/browser/chromeos/arc/arc_auth_service_unittest.cc
@@ -44,12 +44,6 @@
namespace arc {
-namespace {
-
-const char kTestAuthCode[] = "4/Qa3CPIhh-WcMfWSf9HZaYcGUhEeax-F9sQK9CNRhZWs";
-
-} // namespace
-
class ArcAuthServiceTest : public testing::Test {
public:
ArcAuthServiceTest()
@@ -185,7 +179,6 @@ TEST_F(ArcAuthServiceTest, DisabledForEphemeralDataUsers) {
TEST_F(ArcAuthServiceTest, BaseWorkflow) {
ASSERT_FALSE(bridge_service()->ready());
ASSERT_EQ(ArcAuthService::State::NOT_INITIALIZED, auth_service()->state());
- ASSERT_EQ(std::string(), auth_service()->GetAndResetAuthCode());
auth_service()->OnPrimaryUserProfilePrepared(profile());
@@ -198,20 +191,15 @@ TEST_F(ArcAuthServiceTest, BaseWorkflow) {
ASSERT_EQ(ArcAuthService::State::TERMS, auth_service()->state());
// TODO(hidehiko): Verify state transition from TERMS ->
- // ANDROID_MANAGEMENT_CHECK -> FETCHING_CODE, when we extract
- // ArcSessionManager.
- auth_service()->SetAuthCodeAndStartArc(kTestAuthCode);
+ // ANDROID_MANAGEMENT_CHECK, when we extract ArcSessionManager.
+ auth_service()->StartArc();
ASSERT_EQ(ArcAuthService::State::ACTIVE, auth_service()->state());
ASSERT_TRUE(bridge_service()->ready());
- // Auth code valid only for one call.
- ASSERT_EQ(kTestAuthCode, auth_service()->GetAndResetAuthCode());
- ASSERT_EQ(std::string(), auth_service()->GetAndResetAuthCode());
auth_service()->Shutdown();
ASSERT_EQ(ArcAuthService::State::NOT_INITIALIZED, auth_service()->state());
ASSERT_FALSE(bridge_service()->ready());
- ASSERT_EQ(std::string(), auth_service()->GetAndResetAuthCode());
// Send profile and don't provide a code.
auth_service()->OnPrimaryUserProfilePrepared(profile());
@@ -250,7 +238,7 @@ TEST_F(ArcAuthServiceTest, CloseUIKeepsArcEnabled) {
auth_service()->OnPrimaryUserProfilePrepared(profile());
pref->SetBoolean(prefs::kArcEnabled, true);
- auth_service()->SetAuthCodeAndStartArc(kTestAuthCode);
+ auth_service()->StartArc();
ASSERT_EQ(ArcAuthService::State::ACTIVE, auth_service()->state());
@@ -284,7 +272,7 @@ TEST_F(ArcAuthServiceTest, SignInStatus) {
auth_service()->OnPrimaryUserProfilePrepared(profile());
EXPECT_EQ(ArcAuthService::State::TERMS, auth_service()->state());
- auth_service()->SetAuthCodeAndStartArc(kTestAuthCode);
+ auth_service()->StartArc();
EXPECT_EQ(ArcAuthService::State::ACTIVE, auth_service()->state());
EXPECT_TRUE(bridge_service()->ready());
EXPECT_FALSE(prefs->GetBoolean(prefs::kArcSignedIn));
@@ -320,7 +308,7 @@ TEST_F(ArcAuthServiceTest, DisabledForDeviceLocalAccount) {
EXPECT_FALSE(prefs->GetBoolean(prefs::kArcSignedIn));
prefs->SetBoolean(prefs::kArcEnabled, true);
auth_service()->OnPrimaryUserProfilePrepared(profile());
- auth_service()->SetAuthCodeAndStartArc(kTestAuthCode);
+ auth_service()->StartArc();
EXPECT_EQ(ArcAuthService::State::ACTIVE, auth_service()->state());
// Create device local account and set it as active.
@@ -348,7 +336,7 @@ TEST_F(ArcAuthServiceTest, DisabledForDeviceLocalAccount) {
TEST_F(ArcAuthServiceTest, DisabledForNonPrimaryProfile) {
profile()->GetPrefs()->SetBoolean(prefs::kArcEnabled, true);
auth_service()->OnPrimaryUserProfilePrepared(profile());
- auth_service()->SetAuthCodeAndStartArc(kTestAuthCode);
+ auth_service()->StartArc();
EXPECT_EQ(ArcAuthService::State::ACTIVE, auth_service()->state());
// Create a second profile and set it as the active profile.

Powered by Google App Engine
This is Rietveld 408576698