Index: chrome/browser/chromeos/login/login_utils_browsertest.cc |
diff --git a/chrome/browser/chromeos/login/login_utils_browsertest.cc b/chrome/browser/chromeos/login/login_utils_browsertest.cc |
index af31e83dd4d819267cf5c5e053c812c4be1edb7c..11970ed21a1f1720f79e1b066d37fe7a99ca0b07 100644 |
--- a/chrome/browser/chromeos/login/login_utils_browsertest.cc |
+++ b/chrome/browser/chromeos/login/login_utils_browsertest.cc |
@@ -144,7 +144,8 @@ class LoginUtilsTest : public testing::Test, |
mock_async_method_caller_(NULL), |
connector_(NULL), |
cryptohome_(NULL), |
- prepared_profile_(NULL) {} |
+ prepared_profile_(NULL), |
+ created_profile_(NULL) {} |
virtual void SetUp() OVERRIDE { |
// This test is not a full blown InProcessBrowserTest, and doesn't have |
@@ -354,6 +355,10 @@ class LoginUtilsTest : public testing::Test, |
prepared_profile_ = profile; |
} |
+ virtual void OnProfileCreated(Profile* profile) OVERRIDE { |
+ created_profile_ = profile; |
+ } |
+ |
#if defined(ENABLE_RLZ) |
virtual void OnRlzInitialized(Profile* profile) OVERRIDE { |
rlz_initialized_cb_.Run(); |
@@ -480,6 +485,7 @@ class LoginUtilsTest : public testing::Test, |
policy::BrowserPolicyConnector* connector_; |
MockCryptohomeLibrary* cryptohome_; |
Profile* prepared_profile_; |
+ Profile* created_profile_; |
base::Closure rlz_initialized_cb_; |
@@ -505,6 +511,11 @@ TEST_F(LoginUtilsTest, NormalLoginDoesntBlock) { |
// The profile will be created without waiting for a policy response. |
PrepareProfile(kUsername); |
+ // This should shortcut cookie transfer step that is missing due to |
+ // IO thread being mocked. |
+ EXPECT_TRUE(created_profile_); |
+ LoginUtils::Get()->CompleteProfileCreate(created_profile_); |
+ |
EXPECT_TRUE(prepared_profile_); |
ASSERT_TRUE(user_manager->IsUserLoggedIn()); |
EXPECT_EQ(kUsername, user_manager->GetLoggedInUser()->email()); |
@@ -527,6 +538,11 @@ TEST_F(LoginUtilsTest, EnterpriseLoginDoesntBlockForNormalUser) { |
// Login with a non-enterprise user shouldn't block. |
PrepareProfile(kUsernameOtherDomain); |
+ // This should shortcut cookie transfer step that is missing due to |
+ // IO thread being mocked. |
+ EXPECT_TRUE(created_profile_); |
+ LoginUtils::Get()->CompleteProfileCreate(created_profile_); |
+ |
EXPECT_TRUE(prepared_profile_); |
ASSERT_TRUE(user_manager->IsUserLoggedIn()); |
EXPECT_EQ(kUsernameOtherDomain, user_manager->GetLoggedInUser()->email()); |
@@ -546,6 +562,11 @@ TEST_F(LoginUtilsTest, RlzInitialized) { |
// Wait for blocking RLZ tasks to complete. |
RunUntilIdle(); |
+ // This should shortcut cookie transfer step that is missing due to |
+ // IO thread being mocked. |
+ EXPECT_TRUE(created_profile_); |
+ LoginUtils::Get()->CompleteProfileCreate(created_profile_); |
+ |
// RLZ brand code has been set to empty string. |
EXPECT_TRUE(local_state_.Get()->HasPrefPath(prefs::kRLZBrand)); |
EXPECT_EQ(std::string(), local_state_.Get()->GetString(prefs::kRLZBrand)); |
@@ -645,6 +666,11 @@ TEST_P(LoginUtilsBlockingLoginTest, EnterpriseLoginBlocksForEnterpriseUser) { |
fetcher->delegate()->OnURLFetchComplete(fetcher); |
} |
+ // This should shortcut cookie transfer step that is missing due to |
+ // IO thread being mocked. |
+ EXPECT_TRUE(created_profile_); |
+ LoginUtils::Get()->CompleteProfileCreate(created_profile_); |
+ |
// The profile is finally ready: |
EXPECT_TRUE(prepared_profile_); |
} |