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

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

Issue 12596003: [Autofill] Update tests to support native UI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
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 "chrome/renderer/autofill/form_autofill_util.h" 5 #include "chrome/renderer/autofill/form_autofill_util.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 void ForEachMatchingFormField(const WebFormElement& form_element, 460 void ForEachMatchingFormField(const WebFormElement& form_element,
461 const WebElement& initiating_element, 461 const WebElement& initiating_element,
462 const FormData& data, 462 const FormData& data,
463 bool only_focusable_elements, 463 bool only_focusable_elements,
464 Callback callback) { 464 Callback callback) {
465 std::vector<WebFormControlElement> control_elements; 465 std::vector<WebFormControlElement> control_elements;
466 ExtractAutofillableElements(form_element, autofill::REQUIRE_AUTOCOMPLETE, 466 ExtractAutofillableElements(form_element, autofill::REQUIRE_AUTOCOMPLETE,
467 &control_elements); 467 &control_elements);
468 468
469 if (control_elements.size() != data.fields.size()) { 469 if (control_elements.size() != data.fields.size()) {
470 // This case should be reachable only for pathological websites, which add 470 // This case should be reachable only for pathological websites and tests,
471 // or remove form fields while the user is interacting with the Autofill 471 // which add or remove form fields while the user is interacting with the
472 // popup. I (isherman) am not aware of any such websites, and so am 472 // Autofill popup.
473 // optimistically including a NOTREACHED(). If you ever trip this check,
474 // please file a bug against me.
475 NOTREACHED();
476 return; 473 return;
477 } 474 }
478 475
479 // It's possible that the site has injected fields into the form after the 476 // It's possible that the site has injected fields into the form after the
480 // page has loaded, so we can't assert that the size of the cached control 477 // page has loaded, so we can't assert that the size of the cached control
481 // elements is equal to the size of the fields in |form|. Fortunately, the 478 // elements is equal to the size of the fields in |form|. Fortunately, the
482 // one case in the wild where this happens, paypal.com signup form, the fields 479 // one case in the wild where this happens, paypal.com signup form, the fields
483 // are appended to the end of the form and are not visible. 480 // are appended to the end of the form and are not visible.
484 for (size_t i = 0; i < control_elements.size(); ++i) { 481 for (size_t i = 0; i < control_elements.size(); ++i) {
485 WebFormControlElement* element = &control_elements[i]; 482 WebFormControlElement* element = &control_elements[i];
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 continue; 1026 continue;
1030 1027
1031 if (input_element->isAutofilled()) 1028 if (input_element->isAutofilled())
1032 return true; 1029 return true;
1033 } 1030 }
1034 1031
1035 return false; 1032 return false;
1036 } 1033 }
1037 1034
1038 } // namespace autofill 1035 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698