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

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

Issue 605683002: Autofill browser_tests: set autofilled property after autofilled value is set. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update code as per review comments. Created 6 years, 2 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 | no next file » | 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 <vector> 5 #include <vector>
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 3181 matching lines...) Expand 10 before | Expand all | Expand 10 after
3192 form_cache.ExtractNewForms(*web_frame, &forms); 3192 form_cache.ExtractNewForms(*web_frame, &forms);
3193 ASSERT_EQ(1U, forms.size()); 3193 ASSERT_EQ(1U, forms.size());
3194 3194
3195 // Set the auto-filled attribute. 3195 // Set the auto-filled attribute.
3196 WebInputElement firstname = 3196 WebInputElement firstname =
3197 web_frame->document().getElementById("firstname").to<WebInputElement>(); 3197 web_frame->document().getElementById("firstname").to<WebInputElement>();
3198 firstname.setAutofilled(true); 3198 firstname.setAutofilled(true);
3199 WebInputElement lastname = 3199 WebInputElement lastname =
3200 web_frame->document().getElementById("lastname").to<WebInputElement>(); 3200 web_frame->document().getElementById("lastname").to<WebInputElement>();
3201 lastname.setAutofilled(true); 3201 lastname.setAutofilled(true);
3202 WebInputElement state = 3202
3203 web_frame->document().getElementById("state").to<WebInputElement>(); 3203 // Set the value and auto-filled attribute of the state element.
3204 WebSelectElement state =
3205 web_frame->document().getElementById("state").to<WebSelectElement>();
3206 state.setValue(WebString::fromUTF8("AK"));
3204 state.setAutofilled(true); 3207 state.setAutofilled(true);
3205 3208
3206 // Set the value of the select-one.
3207 WebSelectElement select_element =
3208 web_frame->document().getElementById("state").to<WebSelectElement>();
3209 select_element.setValue(WebString::fromUTF8("AK"));
3210
3211 // Clear the form. 3209 // Clear the form.
3212 EXPECT_TRUE(form_cache.ClearFormWithElement(firstname)); 3210 EXPECT_TRUE(form_cache.ClearFormWithElement(firstname));
3213 3211
3214 // Verify that the auto-filled attribute has been turned off. 3212 // Verify that the auto-filled attribute has been turned off.
3215 EXPECT_FALSE(firstname.isAutofilled()); 3213 EXPECT_FALSE(firstname.isAutofilled());
3216 3214
3217 // Verify the form is cleared. 3215 // Verify the form is cleared.
3218 FormData form2; 3216 FormData form2;
3219 FormFieldData field2; 3217 FormFieldData field2;
3220 EXPECT_TRUE(FindFormAndFieldForFormControlElement(firstname, 3218 EXPECT_TRUE(FindFormAndFieldForFormControlElement(firstname,
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
3681 expected.max_length = WebInputElement::defaultMaxLength(); 3679 expected.max_length = WebInputElement::defaultMaxLength();
3682 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); 3680 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]);
3683 3681
3684 expected.name = ASCIIToUTF16("country"); 3682 expected.name = ASCIIToUTF16("country");
3685 expected.value = ASCIIToUTF16("AL"); 3683 expected.value = ASCIIToUTF16("AL");
3686 expected.form_control_type = "select-one"; 3684 expected.form_control_type = "select-one";
3687 expected.max_length = 0; 3685 expected.max_length = 0;
3688 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); 3686 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]);
3689 } 3687 }
3690 } // namespace autofill 3688 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698