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

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

Issue 23033016: Remove autocheckout code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Even more deletes, and Ilya review. Created 7 years, 3 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 <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 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 // Fields with "visibility: hidden" should also be autofilled. 1013 // Fields with "visibility: hidden" should also be autofilled.
1014 {"invisible", "", "", true, "filled invisible", "filled invisible"}, 1014 {"invisible", "", "", true, "filled invisible", "filled invisible"},
1015 // Fields with "display:none" should also be autofilled. 1015 // Fields with "display:none" should also be autofilled.
1016 {"displaynone", "", "", true, "filled displaynone", "filled displaynone"}, 1016 {"displaynone", "", "", true, "filled displaynone", "filled displaynone"},
1017 }; 1017 };
1018 TestFormFillFunctions(kFormHtml, field_cases, arraysize(field_cases), 1018 TestFormFillFunctions(kFormHtml, field_cases, arraysize(field_cases),
1019 &FillFormIncludingNonFocusableElementsWrapper, 1019 &FillFormIncludingNonFocusableElementsWrapper,
1020 &WebInputElement::value); 1020 &WebInputElement::value);
1021 } 1021 }
1022 1022
1023 TEST_F(FormAutofillTest, FillFormForAllElements) {
1024 static const AutofillFieldCase field_cases[] = {
1025 // fields: name, initial_value, autocomplete_attribute,
1026 // should_be_autofilled, autofill_value, expected_value
1027
1028 // All fields except hidden fields (type="hidden") should be Autofilled.
1029 {"firstname", "", "", true, "filled firstname", "filled firstname"},
1030 {"lastname", "", "", true, "filled lastname", "filled lastname"},
1031 // hidden fields should not be extracted to form_data.
1032 {"notempty", "Hi", "", true, "filled notempty", "filled notempty"},
1033 {"noautocomplete", "", "off", true, "filled noautocomplete",
1034 "filled noautocomplete"},
1035 {"notenabled", "", "", true, "filled notenabled", "filled notenabled"},
1036 {"readonly", "", "", true, "filled readonly", "filled readonly"},
1037 {"invisible", "", "", true, "filled invisible", "filled invisible"},
1038 {"displaynone", "", "", true, "filled displaynone", "filled displaynone"},
1039 };
1040 // Enable Autocheckout because |FillFormForAllElements| is only used by
1041 // Autocheckout.
1042 base::FieldTrialList field_trial_list(
1043 new metrics::SHA1EntropyProvider("foo"));
1044 base::FieldTrialList::CreateFieldTrial("Autocheckout", "Yes");
1045 TestFormFillFunctions(kFormHtml, field_cases, arraysize(field_cases),
1046 &FillFormForAllFieldsWrapper, &WebInputElement::value);
1047 }
1048
1049 TEST_F(FormAutofillTest, PreviewForm) { 1023 TEST_F(FormAutofillTest, PreviewForm) {
1050 static const char* html = 1024 static const char* html =
1051 "<FORM name=\"TestForm\" action=\"http://buh.com\" method=\"post\">" 1025 "<FORM name=\"TestForm\" action=\"http://buh.com\" method=\"post\">"
1052 " <INPUT type=\"text\" id=\"firstname\"/>" 1026 " <INPUT type=\"text\" id=\"firstname\"/>"
1053 " <INPUT type=\"text\" id=\"lastname\"/>" 1027 " <INPUT type=\"text\" id=\"lastname\"/>"
1054 " <INPUT type=\"text\" id=\"notempty\" value=\"Hi\"/>" 1028 " <INPUT type=\"text\" id=\"notempty\" value=\"Hi\"/>"
1055 " <INPUT type=\"text\" autocomplete=\"off\" id=\"noautocomplete\"/>" 1029 " <INPUT type=\"text\" autocomplete=\"off\" id=\"noautocomplete\"/>"
1056 " <INPUT type=\"text\" disabled=\"disabled\" id=\"notenabled\"/>" 1030 " <INPUT type=\"text\" disabled=\"disabled\" id=\"notenabled\"/>"
1057 " <INPUT type=\"submit\" name=\"reply-send\" value=\"Send\"/>" 1031 " <INPUT type=\"submit\" name=\"reply-send\" value=\"Send\"/>"
1058 "</FORM>"; 1032 "</FORM>";
(...skipping 1973 matching lines...) Expand 10 before | Expand all | Expand 10 after
3032 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); 3006 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]);
3033 3007
3034 expected.name = ASCIIToUTF16("country"); 3008 expected.name = ASCIIToUTF16("country");
3035 expected.value = ASCIIToUTF16("AL"); 3009 expected.value = ASCIIToUTF16("AL");
3036 expected.form_control_type = "select-one"; 3010 expected.form_control_type = "select-one";
3037 expected.max_length = 0; 3011 expected.max_length = 0;
3038 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); 3012 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]);
3039 } 3013 }
3040 3014
3041 } // namespace autofill 3015 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698