| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 // fillable field. | 123 // fillable field. |
| 124 field.label = ASCIIToUTF16("address1"); | 124 field.label = ASCIIToUTF16("address1"); |
| 125 field.name = ASCIIToUTF16("address1"); | 125 field.name = ASCIIToUTF16("address1"); |
| 126 field.form_control_type = "text"; | 126 field.form_control_type = "text"; |
| 127 field.should_autocomplete = false; | 127 field.should_autocomplete = false; |
| 128 form.fields.push_back(field); | 128 form.fields.push_back(field); |
| 129 | 129 |
| 130 form_structure.reset(new FormStructure(form)); | 130 form_structure.reset(new FormStructure(form)); |
| 131 form_structure->DetermineHeuristicTypes(); | 131 form_structure->DetermineHeuristicTypes(); |
| 132 EXPECT_EQ(4U, form_structure->autofill_count()); | 132 EXPECT_EQ(4U, form_structure->autofill_count()); |
| 133 | |
| 134 base::CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 135 switches::kRespectAutocompleteOffForAutofill); | |
| 136 | |
| 137 form_structure.reset(new FormStructure(form)); | |
| 138 form_structure->DetermineHeuristicTypes(); | |
| 139 EXPECT_EQ(3U, form_structure->autofill_count()); | |
| 140 } | 133 } |
| 141 | 134 |
| 142 TEST(FormStructureTest, SourceURL) { | 135 TEST(FormStructureTest, SourceURL) { |
| 143 FormData form; | 136 FormData form; |
| 144 form.origin = GURL("http://www.foo.com/"); | 137 form.origin = GURL("http://www.foo.com/"); |
| 145 FormStructure form_structure(form); | 138 FormStructure form_structure(form); |
| 146 | 139 |
| 147 EXPECT_EQ(form.origin, form_structure.source_url()); | 140 EXPECT_EQ(form.origin, form_structure.source_url()); |
| 148 } | 141 } |
| 149 | 142 |
| (...skipping 2315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2465 "</autofillqueryresponse>"; | 2458 "</autofillqueryresponse>"; |
| 2466 | 2459 |
| 2467 FormStructure::ParseQueryResponse(response, forms.get()); | 2460 FormStructure::ParseQueryResponse(response, forms.get()); |
| 2468 | 2461 |
| 2469 ASSERT_GE(forms[0]->field_count(), 2U); | 2462 ASSERT_GE(forms[0]->field_count(), 2U); |
| 2470 EXPECT_EQ(NO_SERVER_DATA, forms[0]->field(0)->server_type()); | 2463 EXPECT_EQ(NO_SERVER_DATA, forms[0]->field(0)->server_type()); |
| 2471 EXPECT_EQ(76, forms[0]->field(1)->server_type()); | 2464 EXPECT_EQ(76, forms[0]->field(1)->server_type()); |
| 2472 } | 2465 } |
| 2473 | 2466 |
| 2474 } // namespace autofill | 2467 } // namespace autofill |
| OLD | NEW |