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

Side by Side Diff: chrome/renderer/autofill/form_autofill_browsertest.cc

Issue 1670763006: Autofill server-side heuristics for 2 fields password form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/autofill/content/renderer/form_cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 4459 matching lines...) Expand 10 before | Expand all | Expand 10 after
4470 // be extracted. The is_formless_checkout attribute should 4470 // be extracted. The is_formless_checkout attribute should
4471 // then be true. 4471 // then be true.
4472 {"<INPUT type='text' id='firstname' autocomplete='given-name'/>" 4472 {"<INPUT type='text' id='firstname' autocomplete='given-name'/>"
4473 "<INPUT type='submit' value='Send'/>", 4473 "<INPUT type='submit' value='Send'/>",
4474 true, false, false}, 4474 true, false, false},
4475 // An input field without an autocomplete attribute outside of a form 4475 // An input field without an autocomplete attribute outside of a form
4476 // should not be extracted. 4476 // should not be extracted.
4477 {"<INPUT type='text' id='firstname'/>" 4477 {"<INPUT type='text' id='firstname'/>"
4478 "<INPUT type='submit' value='Send'/>", 4478 "<INPUT type='submit' value='Send'/>",
4479 false, false, false}, 4479 false, false, false},
4480 // A form with one field which is password should not be extracted.
4481 {"<FORM name='TestForm' action='http://buh.com' method='post'>"
4482 " <INPUT type='password' id='pw'/>"
4483 "</FORM>",
4484 false, true, false},
4485 // A form with two fields which are passwords should be extracted.
4486 {"<FORM name='TestForm' action='http://buh.com' method='post'>"
4487 " <INPUT type='password' id='pw'/>"
4488 " <INPUT type='password' id='new_pw'/>"
4489 "</FORM>",
4490 true, true, false},
4480 }; 4491 };
4481 4492
4482 for (auto test_case : test_cases) { 4493 for (auto test_case : test_cases) {
4483 LoadHTML(test_case.html); 4494 LoadHTML(test_case.html);
4484 4495
4485 WebFrame* web_frame = GetMainFrame(); 4496 WebFrame* web_frame = GetMainFrame();
4486 ASSERT_NE(nullptr, web_frame); 4497 ASSERT_NE(nullptr, web_frame);
4487 4498
4488 FormCache form_cache(*web_frame); 4499 FormCache form_cache(*web_frame);
4489 std::vector<FormData> forms = form_cache.ExtractNewForms(); 4500 std::vector<FormData> forms = form_cache.ExtractNewForms();
4490 EXPECT_EQ(test_case.has_extracted_form, forms.size() == 1); 4501 EXPECT_EQ(test_case.has_extracted_form, forms.size() == 1);
4491 4502
4492 if (test_case.has_extracted_form) { 4503 if (test_case.has_extracted_form) {
4493 EXPECT_EQ(test_case.is_form_tag, forms[0].is_form_tag); 4504 EXPECT_EQ(test_case.is_form_tag, forms[0].is_form_tag);
4494 EXPECT_EQ(test_case.is_formless_checkout, forms[0].is_formless_checkout); 4505 EXPECT_EQ(test_case.is_formless_checkout, forms[0].is_formless_checkout);
4495 } 4506 }
4496 } 4507 }
4497 } 4508 }
4498 4509
4499 } // namespace form_util 4510 } // namespace form_util
4500 } // namespace autofill 4511 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | components/autofill/content/renderer/form_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698