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

Unified Diff: components/signin/core/browser/signin_investigator_unittest.cc

Issue 1932343003: [Sync] Removed a DCHECK in SigninInvestigator for a valid scenario. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/signin/core/browser/signin_investigator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/signin/core/browser/signin_investigator_unittest.cc
diff --git a/components/signin/core/browser/signin_investigator_unittest.cc b/components/signin/core/browser/signin_investigator_unittest.cc
index 0f5d25fff90968dfb61eea0e43a65bef64b977fd..c031865167a622f8a6af30c68f22f8c52ddb28a5 100644
--- a/components/signin/core/browser/signin_investigator_unittest.cc
+++ b/components/signin/core/browser/signin_investigator_unittest.cc
@@ -42,10 +42,16 @@ class SigninInvestigatorTest : public testing::Test {
const std::string& id,
bool equals_expectated,
AccountEquality histogram_expected) {
- base::HistogramTester histogram_tester;
FakeProvider provider(email, id);
SigninInvestigator investigator(kSameEmail, kSameId, &provider);
- bool equals_actual = investigator.AreAccountsEqualWithFallback();
+ AssertAccountEquality(&investigator, equals_expectated, histogram_expected);
+ }
+
+ void AssertAccountEquality(SigninInvestigator* investigator,
+ bool equals_expectated,
+ AccountEquality histogram_expected) {
+ base::HistogramTester histogram_tester;
+ bool equals_actual = investigator->AreAccountsEqualWithFallback();
ASSERT_EQ(equals_expectated, equals_actual);
histogram_tester.ExpectUniqueSample(
"Signin.AccountEquality", static_cast<int>(histogram_expected), 1);
@@ -93,6 +99,18 @@ TEST_F(SigninInvestigatorTest, EqualityDifferentEmailFallback) {
AccountEquality::EMAIL_FALLBACK);
}
+TEST_F(SigninInvestigatorTest, EqualitySameEmailFallbackEmptyCurrentId) {
+ FakeProvider provider(kSameEmail, kDifferentId);
+ SigninInvestigator investigator(kSameEmail, kEmptyId, &provider);
+ AssertAccountEquality(&investigator, true, AccountEquality::EMAIL_FALLBACK);
+}
+
+TEST_F(SigninInvestigatorTest, EqualityDifferentEmailFallbackEmptyCurrentId) {
+ FakeProvider provider(kDifferentId, kDifferentId);
+ SigninInvestigator investigator(kSameEmail, kEmptyId, &provider);
+ AssertAccountEquality(&investigator, false, AccountEquality::EMAIL_FALLBACK);
+}
+
TEST_F(SigninInvestigatorTest, InvestigateSameAccount) {
AssertInvestigatedScenario(kSameEmail, kSameId,
InvestigatedScenario::SAME_ACCOUNT);
« no previous file with comments | « components/signin/core/browser/signin_investigator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698