Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6955)

Unified Diff: chrome/renderer/autofill/form_autofill_browsertest.cc

Issue 13831013: Don't include forms without fields in has_more_forms calculation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add some test coverage Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/autofill/renderer/form_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/autofill/form_autofill_browsertest.cc
diff --git a/chrome/renderer/autofill/form_autofill_browsertest.cc b/chrome/renderer/autofill/form_autofill_browsertest.cc
index bfb71ac1109c932bf58c09f7d43c8801d1d206ae..d63e2fb88fcbeaa8d21670bc4e110ecdb358085d 100644
--- a/chrome/renderer/autofill/form_autofill_browsertest.cc
+++ b/chrome/renderer/autofill/form_autofill_browsertest.cc
@@ -612,6 +612,44 @@ TEST_F(FormAutofillTest, ExtractFormsTooFewFields) {
EXPECT_EQ(0U, forms.size());
}
+// We should not report additional forms for empty forms.
+TEST_F(FormAutofillTest, ExtractFormsSkippedForms) {
+ LoadHTML("<FORM name=\"TestForm\" action=\"http://cnn.com\" method=\"post\">"
+ " <INPUT type=\"text\" id=\"firstname\" value=\"John\"/>"
+ " <INPUT type=\"text\" id=\"lastname\" value=\"Smith\"/>"
+ "</FORM>");
+
+ WebFrame* web_frame = GetMainFrame();
+ ASSERT_NE(static_cast<WebFrame*>(NULL), web_frame);
+
+ FormCache form_cache;
+ std::vector<FormData> forms;
+ bool has_skipped_forms = form_cache.ExtractFormsAndFormElements(*web_frame,
+ 3,
+ &forms,
+ NULL);
+ EXPECT_EQ(0U, forms.size());
+ EXPECT_TRUE(has_skipped_forms);
+}
+
+// We should not report additional forms for empty forms.
+TEST_F(FormAutofillTest, ExtractFormsNoFields) {
+ LoadHTML("<FORM name=\"TestForm\" action=\"http://cnn.com\" method=\"post\">"
+ "</FORM>");
+
+ WebFrame* web_frame = GetMainFrame();
+ ASSERT_NE(static_cast<WebFrame*>(NULL), web_frame);
+
+ FormCache form_cache;
+ std::vector<FormData> forms;
+ bool has_skipped_forms = form_cache.ExtractFormsAndFormElements(*web_frame,
+ 3,
+ &forms,
+ NULL);
+ EXPECT_EQ(0U, forms.size());
+ EXPECT_FALSE(has_skipped_forms);
+}
+
// We should not extract a form if it has too few fillable fields.
// Make sure radio and checkbox fields don't count.
TEST_F(FormAutofillTest, ExtractFormsTooFewFieldsSkipsCheckable) {
« no previous file with comments | « no previous file | components/autofill/renderer/form_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698