| OLD | NEW |
| 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/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "chrome/browser/prefs/pref_service_syncable.h" | 11 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 12 #include "chrome/browser/signin/account_reconcilor_factory.h" | 12 #include "chrome/browser/signin/account_reconcilor_factory.h" |
| 13 #include "chrome/browser/signin/chrome_signin_client_factory.h" | 13 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
| 14 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" | 14 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
| 15 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" | 15 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" |
| 16 #include "chrome/browser/signin/fake_signin_manager.h" | 16 #include "chrome/browser/signin/fake_signin_manager.h" |
| 17 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 17 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 18 #include "chrome/browser/signin/signin_manager_factory.h" | 18 #include "chrome/browser/signin/signin_manager_factory.h" |
| 19 #include "chrome/browser/signin/test_signin_client_builder.h" | 19 #include "chrome/browser/signin/test_signin_client_builder.h" |
| 20 #include "chrome/test/base/testing_browser_process.h" | 20 #include "chrome/test/base/testing_browser_process.h" |
| 21 #include "chrome/test/base/testing_profile.h" | 21 #include "chrome/test/base/testing_profile.h" |
| 22 #include "chrome/test/base/testing_profile_manager.h" | 22 #include "chrome/test/base/testing_profile_manager.h" |
| 23 #include "chrome/test/base/uma_histogram_helper.h" | 23 #include "chrome/test/base/uma_histogram_helper.h" |
| 24 #include "components/signin/core/browser/account_reconcilor.h" | 24 #include "components/signin/core/browser/account_reconcilor.h" |
| 25 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 25 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 26 #include "components/signin/core/browser/signin_manager.h" | 26 #include "components/signin/core/browser/signin_manager.h" |
| 27 #include "components/signin/core/browser/signin_metrics.h" |
| 27 #include "components/signin/core/common/profile_management_switches.h" | 28 #include "components/signin/core/common/profile_management_switches.h" |
| 28 #include "components/signin/core/common/signin_switches.h" | 29 #include "components/signin/core/common/signin_switches.h" |
| 29 #include "content/public/test/test_browser_thread_bundle.h" | 30 #include "content/public/test/test_browser_thread_bundle.h" |
| 30 #include "google_apis/gaia/gaia_urls.h" | 31 #include "google_apis/gaia/gaia_urls.h" |
| 31 #include "net/url_request/test_url_fetcher_factory.h" | 32 #include "net/url_request/test_url_fetcher_factory.h" |
| 32 #include "testing/gmock/include/gmock/gmock.h" | 33 #include "testing/gmock/include/gmock/gmock.h" |
| 33 #include "testing/gtest/include/gtest/gtest.h" | 34 #include "testing/gtest/include/gtest/gtest.h" |
| 34 | 35 |
| 35 namespace { | 36 namespace { |
| 36 | 37 |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 base::Time::Now() + base::TimeDelta::FromHours(1)); | 387 base::Time::Now() + base::TimeDelta::FromHours(1)); |
| 387 | 388 |
| 388 base::RunLoop().RunUntilIdle(); | 389 base::RunLoop().RunUntilIdle(); |
| 389 ASSERT_TRUE(reconcilor->AreAllRefreshTokensChecked()); | 390 ASSERT_TRUE(reconcilor->AreAllRefreshTokensChecked()); |
| 390 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 391 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 391 | 392 |
| 392 histogram_helper()->Fetch(); | 393 histogram_helper()->Fetch(); |
| 393 histogram_helper()->ExpectTotalCount( | 394 histogram_helper()->ExpectTotalCount( |
| 394 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 1); | 395 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 1); |
| 395 histogram_helper()->ExpectUniqueSample( | 396 histogram_helper()->ExpectUniqueSample( |
| 396 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 0, 1); | 397 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", |
| 398 signin_metrics::ACCOUNTS_SAME, |
| 399 1); |
| 397 } | 400 } |
| 398 | 401 |
| 399 // This is test is needed until chrome changes to use gaia obfuscated id. | 402 // This is test is needed until chrome changes to use gaia obfuscated id. |
| 400 // The signin manager and token service use the gaia "email" property, which | 403 // The signin manager and token service use the gaia "email" property, which |
| 401 // preserves dots in usernames and preserves case. gaia::ParseListAccountsData() | 404 // preserves dots in usernames and preserves case. gaia::ParseListAccountsData() |
| 402 // however uses gaia "displayEmail" which does not preserve case, and then | 405 // however uses gaia "displayEmail" which does not preserve case, and then |
| 403 // passes the string through gaia::CanonicalizeEmail() which removes dots. This | 406 // passes the string through gaia::CanonicalizeEmail() which removes dots. This |
| 404 // tests makes sure that an email like "Dot.S@hmail.com", as seen by the | 407 // tests makes sure that an email like "Dot.S@hmail.com", as seen by the |
| 405 // token service, will be considered the same as "dots@gmail.com" as returned | 408 // token service, will be considered the same as "dots@gmail.com" as returned |
| 406 // by gaia::ParseListAccountsData(). | 409 // by gaia::ParseListAccountsData(). |
| (...skipping 24 matching lines...) Expand all Loading... |
| 431 | 434 |
| 432 token_service()->IssueAllTokensForAccount("Dot.S@gmail.com", "access_token", | 435 token_service()->IssueAllTokensForAccount("Dot.S@gmail.com", "access_token", |
| 433 base::Time::Now() + base::TimeDelta::FromHours(1)); | 436 base::Time::Now() + base::TimeDelta::FromHours(1)); |
| 434 | 437 |
| 435 base::RunLoop().RunUntilIdle(); | 438 base::RunLoop().RunUntilIdle(); |
| 436 ASSERT_TRUE(reconcilor->AreAllRefreshTokensChecked()); | 439 ASSERT_TRUE(reconcilor->AreAllRefreshTokensChecked()); |
| 437 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 440 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 438 | 441 |
| 439 histogram_helper()->Fetch(); | 442 histogram_helper()->Fetch(); |
| 440 histogram_helper()->ExpectUniqueSample( | 443 histogram_helper()->ExpectUniqueSample( |
| 441 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 0, 1); | 444 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", |
| 445 signin_metrics::ACCOUNTS_SAME, |
| 446 1); |
| 442 } | 447 } |
| 443 | 448 |
| 444 TEST_P(AccountReconcilorTest, StartReconcileNoopMultiple) { | 449 TEST_P(AccountReconcilorTest, StartReconcileNoopMultiple) { |
| 445 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); | 450 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); |
| 446 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); | 451 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); |
| 447 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); | 452 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); |
| 448 | 453 |
| 449 AccountReconcilor* reconcilor = | 454 AccountReconcilor* reconcilor = |
| 450 AccountReconcilorFactory::GetForProfile(profile()); | 455 AccountReconcilorFactory::GetForProfile(profile()); |
| 451 ASSERT_TRUE(reconcilor); | 456 ASSERT_TRUE(reconcilor); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 476 base::Time::Now() + base::TimeDelta::FromHours(1)); | 481 base::Time::Now() + base::TimeDelta::FromHours(1)); |
| 477 | 482 |
| 478 base::RunLoop().RunUntilIdle(); | 483 base::RunLoop().RunUntilIdle(); |
| 479 ASSERT_TRUE(reconcilor->AreAllRefreshTokensChecked()); | 484 ASSERT_TRUE(reconcilor->AreAllRefreshTokensChecked()); |
| 480 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 485 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 481 | 486 |
| 482 histogram_helper()->Fetch(); | 487 histogram_helper()->Fetch(); |
| 483 histogram_helper()->ExpectTotalCount( | 488 histogram_helper()->ExpectTotalCount( |
| 484 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 1); | 489 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 1); |
| 485 histogram_helper()->ExpectUniqueSample( | 490 histogram_helper()->ExpectUniqueSample( |
| 486 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 0, 1); | 491 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", |
| 492 signin_metrics::ACCOUNTS_SAME, |
| 493 1); |
| 487 } | 494 } |
| 488 | 495 |
| 489 TEST_P(AccountReconcilorTest, StartReconcileAddToCookie) { | 496 TEST_P(AccountReconcilorTest, StartReconcileAddToCookie) { |
| 490 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); | 497 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); |
| 491 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); | 498 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); |
| 492 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); | 499 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); |
| 493 | 500 |
| 494 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("other@gmail.com")); | 501 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("other@gmail.com")); |
| 495 | 502 |
| 496 SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(), | 503 SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(), |
| (...skipping 10 matching lines...) Expand all Loading... |
| 507 base::Time::Now() + base::TimeDelta::FromHours(1)); | 514 base::Time::Now() + base::TimeDelta::FromHours(1)); |
| 508 | 515 |
| 509 base::RunLoop().RunUntilIdle(); | 516 base::RunLoop().RunUntilIdle(); |
| 510 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 517 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| 511 SimulateMergeSessionCompleted(reconcilor, "other@gmail.com", | 518 SimulateMergeSessionCompleted(reconcilor, "other@gmail.com", |
| 512 GoogleServiceAuthError::AuthErrorNone()); | 519 GoogleServiceAuthError::AuthErrorNone()); |
| 513 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 520 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 514 | 521 |
| 515 histogram_helper()->Fetch(); | 522 histogram_helper()->Fetch(); |
| 516 histogram_helper()->ExpectUniqueSample( | 523 histogram_helper()->ExpectUniqueSample( |
| 517 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 0, 1); | 524 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", |
| 525 signin_metrics::ACCOUNTS_SAME, |
| 526 1); |
| 518 histogram_helper()->ExpectUniqueSample( | 527 histogram_helper()->ExpectUniqueSample( |
| 519 "Signin.Reconciler.AddedToCookieJar.FirstRun", 1, 1); | 528 "Signin.Reconciler.AddedToCookieJar.FirstRun", 1, 1); |
| 520 histogram_helper()->ExpectUniqueSample( | 529 histogram_helper()->ExpectUniqueSample( |
| 521 "Signin.Reconciler.AddedToChrome.FirstRun", 0, 1); | 530 "Signin.Reconciler.AddedToChrome.FirstRun", 0, 1); |
| 522 } | 531 } |
| 523 | 532 |
| 524 TEST_P(AccountReconcilorTest, StartReconcileAddToCookieTwice) { | 533 TEST_P(AccountReconcilorTest, StartReconcileAddToCookieTwice) { |
| 525 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); | 534 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); |
| 526 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); | 535 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); |
| 527 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); | 536 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 551 base::Time::Now() + base::TimeDelta::FromHours(1)); | 560 base::Time::Now() + base::TimeDelta::FromHours(1)); |
| 552 | 561 |
| 553 base::RunLoop().RunUntilIdle(); | 562 base::RunLoop().RunUntilIdle(); |
| 554 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 563 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| 555 SimulateMergeSessionCompleted( | 564 SimulateMergeSessionCompleted( |
| 556 reconcilor, "other@gmail.com", GoogleServiceAuthError::AuthErrorNone()); | 565 reconcilor, "other@gmail.com", GoogleServiceAuthError::AuthErrorNone()); |
| 557 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 566 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 558 | 567 |
| 559 histogram_helper()->Fetch(); | 568 histogram_helper()->Fetch(); |
| 560 histogram_helper()->ExpectUniqueSample( | 569 histogram_helper()->ExpectUniqueSample( |
| 561 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 0, 1); | 570 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", |
| 571 signin_metrics::ACCOUNTS_SAME, |
| 572 1); |
| 562 histogram_helper()->ExpectUniqueSample( | 573 histogram_helper()->ExpectUniqueSample( |
| 563 "Signin.Reconciler.AddedToCookieJar.FirstRun", 1, 1); | 574 "Signin.Reconciler.AddedToCookieJar.FirstRun", 1, 1); |
| 564 histogram_helper()->ExpectUniqueSample( | 575 histogram_helper()->ExpectUniqueSample( |
| 565 "Signin.Reconciler.AddedToChrome.FirstRun", 0, 1); | 576 "Signin.Reconciler.AddedToChrome.FirstRun", 0, 1); |
| 566 | 577 |
| 567 // Do another pass after I've added a third account to the token service | 578 // Do another pass after I've added a third account to the token service |
| 568 | 579 |
| 569 SetFakeResponse( | 580 SetFakeResponse( |
| 570 GaiaUrls::GetInstance()->list_accounts_url().spec(), | 581 GaiaUrls::GetInstance()->list_accounts_url().spec(), |
| 571 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1], " | 582 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1], " |
| (...skipping 18 matching lines...) Expand all Loading... |
| 590 | 601 |
| 591 base::RunLoop().RunUntilIdle(); | 602 base::RunLoop().RunUntilIdle(); |
| 592 | 603 |
| 593 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 604 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| 594 SimulateMergeSessionCompleted( | 605 SimulateMergeSessionCompleted( |
| 595 reconcilor, "third@gmail.com", GoogleServiceAuthError::AuthErrorNone()); | 606 reconcilor, "third@gmail.com", GoogleServiceAuthError::AuthErrorNone()); |
| 596 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 607 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 597 | 608 |
| 598 histogram_helper()->Fetch(); | 609 histogram_helper()->Fetch(); |
| 599 histogram_helper()->ExpectUniqueSample( | 610 histogram_helper()->ExpectUniqueSample( |
| 600 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 0, 1); | 611 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", |
| 612 signin_metrics::ACCOUNTS_SAME, |
| 613 1); |
| 601 histogram_helper()->ExpectUniqueSample( | 614 histogram_helper()->ExpectUniqueSample( |
| 602 "Signin.Reconciler.AddedToCookieJar.FirstRun", 1, 1); | 615 "Signin.Reconciler.AddedToCookieJar.FirstRun", 1, 1); |
| 603 histogram_helper()->ExpectUniqueSample( | 616 histogram_helper()->ExpectUniqueSample( |
| 604 "Signin.Reconciler.AddedToChrome.FirstRun", 0, 1); | 617 "Signin.Reconciler.AddedToChrome.FirstRun", 0, 1); |
| 605 histogram_helper()->ExpectUniqueSample( | 618 histogram_helper()->ExpectUniqueSample( |
| 606 "Signin.Reconciler.DifferentPrimaryAccounts.SubsequentRun", 0, 1); | 619 "Signin.Reconciler.DifferentPrimaryAccounts.SubsequentRun", |
| 620 signin_metrics::ACCOUNTS_SAME, |
| 621 1); |
| 607 histogram_helper()->ExpectUniqueSample( | 622 histogram_helper()->ExpectUniqueSample( |
| 608 "Signin.Reconciler.AddedToCookieJar.SubsequentRun", 1, 1); | 623 "Signin.Reconciler.AddedToCookieJar.SubsequentRun", 1, 1); |
| 609 histogram_helper()->ExpectUniqueSample( | 624 histogram_helper()->ExpectUniqueSample( |
| 610 "Signin.Reconciler.AddedToChrome.SubsequentRun", 0, 1); | 625 "Signin.Reconciler.AddedToChrome.SubsequentRun", 0, 1); |
| 611 } | 626 } |
| 612 | 627 |
| 613 TEST_P(AccountReconcilorTest, StartReconcileAddToChrome) { | 628 TEST_P(AccountReconcilorTest, StartReconcileAddToChrome) { |
| 614 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); | 629 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); |
| 615 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); | 630 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); |
| 616 | 631 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 629 token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token", | 644 token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token", |
| 630 base::Time::Now() + base::TimeDelta::FromHours(1)); | 645 base::Time::Now() + base::TimeDelta::FromHours(1)); |
| 631 | 646 |
| 632 base::RunLoop().RunUntilIdle(); | 647 base::RunLoop().RunUntilIdle(); |
| 633 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 648 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| 634 SimulateRefreshTokenFetched(reconcilor, "other@gmail.com", ""); | 649 SimulateRefreshTokenFetched(reconcilor, "other@gmail.com", ""); |
| 635 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 650 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 636 | 651 |
| 637 histogram_helper()->Fetch(); | 652 histogram_helper()->Fetch(); |
| 638 histogram_helper()->ExpectUniqueSample( | 653 histogram_helper()->ExpectUniqueSample( |
| 639 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 0, 1); | 654 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", |
| 655 signin_metrics::ACCOUNTS_SAME, |
| 656 1); |
| 640 histogram_helper()->ExpectUniqueSample( | 657 histogram_helper()->ExpectUniqueSample( |
| 641 "Signin.Reconciler.AddedToCookieJar.FirstRun", 0, 1); | 658 "Signin.Reconciler.AddedToCookieJar.FirstRun", 0, 1); |
| 642 histogram_helper()->ExpectUniqueSample( | 659 histogram_helper()->ExpectUniqueSample( |
| 643 "Signin.Reconciler.AddedToChrome.FirstRun", 1, 1); | 660 "Signin.Reconciler.AddedToChrome.FirstRun", 1, 1); |
| 644 } | 661 } |
| 645 | 662 |
| 646 TEST_P(AccountReconcilorTest, StartReconcileBadPrimary) { | 663 TEST_P(AccountReconcilorTest, StartReconcileBadPrimary) { |
| 647 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); | 664 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); |
| 648 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); | 665 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); |
| 649 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); | 666 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 670 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 687 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| 671 SimulateMergeSessionCompleted(reconcilor, "other@gmail.com", | 688 SimulateMergeSessionCompleted(reconcilor, "other@gmail.com", |
| 672 GoogleServiceAuthError::AuthErrorNone()); | 689 GoogleServiceAuthError::AuthErrorNone()); |
| 673 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 690 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| 674 SimulateMergeSessionCompleted(reconcilor, "user@gmail.com", | 691 SimulateMergeSessionCompleted(reconcilor, "user@gmail.com", |
| 675 GoogleServiceAuthError::AuthErrorNone()); | 692 GoogleServiceAuthError::AuthErrorNone()); |
| 676 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 693 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 677 | 694 |
| 678 histogram_helper()->Fetch(); | 695 histogram_helper()->Fetch(); |
| 679 histogram_helper()->ExpectUniqueSample( | 696 histogram_helper()->ExpectUniqueSample( |
| 680 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 1, 1); | 697 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", |
| 698 signin_metrics::COOKIE_AND_TOKEN_PRIMARIES_DIFFERENT, |
| 699 1); |
| 681 histogram_helper()->ExpectUniqueSample( | 700 histogram_helper()->ExpectUniqueSample( |
| 682 "Signin.Reconciler.AddedToCookieJar.FirstRun", 2, 1); | 701 "Signin.Reconciler.AddedToCookieJar.FirstRun", 2, 1); |
| 683 histogram_helper()->ExpectUniqueSample( | 702 histogram_helper()->ExpectUniqueSample( |
| 684 "Signin.Reconciler.AddedToChrome.FirstRun", 0, 1); | 703 "Signin.Reconciler.AddedToChrome.FirstRun", 0, 1); |
| 685 } | 704 } |
| 686 | 705 |
| 687 TEST_P(AccountReconcilorTest, StartReconcileOnlyOnce) { | 706 TEST_P(AccountReconcilorTest, StartReconcileOnlyOnce) { |
| 688 signin_manager()->SetAuthenticatedUsername(kTestEmail); | 707 signin_manager()->SetAuthenticatedUsername(kTestEmail); |
| 689 token_service()->UpdateCredentials(kTestEmail, "refresh_token"); | 708 token_service()->UpdateCredentials(kTestEmail, "refresh_token"); |
| 690 | 709 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 | 757 |
| 739 base::RunLoop().RunUntilIdle(); | 758 base::RunLoop().RunUntilIdle(); |
| 740 SimulateMergeSessionCompleted(reconcilor, "user@gmail.com", | 759 SimulateMergeSessionCompleted(reconcilor, "user@gmail.com", |
| 741 GoogleServiceAuthError::AuthErrorNone()); | 760 GoogleServiceAuthError::AuthErrorNone()); |
| 742 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 761 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 743 } | 762 } |
| 744 | 763 |
| 745 INSTANTIATE_TEST_CASE_P(AccountReconcilorMaybeEnabled, | 764 INSTANTIATE_TEST_CASE_P(AccountReconcilorMaybeEnabled, |
| 746 AccountReconcilorTest, | 765 AccountReconcilorTest, |
| 747 testing::Bool()); | 766 testing::Bool()); |
| OLD | NEW |