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

Side by Side Diff: chrome/browser/signin/account_reconcilor_unittest.cc

Issue 1162103003: ListAccounts will return the Gaia ID as well as the email of the account. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/test/histogram_tester.h" 9 #include "base/test/histogram_tester.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 AccountReconcilorFactory::GetForProfile(profile()); 323 AccountReconcilorFactory::GetForProfile(profile());
324 ASSERT_TRUE(reconcilor); 324 ASSERT_TRUE(reconcilor);
325 325
326 ASSERT_EQ(signin_metrics::ACCOUNT_RECONCILOR_OK, reconcilor->GetState()); 326 ASSERT_EQ(signin_metrics::ACCOUNT_RECONCILOR_OK, reconcilor->GetState());
327 reconcilor->StartReconcile(); 327 reconcilor->StartReconcile();
328 ASSERT_EQ(signin_metrics::ACCOUNT_RECONCILOR_RUNNING, 328 ASSERT_EQ(signin_metrics::ACCOUNT_RECONCILOR_RUNNING,
329 reconcilor->GetState()); 329 reconcilor->GetState());
330 base::RunLoop().RunUntilIdle(); 330 base::RunLoop().RunUntilIdle();
331 ASSERT_EQ(signin_metrics::ACCOUNT_RECONCILOR_RUNNING, reconcilor->GetState()); 331 ASSERT_EQ(signin_metrics::ACCOUNT_RECONCILOR_RUNNING, reconcilor->GetState());
332 332
333 std::vector<std::pair<std::string, bool> > accounts; 333 std::vector<gaia::ListedAccount> accounts;
334 ASSERT_TRUE(cookie_manager_service()->ListAccounts(&accounts)); 334 ASSERT_TRUE(cookie_manager_service()->ListAccounts(&accounts));
335 ASSERT_EQ(1u, accounts.size()); 335 ASSERT_EQ(1u, accounts.size());
336 ASSERT_EQ(account_id, accounts[0].first); 336 ASSERT_EQ(account_id, accounts[0].email);
337 } 337 }
338 338
339 TEST_F(AccountReconcilorTest, GetAccountsFromCookieFailure) { 339 TEST_F(AccountReconcilorTest, GetAccountsFromCookieFailure) {
340 ConnectProfileToAccount("12345", "user@gmail.com"); 340 ConnectProfileToAccount("12345", "user@gmail.com");
341 cookie_manager_service()->SetListAccountsResponseWebLoginRequired(); 341 cookie_manager_service()->SetListAccountsResponseWebLoginRequired();
342 342
343 AccountReconcilor* reconcilor = 343 AccountReconcilor* reconcilor =
344 AccountReconcilorFactory::GetForProfile(profile()); 344 AccountReconcilorFactory::GetForProfile(profile());
345 ASSERT_TRUE(reconcilor); 345 ASSERT_TRUE(reconcilor);
346 346
347 ASSERT_EQ(signin_metrics::ACCOUNT_RECONCILOR_OK, reconcilor->GetState()); 347 ASSERT_EQ(signin_metrics::ACCOUNT_RECONCILOR_OK, reconcilor->GetState());
348 reconcilor->StartReconcile(); 348 reconcilor->StartReconcile();
349 ASSERT_EQ(signin_metrics::ACCOUNT_RECONCILOR_RUNNING, 349 ASSERT_EQ(signin_metrics::ACCOUNT_RECONCILOR_RUNNING,
350 reconcilor->GetState()); 350 reconcilor->GetState());
351 base::RunLoop().RunUntilIdle(); 351 base::RunLoop().RunUntilIdle();
352 352
353 std::vector<std::pair<std::string, bool> > accounts; 353 std::vector<gaia::ListedAccount> accounts;
354 ASSERT_FALSE(cookie_manager_service()->ListAccounts(&accounts)); 354 ASSERT_FALSE(cookie_manager_service()->ListAccounts(&accounts));
355 ASSERT_EQ(0u, accounts.size()); 355 ASSERT_EQ(0u, accounts.size());
356 356
357 base::RunLoop().RunUntilIdle(); 357 base::RunLoop().RunUntilIdle();
358 ASSERT_EQ(signin_metrics::ACCOUNT_RECONCILOR_ERROR, 358 ASSERT_EQ(signin_metrics::ACCOUNT_RECONCILOR_ERROR,
359 reconcilor->GetState()); 359 reconcilor->GetState());
360 } 360 }
361 361
362 TEST_P(AccountReconcilorTest, StartReconcileNoop) { 362 TEST_P(AccountReconcilorTest, StartReconcileNoop) {
363 const std::string account_id = 363 const std::string account_id =
(...skipping 26 matching lines...) Expand all
390 test_signin_client()->set_are_signin_cookies_allowed(false); 390 test_signin_client()->set_are_signin_cookies_allowed(false);
391 391
392 AccountReconcilor* reconcilor = 392 AccountReconcilor* reconcilor =
393 AccountReconcilorFactory::GetForProfile(profile()); 393 AccountReconcilorFactory::GetForProfile(profile());
394 ASSERT_TRUE(reconcilor); 394 ASSERT_TRUE(reconcilor);
395 395
396 reconcilor->StartReconcile(); 396 reconcilor->StartReconcile();
397 ASSERT_FALSE(reconcilor->is_reconcile_started_); 397 ASSERT_FALSE(reconcilor->is_reconcile_started_);
398 398
399 base::RunLoop().RunUntilIdle(); 399 base::RunLoop().RunUntilIdle();
400 std::vector<std::pair<std::string, bool> > accounts; 400 std::vector<gaia::ListedAccount> accounts;
401 // This will be the first call to ListAccounts. 401 // This will be the first call to ListAccounts.
402 ASSERT_FALSE(cookie_manager_service()->ListAccounts(&accounts)); 402 ASSERT_FALSE(cookie_manager_service()->ListAccounts(&accounts));
403 ASSERT_FALSE(reconcilor->is_reconcile_started_); 403 ASSERT_FALSE(reconcilor->is_reconcile_started_);
404 } 404 }
405 405
406 TEST_P(AccountReconcilorTest, StartReconcileContentSettings) { 406 TEST_P(AccountReconcilorTest, StartReconcileContentSettings) {
407 const std::string account_id = 407 const std::string account_id =
408 ConnectProfileToAccount("12345", "user@gmail.com"); 408 ConnectProfileToAccount("12345", "user@gmail.com");
409 token_service()->UpdateCredentials(account_id, "refresh_token"); 409 token_service()->UpdateCredentials(account_id, "refresh_token");
410 410
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 ASSERT_TRUE(reconcilor->is_reconcile_started_); 756 ASSERT_TRUE(reconcilor->is_reconcile_started_);
757 757
758 SimulateAddAccountToCookieCompleted(reconcilor, account_id, 758 SimulateAddAccountToCookieCompleted(reconcilor, account_id,
759 GoogleServiceAuthError::AuthErrorNone()); 759 GoogleServiceAuthError::AuthErrorNone());
760 ASSERT_FALSE(reconcilor->is_reconcile_started_); 760 ASSERT_FALSE(reconcilor->is_reconcile_started_);
761 } 761 }
762 762
763 INSTANTIATE_TEST_CASE_P(AccountReconcilorMaybeEnabled, 763 INSTANTIATE_TEST_CASE_P(AccountReconcilorMaybeEnabled,
764 AccountReconcilorTest, 764 AccountReconcilorTest,
765 testing::Bool()); 765 testing::Bool());
OLDNEW
« no previous file with comments | « chrome/browser/resources/signin_internals/signin_index.html ('k') | chrome/browser/signin/cross_device_promo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698