Commit 5a49664f authored by Vaclav Brozek's avatar Vaclav Brozek Committed by Commit Bot

Reset PasswordManager in ReportMissingFormManager

The test PasswordManagerTest.ReportMissingFormManager executes a
number of test-cases, and for each test-case, two runs, one with the
old FormData parser, one with the new one.

Each test-case can leave the PasswordManager in a state not expected
by the next case, so it is good to reset the PasswordManager at the
beginning of each run.

This happens as part of setting the flags for the new parser
automatically, but does not happen when the old parser is used. Thus,
the tests failed if for each test-case the old parser was run first.

This CL fixes that by ensuring that the PasswordManager is reset
before each run.

Bug: 907794

Change-Id: Id3ec0acf34d1a9d7b3530edd3eec0d6351fa4e1d
Reviewed-on: https://chromium-review.googlesource.com/c/1350899
Commit-Queue: Vaclav Brozek <vabr@chromium.org>
Reviewed-by: default avatarVadym Doroshenko <dvadym@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611205}
parent 652135c1
......@@ -3149,13 +3149,19 @@ TEST_F(PasswordManagerTest, ReportMissingFormManager) {
EXPECT_CALL(client_, IsSavingAndFillingEnabledForCurrentPage())
.WillRepeatedly(Return(test_case.saving ==
MissingFormManagerTestCase::Saving::Enabled));
for (bool new_parsing_for_saving : {true, false}) {
for (bool new_parsing_for_saving : {false, true}) {
SCOPED_TRACE(testing::Message()
<< "test case = " << test_case.description
<< ", new_parsing_for_saving = " << new_parsing_for_saving);
base::test::ScopedFeatureList scoped_feature_list;
if (new_parsing_for_saving)
if (new_parsing_for_saving) {
// This also resets the password manager.
TurnOnNewParsingForSaving(&scoped_feature_list);
} else {
// Reset the password manager to discard state from the previous
// test_case.
manager_.reset(new PasswordManager(&client_));
}
manager()->OnPasswordFormsParsed(nullptr, test_case.parsed_forms);
......
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