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

Unified Diff: chrome/browser/chromeos/login/login_utils_browsertest.cc

Issue 11576065: Improved GAIA cookie retrieval logic in ChromeOS login (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 | « chrome/browser/chromeos/login/login_utils.cc ('k') | chrome/browser/chromeos/login/profile_auth_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_);
}
« no previous file with comments | « chrome/browser/chromeos/login/login_utils.cc ('k') | chrome/browser/chromeos/login/profile_auth_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698