OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <string> | 5 #include <string> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 225 |
226 // Try login. Primary profile has changed. | 226 // Try login. Primary profile has changed. |
227 EXPECT_TRUE( | 227 EXPECT_TRUE( |
228 TryToLogin(AccountId::FromUserEmailGaiaId(kTestEmail, kTestGaiaId), | 228 TryToLogin(AccountId::FromUserEmailGaiaId(kTestEmail, kTestGaiaId), |
229 kTestAccountPassword)); | 229 kTestAccountPassword)); |
230 Profile* profile = ProfileManager::GetPrimaryUserProfile(); | 230 Profile* profile = ProfileManager::GetPrimaryUserProfile(); |
231 | 231 |
232 // Wait for the session merge to finish. | 232 // Wait for the session merge to finish. |
233 WaitForMergeSessionCompletion(OAuth2LoginManager::SESSION_RESTORE_DONE); | 233 WaitForMergeSessionCompletion(OAuth2LoginManager::SESSION_RESTORE_DONE); |
234 | 234 |
235 // Check for existance of refresh token. | 235 // Check for existence of refresh token. |
236 ProfileOAuth2TokenService* token_service = | 236 ProfileOAuth2TokenService* token_service = |
237 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); | 237 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
238 EXPECT_TRUE(token_service->RefreshTokenIsAvailable(account_id)); | 238 EXPECT_TRUE(token_service->RefreshTokenIsAvailable(account_id)); |
239 | 239 |
240 EXPECT_EQ(GetOAuthStatusFromLocalState(account_id), | 240 EXPECT_EQ(GetOAuthStatusFromLocalState(account_id), |
241 user_manager::User::OAUTH2_TOKEN_STATUS_VALID); | 241 user_manager::User::OAUTH2_TOKEN_STATUS_VALID); |
242 } | 242 } |
243 | 243 |
244 bool TryToLogin(const AccountId& account_id, const std::string& password) { | 244 bool TryToLogin(const AccountId& account_id, const std::string& password) { |
245 if (!AddUserToSession(account_id, password)) | 245 if (!AddUserToSession(account_id, password)) |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 scoped_refptr<net::URLRequestContextGetter> context_; | 452 scoped_refptr<net::URLRequestContextGetter> context_; |
453 net::CookieList cookie_list_; | 453 net::CookieList cookie_list_; |
454 scoped_refptr<content::MessageLoopRunner> runner_; | 454 scoped_refptr<content::MessageLoopRunner> runner_; |
455 | 455 |
456 DISALLOW_COPY_AND_ASSIGN(CookieReader); | 456 DISALLOW_COPY_AND_ASSIGN(CookieReader); |
457 }; | 457 }; |
458 | 458 |
459 // PRE_MergeSession is testing merge session for a new profile. | 459 // PRE_MergeSession is testing merge session for a new profile. |
460 IN_PROC_BROWSER_TEST_F(OAuth2Test, PRE_PRE_PRE_MergeSession) { | 460 IN_PROC_BROWSER_TEST_F(OAuth2Test, PRE_PRE_PRE_MergeSession) { |
461 StartNewUserSession(true); | 461 StartNewUserSession(true); |
462 // Check for existance of refresh token. | 462 // Check for existence of refresh token. |
463 std::string account_id = PickAccountId(profile(), kTestGaiaId, kTestEmail); | 463 std::string account_id = PickAccountId(profile(), kTestGaiaId, kTestEmail); |
464 ProfileOAuth2TokenService* token_service = | 464 ProfileOAuth2TokenService* token_service = |
465 ProfileOAuth2TokenServiceFactory::GetForProfile( | 465 ProfileOAuth2TokenServiceFactory::GetForProfile( |
466 profile()); | 466 profile()); |
467 EXPECT_TRUE(token_service->RefreshTokenIsAvailable(account_id)); | 467 EXPECT_TRUE(token_service->RefreshTokenIsAvailable(account_id)); |
468 | 468 |
469 EXPECT_EQ(GetOAuthStatusFromLocalState(account_id), | 469 EXPECT_EQ(GetOAuthStatusFromLocalState(account_id), |
470 user_manager::User::OAUTH2_TOKEN_STATUS_VALID); | 470 user_manager::User::OAUTH2_TOKEN_STATUS_VALID); |
471 scoped_refptr<CookieReader> cookie_reader(new CookieReader()); | 471 scoped_refptr<CookieReader> cookie_reader(new CookieReader()); |
472 cookie_reader->ReadCookies(profile()); | 472 cookie_reader->ReadCookies(profile()); |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 | 921 |
922 if (!catcher.GetNextResult()) { | 922 if (!catcher.GetNextResult()) { |
923 std::string message = catcher.message(); | 923 std::string message = catcher.message(); |
924 ADD_FAILURE() << "Tests failed: " << message; | 924 ADD_FAILURE() << "Tests failed: " << message; |
925 } | 925 } |
926 | 926 |
927 EXPECT_TRUE(fake_google_.IsPageRequested()); | 927 EXPECT_TRUE(fake_google_.IsPageRequested()); |
928 } | 928 } |
929 | 929 |
930 } // namespace chromeos | 930 } // namespace chromeos |
OLD | NEW |