OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/autofill/core/browser/form_structure.h" | 5 #include "components/autofill/core/browser/form_structure.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 field.label = ASCIIToUTF16("address1"); | 128 field.label = ASCIIToUTF16("address1"); |
129 field.name = ASCIIToUTF16("address1"); | 129 field.name = ASCIIToUTF16("address1"); |
130 field.form_control_type = "text"; | 130 field.form_control_type = "text"; |
131 field.should_autocomplete = false; | 131 field.should_autocomplete = false; |
132 form.fields.push_back(field); | 132 form.fields.push_back(field); |
133 | 133 |
134 form_structure.reset(new FormStructure(form)); | 134 form_structure.reset(new FormStructure(form)); |
135 form_structure->DetermineHeuristicTypes(TestAutofillMetrics()); | 135 form_structure->DetermineHeuristicTypes(TestAutofillMetrics()); |
136 EXPECT_EQ(2U, form_structure->autofill_count()); | 136 EXPECT_EQ(2U, form_structure->autofill_count()); |
137 | 137 |
138 CommandLine::ForCurrentProcess()->AppendSwitch( | 138 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
139 switches::kRespectAutocompleteOffForAutofill); | 139 switches::kRespectAutocompleteOffForAutofill); |
140 | 140 |
141 form_structure.reset(new FormStructure(form)); | 141 form_structure.reset(new FormStructure(form)); |
142 form_structure->DetermineHeuristicTypes(TestAutofillMetrics()); | 142 form_structure->DetermineHeuristicTypes(TestAutofillMetrics()); |
143 EXPECT_EQ(1U, form_structure->autofill_count()); | 143 EXPECT_EQ(1U, form_structure->autofill_count()); |
144 } | 144 } |
145 | 145 |
146 TEST(FormStructureTest, SourceURL) { | 146 TEST(FormStructureTest, SourceURL) { |
147 FormData form; | 147 FormData form; |
148 form.origin = GURL("http://www.foo.com/"); | 148 form.origin = GURL("http://www.foo.com/"); |
(...skipping 2322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2471 | 2471 |
2472 FormStructure::ParseQueryResponse(response, | 2472 FormStructure::ParseQueryResponse(response, |
2473 forms.get(), | 2473 forms.get(), |
2474 TestAutofillMetrics()); | 2474 TestAutofillMetrics()); |
2475 | 2475 |
2476 EXPECT_EQ(NO_SERVER_DATA, forms[0]->field(0)->server_type()); | 2476 EXPECT_EQ(NO_SERVER_DATA, forms[0]->field(0)->server_type()); |
2477 EXPECT_EQ(76, forms[0]->field(1)->server_type()); | 2477 EXPECT_EQ(76, forms[0]->field(1)->server_type()); |
2478 } | 2478 } |
2479 | 2479 |
2480 } // namespace autofill | 2480 } // namespace autofill |
OLD | NEW |