Commit 0a13c906 authored by Vaclav Brozek's avatar Vaclav Brozek Committed by Commit Bot

Fix PasswordManagerTest.ParsingOnSavingMetricRecorded

The test currently passes by accident: it fails to check that a metric
has a value.

It also has two issues: one is mixing null and non-null drivers, and
the other is calling old-parser-only ProvisionallySavePassword instead
of OnPasswordFormSubmitted, while at the same time using the new
parser.

This CL fixes the test:
* Activates the check, and
* Fixes the issues, so that the test passes.

Bug: 907794
Change-Id: Ia24518aa2bae3c0a25db7722c89eb59f70c61ef1
Reviewed-on: https://chromium-review.googlesource.com/c/1350898
Commit-Queue: Vaclav Brozek <vabr@chromium.org>
Reviewed-by: default avatarVadym Doroshenko <dvadym@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611051}
parent 1e43dc3b
......@@ -2893,20 +2893,20 @@ TEST_F(PasswordManagerTest, ParsingOnSavingMetricRecorded) {
PasswordForm form = MakeSimpleForm();
std::vector<PasswordForm> observed = {form};
manager()->OnPasswordFormsParsed(&driver_, observed);
manager()->OnPasswordFormsParsed(nullptr, observed);
// Provisionally save and simulate a successful landing page load to make
// manager() believe this password should be saved.
manager()->ProvisionallySavePassword(form, nullptr);
manager()->OnPasswordFormsRendered(&driver_, {}, true);
manager()->OnPasswordFormSubmitted(nullptr, form);
manager()->OnPasswordFormsRendered(nullptr, {}, true);
// Destroy |manager_| to send off UKM metrics.
manager_.reset();
ukm::TestUkmRecorder::EntryHasMetric(
EXPECT_TRUE(ukm::TestUkmRecorder::EntryHasMetric(
GetMetricEntry(test_ukm_recorder,
ukm::builders::PasswordForm::kEntryName),
ukm::builders::PasswordForm::kParsingOnSavingDifferenceName);
ukm::builders::PasswordForm::kParsingOnSavingDifferenceName));
}
TEST_F(PasswordManagerTest, NoSavePromptWhenPasswordManagerDisabled) {
......
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