| Index: components/autofill/core/browser/autofill_manager_unittest.cc
|
| diff --git a/components/autofill/core/browser/autofill_manager_unittest.cc b/components/autofill/core/browser/autofill_manager_unittest.cc
|
| index 033328d39cdda9e851edd27a8e99a51d2487bb81..3fe7cebe1e9381ab8d10640544de12f72e96e58b 100644
|
| --- a/components/autofill/core/browser/autofill_manager_unittest.cc
|
| +++ b/components/autofill/core/browser/autofill_manager_unittest.cc
|
| @@ -17,6 +17,7 @@
|
| #include "base/strings/string_util.h"
|
| #include "base/strings/stringprintf.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| +#include "base/test/histogram_tester.h"
|
| #include "base/thread_task_runner_handle.h"
|
| #include "base/time/time.h"
|
| #include "components/autofill/core/browser/autocomplete_history_manager.h"
|
| @@ -808,6 +809,26 @@ class TestFormStructure : public FormStructure {
|
| DISALLOW_COPY_AND_ASSIGN(TestFormStructure);
|
| };
|
|
|
| +// Test that calling OnFormsSeen with an empty set of forms (such as when
|
| +// reloading a page or when the renderer processes a set of forms but detects
|
| +// no changes) does not load the forms again.
|
| +TEST_F(AutofillManagerTest, OnFormsSeen_Empty) {
|
| + // Set up our form data.
|
| + FormData form;
|
| + test::CreateTestAddressFormData(&form);
|
| + std::vector<FormData> forms(1, form);
|
| +
|
| + base::HistogramTester histogram_tester;
|
| + FormsSeen(forms);
|
| + histogram_tester.ExpectUniqueSample(
|
| + "Autofill.UserHappiness", 0 /* FORMS_LOADED */, 1);
|
| +
|
| + // No more forms, metric is not logged.
|
| + FormsSeen(std::vector<FormData>{});
|
| + histogram_tester.ExpectUniqueSample(
|
| + "Autofill.UserHappiness", 0 /* FORMS_LOADED */, 1);
|
| +}
|
| +
|
| // Test that we return all address profile suggestions when all form fields are
|
| // empty.
|
| TEST_F(AutofillManagerTest, GetProfileSuggestionsEmptyValue) {
|
|
|