[iOS][PRDBD] Adds unit tests for the removal of the password option [chromium/src : main]

0 views
Skip to first unread message

Angela Novakovic (Gerrit)

unread,
Jan 13, 2026, 2:32:11 PM (5 days ago) Jan 13
to Noémie St-Onge, Chromium LUCI CQ, chromium...@chromium.org, dullweb...@chromium.org, feature-me...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, msrame...@chromium.org
Attention needed from Noémie St-Onge

Angela Novakovic voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Noémie St-Onge
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ibbc32f30c4e3c3563ea82cc012d6dc92a3c018ad
Gerrit-Change-Number: 7398648
Gerrit-PatchSet: 7
Gerrit-Owner: Angela Novakovic <novak...@google.com>
Gerrit-Reviewer: Angela Novakovic <novak...@google.com>
Gerrit-Reviewer: Noémie St-Onge <noe...@google.com>
Gerrit-Attention: Noémie St-Onge <noe...@google.com>
Gerrit-Comment-Date: Tue, 13 Jan 2026 19:32:04 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Noémie St-Onge (Gerrit)

unread,
Jan 13, 2026, 5:39:20 PM (5 days ago) Jan 13
to Angela Novakovic, Chromium LUCI CQ, chromium...@chromium.org, dullweb...@chromium.org, feature-me...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, msrame...@chromium.org
Attention needed from Angela Novakovic

Noémie St-Onge added 17 comments

File ios/chrome/browser/settings/ui_bundled/clear_browsing_data/coordinator/quick_delete_mediator.mm
Line 495, Patchset 7 (Latest): selected && !IsPasswordRemovalFromDeleteBrowsingDataEnabled()
Noémie St-Onge . unresolved

No need for this as we would have crashed on line 486 already

File ios/chrome/browser/settings/ui_bundled/clear_browsing_data/coordinator/quick_delete_mediator_unittest.mm
Line 223, Patchset 7 (Latest): base::test::ScopedFeatureList feature_list_;
Noémie St-Onge . unresolved

Since a lot of the test cases don't need the ScopedFeatureList, we can instead define it at the test case level when needed. Doing so will also lower the chances of forgetting to remove this variable after the feature launched. The resulting number of lines should also be pretty similar

To enable the flag:
```
base::test::ScopedFeatureList feature_list(kPasswordRemovalFromDeleteBrowsingData);
```

To disable the flag:
```
base::test::ScopedFeatureList feature_list;
feature_list.InitAndDisableFeature(kPasswordRemovalFromDeleteBrowsingData);
```

Line 353, Patchset 7 (Latest): if (IsPasswordRemovalFromDeleteBrowsingDataEnabled()) {
GTEST_SKIP() << "The test is skipped as the feature flag "
"`kPasswordRemovalFromDeleteBrowsingData` is enabled, thus "
"the password summary is not available.";
return;
}
Noémie St-Onge . unresolved

We should prefer forcing the flag off using the `ScopedFeatureList` as it will ensure a full coverage. Given the simplicity and lightness of unit tests, we should aim at running every test case and not depend on the current state of the feature flag

Also applies to the other skipped test cases

Line 617, Patchset 7 (Latest):// teh feature flag `kPasswordRemovalFromDeleteBrowsingData` is disabled.
Noémie St-Onge . unresolved

typo: `teh -> the`

Line 621, Patchset 7 (Latest): GTEST_SKIP()
<< "The test is skipped as the feature flag "
"`kPasswordRemovalFromDeleteBrowsingData` is enabled, thus the test "
"cannot be done using passwords as a type of data.";
Noémie St-Onge . unresolved

I think this test also applies when the feature is enabled. I understand that it will fail if it stays as is because we are using the password data type, but I think we could simply work around that by replacing the passwords-related stuff with another data type. The goal of this test is to verify the summary with multiple data types, not to test passwords specifically

Line 664, Patchset 7 (Latest):// teh feature flag `kPasswordRemovalFromDeleteBrowsingData` is enabled.
Noémie St-Onge . unresolved

typo: `teh -> the`

Line 665, Patchset 7 (Latest):TEST_F(QuickDeleteMediatorTest,
TestSummaryWithSeveralTypesWithThePasswordRemovalFeatureEnabled) {
Noémie St-Onge . unresolved

See my comment for the test above. I don't think we need both

Line 705, Patchset 7 (Latest):// Tests that setPasswordsSelection is not called when the feature
Noémie St-Onge . unresolved

`` `setPasswordsSelection` ``

Line 712, Patchset 7 (Latest): // Regardless of the pref value, setPasswordsSelection will not be called by
Noémie St-Onge . unresolved

`` `setPasswordsSelection` ``

Line 733, Patchset 7 (Latest): // The pref value of `kDeletePasswords` will not be updated when the feature
// flag `kPasswordRemovalFromDeleteBrowsingData` is enabled.
prefs()->SetBoolean(browsing_data::prefs::kDeletePasswords, true);
prefs()->SetBoolean(browsing_data::prefs::kCloseTabs, true);

OCMReject([consumer_ setPasswordsSelection:YES]);
OCMExpect([consumer_ setTabsSelection:YES]);
Noémie St-Onge . unresolved

Is this relevant to this specific test case? If not, I don't think we need to test it again

Line 747, Patchset 7 (Latest): NSString* expectedSummary = [NSString
Noémie St-Onge . unresolved

should be in snake_case since this is C++

Line 752, Patchset 7 (Latest): NSString* notExpectedSummary = [NSString
Noémie St-Onge . unresolved

should be in snake_case since this is C++, would also rename it to `unexpected_summary` or `wrong_summary`

Line 761, Patchset 7 (Latest): OCMExpect([consumer_ setBrowsingDataSummary:expectedSummary]);
OCMReject([consumer_ setBrowsingDataSummary:notExpectedSummary]);
Noémie St-Onge . unresolved
FYI: If your goal is just to verify that the passed summary doesn't contain the string for passwords, you can use `OCMArg` to verify the argument:
```
OCMExpect([consumer_
setBrowsingDataSummary:[OCMArg checkWithBlock:^(NSString* summary) {
return ![summary
containsString:l10n_util::GetPluralNSStringF(
IDS_IOS_DELETE_BROWSING_DATA_SUMMARY_PASSWORDS,
1)];
}]]);
```
Line 776, Patchset 7 (Latest): // Setting the consumers calls the createCounters method.
Noémie St-Onge . unresolved

`` `createCounters` ``

Line 786, Patchset 7 (Latest):// TODO(crbug.com/463402932): Remove the below unit test after clean up.
Noémie St-Onge . unresolved

We don't really need a TODO here as we'll know that the entire test case should be removed when we'll clean up the flag disablement

Line 794, Patchset 7 (Latest): // Setting the consumer calls the createCounters method.
Noémie St-Onge . unresolved

``` `createCounters` ``

File ios/chrome/browser/settings/ui_bundled/clear_browsing_data/model/fake_browsing_data_counter_wrapper_producer.h
Line 14, Patchset 7 (Latest):- (NSUInteger)CounterCount;
Noémie St-Onge . unresolved

Should start with a lowercase letter as this is Objective-C -> `counterCount`

Open in Gerrit

Related details

Attention is currently required from:
  • Angela Novakovic
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ibbc32f30c4e3c3563ea82cc012d6dc92a3c018ad
    Gerrit-Change-Number: 7398648
    Gerrit-PatchSet: 7
    Gerrit-Owner: Angela Novakovic <novak...@google.com>
    Gerrit-Reviewer: Angela Novakovic <novak...@google.com>
    Gerrit-Reviewer: Noémie St-Onge <noe...@google.com>
    Gerrit-Attention: Angela Novakovic <novak...@google.com>
    Gerrit-Comment-Date: Tue, 13 Jan 2026 22:39:14 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Angela Novakovic (Gerrit)

    unread,
    Jan 14, 2026, 4:06:54 PM (4 days ago) Jan 14
    to Noémie St-Onge, Chromium LUCI CQ, chromium...@chromium.org, dullweb...@chromium.org, feature-me...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, msrame...@chromium.org
    Attention needed from Noémie St-Onge

    Angela Novakovic added 17 comments

    File ios/chrome/browser/settings/ui_bundled/clear_browsing_data/coordinator/quick_delete_mediator.mm
    Line 495, Patchset 7: selected && !IsPasswordRemovalFromDeleteBrowsingDataEnabled()
    Noémie St-Onge . resolved

    No need for this as we would have crashed on line 486 already

    Angela Novakovic

    Done

    File ios/chrome/browser/settings/ui_bundled/clear_browsing_data/coordinator/quick_delete_mediator_unittest.mm
    Line 223, Patchset 7: base::test::ScopedFeatureList feature_list_;
    Noémie St-Onge . resolved

    Since a lot of the test cases don't need the ScopedFeatureList, we can instead define it at the test case level when needed. Doing so will also lower the chances of forgetting to remove this variable after the feature launched. The resulting number of lines should also be pretty similar

    To enable the flag:
    ```
    base::test::ScopedFeatureList feature_list(kPasswordRemovalFromDeleteBrowsingData);
    ```

    To disable the flag:
    ```
    base::test::ScopedFeatureList feature_list;
    feature_list.InitAndDisableFeature(kPasswordRemovalFromDeleteBrowsingData);
    ```

    Angela Novakovic

    Done

    Line 353, Patchset 7: if (IsPasswordRemovalFromDeleteBrowsingDataEnabled()) {

    GTEST_SKIP() << "The test is skipped as the feature flag "
    "`kPasswordRemovalFromDeleteBrowsingData` is enabled, thus "
    "the password summary is not available.";
    return;
    }
    Noémie St-Onge . resolved

    We should prefer forcing the flag off using the `ScopedFeatureList` as it will ensure a full coverage. Given the simplicity and lightness of unit tests, we should aim at running every test case and not depend on the current state of the feature flag

    Also applies to the other skipped test cases

    Angela Novakovic

    Done

    Line 617, Patchset 7:// teh feature flag `kPasswordRemovalFromDeleteBrowsingData` is disabled.
    Noémie St-Onge . resolved

    typo: `teh -> the`

    Angela Novakovic

    Done


    << "The test is skipped as the feature flag "
    "`kPasswordRemovalFromDeleteBrowsingData` is enabled, thus the test "
    "cannot be done using passwords as a type of data.";
    Noémie St-Onge . resolved

    I think this test also applies when the feature is enabled. I understand that it will fail if it stays as is because we are using the password data type, but I think we could simply work around that by replacing the passwords-related stuff with another data type. The goal of this test is to verify the summary with multiple data types, not to test passwords specifically

    Angela Novakovic

    Done

    Line 664, Patchset 7:// teh feature flag `kPasswordRemovalFromDeleteBrowsingData` is enabled.
    Noémie St-Onge . resolved

    typo: `teh -> the`

    Angela Novakovic

    Done

    Line 665, Patchset 7:TEST_F(QuickDeleteMediatorTest,
    TestSummaryWithSeveralTypesWithThePasswordRemovalFeatureEnabled) {
    Noémie St-Onge . resolved

    See my comment for the test above. I don't think we need both

    Angela Novakovic

    Done

    Line 705, Patchset 7:// Tests that setPasswordsSelection is not called when the feature
    Noémie St-Onge . resolved

    `` `setPasswordsSelection` ``

    Angela Novakovic

    Done

    Line 712, Patchset 7: // Regardless of the pref value, setPasswordsSelection will not be called by
    Noémie St-Onge . resolved

    `` `setPasswordsSelection` ``

    Angela Novakovic

    Done

    Line 733, Patchset 7: // The pref value of `kDeletePasswords` will not be updated when the feature

    // flag `kPasswordRemovalFromDeleteBrowsingData` is enabled.
    prefs()->SetBoolean(browsing_data::prefs::kDeletePasswords, true);
    prefs()->SetBoolean(browsing_data::prefs::kCloseTabs, true);

    OCMReject([consumer_ setPasswordsSelection:YES]);
    OCMExpect([consumer_ setTabsSelection:YES]);
    Noémie St-Onge . unresolved

    Is this relevant to this specific test case? If not, I don't think we need to test it again

    Angela Novakovic

    After looking at this test again, I think it's not possible to do it properly. The triggerUpdateUICallbackForPasswordsResults would have to be called and still result in a summary without passwords, but as it is using the FakeBrowsingDataCounterWrapperProducer, it is not disabled for passwords. I think we can skip this test. What do you think?

    Line 747, Patchset 7: NSString* expectedSummary = [NSString
    Noémie St-Onge . resolved

    should be in snake_case since this is C++

    Angela Novakovic

    Done

    Line 752, Patchset 7: NSString* notExpectedSummary = [NSString
    Noémie St-Onge . resolved

    should be in snake_case since this is C++, would also rename it to `unexpected_summary` or `wrong_summary`

    Angela Novakovic

    Done

    Line 761, Patchset 7: OCMExpect([consumer_ setBrowsingDataSummary:expectedSummary]);

    OCMReject([consumer_ setBrowsingDataSummary:notExpectedSummary]);
    Noémie St-Onge . resolved
    FYI: If your goal is just to verify that the passed summary doesn't contain the string for passwords, you can use `OCMArg` to verify the argument:
    ```
    OCMExpect([consumer_
    setBrowsingDataSummary:[OCMArg checkWithBlock:^(NSString* summary) {
    return ![summary
    containsString:l10n_util::GetPluralNSStringF(
    IDS_IOS_DELETE_BROWSING_DATA_SUMMARY_PASSWORDS,
    1)];
    }]]);
    ```
    Angela Novakovic

    Done

    Line 776, Patchset 7: // Setting the consumers calls the createCounters method.
    Noémie St-Onge . resolved

    `` `createCounters` ``

    Angela Novakovic

    Done

    Line 786, Patchset 7:// TODO(crbug.com/463402932): Remove the below unit test after clean up.
    Noémie St-Onge . resolved

    We don't really need a TODO here as we'll know that the entire test case should be removed when we'll clean up the flag disablement

    Angela Novakovic

    Done

    Line 794, Patchset 7: // Setting the consumer calls the createCounters method.
    Noémie St-Onge . resolved

    ``` `createCounters` ``

    Angela Novakovic

    Done

    File ios/chrome/browser/settings/ui_bundled/clear_browsing_data/model/fake_browsing_data_counter_wrapper_producer.h
    Line 14, Patchset 7:- (NSUInteger)CounterCount;
    Noémie St-Onge . resolved

    Should start with a lowercase letter as this is Objective-C -> `counterCount`

    Angela Novakovic

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Noémie St-Onge
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ibbc32f30c4e3c3563ea82cc012d6dc92a3c018ad
    Gerrit-Change-Number: 7398648
    Gerrit-PatchSet: 10
    Gerrit-Owner: Angela Novakovic <novak...@google.com>
    Gerrit-Reviewer: Angela Novakovic <novak...@google.com>
    Gerrit-Reviewer: Noémie St-Onge <noe...@google.com>
    Gerrit-Attention: Noémie St-Onge <noe...@google.com>
    Gerrit-Comment-Date: Wed, 14 Jan 2026 21:06:48 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Noémie St-Onge <noe...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Angela Novakovic (Gerrit)

    unread,
    Jan 15, 2026, 9:29:04 AM (3 days ago) Jan 15
    to Noémie St-Onge, Chromium LUCI CQ, chromium...@chromium.org, dullweb...@chromium.org, feature-me...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, msrame...@chromium.org
    Attention needed from Angela Novakovic

    Angela Novakovic voted Commit-Queue+1

    Commit-Queue+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Angela Novakovic
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ibbc32f30c4e3c3563ea82cc012d6dc92a3c018ad
    Gerrit-Change-Number: 7398648
    Gerrit-PatchSet: 11
    Gerrit-Owner: Angela Novakovic <novak...@google.com>
    Gerrit-Reviewer: Angela Novakovic <novak...@google.com>
    Gerrit-Reviewer: Noémie St-Onge <noe...@google.com>
    Gerrit-Attention: Angela Novakovic <novak...@google.com>
    Gerrit-Comment-Date: Thu, 15 Jan 2026 14:28:59 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Noémie St-Onge (Gerrit)

    unread,
    Jan 16, 2026, 3:02:43 PM (2 days ago) Jan 16
    to Angela Novakovic, Chromium LUCI CQ, chromium...@chromium.org, dullweb...@chromium.org, feature-me...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, msrame...@chromium.org
    Attention needed from Angela Novakovic

    Noémie St-Onge added 5 comments

    File ios/chrome/browser/settings/ui_bundled/clear_browsing_data/coordinator/quick_delete_mediator_unittest.mm
    Line 613, Patchset 13 (Latest):TEST_F(QuickDeleteMediatorTest,
    Noémie St-Onge . unresolved

    This test is also valid when the feature is disabled, it just needs to be adapted, see comments below

    Line 630, Patchset 13 (Latest): // dispatches if all counters have returned.
    Noémie St-Onge . unresolved
    ```suggestion
    // dispatched if all counters have returned.
    ```
    Line 631, Patchset 13 (Latest): triggerUpdateUICallbackForAutofillResults(0, 0, 0);
    Noémie St-Onge . unresolved
    ```suggestion
    triggerUpdateUICallbackForAutofillResults(0, 0, 0);
    if (!IsPasswordRemovalFromDeleteBrowsingDataEnabled()) {
    triggerUpdateUICallbackForPasswordsResults(0);
    }
    ```
    Line 657, Patchset 13 (Latest): SetConsumerWithThePasswordRemovalFeatureEnabled) {
    Noémie St-Onge . unresolved

    This test name doesn't really describe what's being tested here and could apply to the other tests below

    Line 689, Patchset 13 (Latest): EXPECT_EQ(4U, [fake_browsing_data_counter_wrapper_producer_ counterCount]);
    Noémie St-Onge . unresolved

    Would it be possible to instead have the `fake_browsing_data_counter_wrapper_producer_` return all the callbacks so that we can check the pref name associated with them and confirm that it is indeed the passwords one that's not present?

    We could also return a vector with the pref names only

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Angela Novakovic
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ibbc32f30c4e3c3563ea82cc012d6dc92a3c018ad
    Gerrit-Change-Number: 7398648
    Gerrit-PatchSet: 13
    Gerrit-Owner: Angela Novakovic <novak...@google.com>
    Gerrit-Reviewer: Angela Novakovic <novak...@google.com>
    Gerrit-Reviewer: Noémie St-Onge <noe...@google.com>
    Gerrit-Attention: Angela Novakovic <novak...@google.com>
    Gerrit-Comment-Date: Fri, 16 Jan 2026 20:02:38 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages