Commit 15c97c3e authored by David Roger's avatar David Roger Committed by Chromium LUCI CQ

[signin] Stop showing signin intercept after 2 times (down from 3)

Change-Id: I7549fbdcb7e37ba59a791119523ea1b8f250c3ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2624730
Commit-Queue: David Roger <droger@chromium.org>
Reviewed-by: default avatarAlex Ilin <alexilin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842660}
parent b67a109d
......@@ -553,8 +553,8 @@ bool DiceWebSigninInterceptor::HasUserDeclinedProfileCreation(
kProfileCreationInterceptionDeclinedPref);
base::Optional<int> declined_count =
pref_data->FindIntKey(GetPersistentEmailHash(email));
// Check if the user declined 3 times.
constexpr int kMaxProfileCreationDeclinedCount = 3;
// Check if the user declined 2 times.
constexpr int kMaxProfileCreationDeclinedCount = 2;
return declined_count &&
declined_count.value() >= kMaxProfileCreationDeclinedCount;
}
......@@ -294,7 +294,7 @@ class DiceWebSigninInterceptor : public KeyedService,
// cannot be reversed.
void RecordProfileCreationDeclined(const std::string& email);
// Checks if the user previously declined 3 times creating a new profile for
// Checks if the user previously declined 2 times creating a new profile for
// this account.
bool HasUserDeclinedProfileCreation(const std::string& email) const;
......
......@@ -493,11 +493,12 @@ TEST_F(DiceWebSigninInterceptorTest, DeclineRepeatedly) {
account_info.hosted_domain = "example.com";
identity_test_env()->UpdateAccountInfoForAccount(account_info);
// Decline the interception three times.
const int kMaxProfileCreationDeclinedCount = 2;
// Decline the interception kMaxProfileCreationDeclinedCount times.
DiceWebSigninInterceptor::Delegate::BubbleParameters expected_parameters = {
DiceWebSigninInterceptor::SigninInterceptionType::kEnterprise,
account_info, primary_account_info, SkColor()};
for (int i = 0; i < 3; ++i) {
for (int i = 0; i < kMaxProfileCreationDeclinedCount; ++i) {
EXPECT_CALL(*mock_delegate(),
ShowSigninInterceptionBubble(
web_contents(), MatchBubbleParameters(expected_parameters),
......@@ -514,7 +515,7 @@ TEST_F(DiceWebSigninInterceptorTest, DeclineRepeatedly) {
SigninInterceptionHeuristicOutcome::kInterceptEnterprise, i + 1);
}
// Fourth time the interception is not shown again.
// Next time the interception is not shown again.
MaybeIntercept(account_info.account_id);
EXPECT_EQ(interceptor()->is_interception_in_progress(), false);
histogram_tester.ExpectBucketCount(
......@@ -544,7 +545,8 @@ TEST_F(DiceWebSigninInterceptorTest, DeclineRepeatedly) {
MaybeIntercept(account_info.account_id);
histogram_tester.ExpectBucketCount(
"Signin.Intercept.HeuristicOutcome",
SigninInterceptionHeuristicOutcome::kInterceptEnterprise, 4);
SigninInterceptionHeuristicOutcome::kInterceptEnterprise,
kMaxProfileCreationDeclinedCount + 1);
EXPECT_EQ(interceptor()->is_interception_in_progress(), true);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment