OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/scoped_ptr.h" | 5 #include "base/scoped_ptr.h" |
6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/autofill/form_structure.h" | 8 #include "chrome/browser/autofill/form_structure.h" |
9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 0)); | 86 0)); |
87 FormStructure form_structure(form); | 87 FormStructure form_structure(form); |
88 | 88 |
89 // Only text and select fields that are heuristically matched are counted. | 89 // Only text and select fields that are heuristically matched are counted. |
90 EXPECT_EQ(1U, form_structure.autofill_count()); | 90 EXPECT_EQ(1U, form_structure.autofill_count()); |
91 } | 91 } |
92 | 92 |
93 TEST(FormStructureTest, ConvertToFormData) { | 93 TEST(FormStructureTest, ConvertToFormData) { |
94 FormData form; | 94 FormData form; |
95 form.method = ASCIIToUTF16("post"); | 95 form.method = ASCIIToUTF16("post"); |
| 96 form.user_submitted = true; |
96 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("username"), | 97 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("username"), |
97 ASCIIToUTF16("username"), | 98 ASCIIToUTF16("username"), |
98 string16(), | 99 string16(), |
99 ASCIIToUTF16("text"), | 100 ASCIIToUTF16("text"), |
100 0)); | 101 0)); |
101 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("password"), | 102 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("password"), |
102 ASCIIToUTF16("password"), | 103 ASCIIToUTF16("password"), |
103 string16(), | 104 string16(), |
104 ASCIIToUTF16("password"), | 105 ASCIIToUTF16("password"), |
105 0)); | 106 0)); |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 EXPECT_EQ(PHONE_HOME_NUMBER, | 911 EXPECT_EQ(PHONE_HOME_NUMBER, |
911 form_structure->field(1)->heuristic_type()); | 912 form_structure->field(1)->heuristic_type()); |
912 // Phone number suffix. | 913 // Phone number suffix. |
913 EXPECT_EQ(PHONE_HOME_NUMBER, | 914 EXPECT_EQ(PHONE_HOME_NUMBER, |
914 form_structure->field(2)->heuristic_type()); | 915 form_structure->field(2)->heuristic_type()); |
915 // Unknown. | 916 // Unknown. |
916 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(3)->heuristic_type()); | 917 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(3)->heuristic_type()); |
917 } | 918 } |
918 | 919 |
919 } // namespace | 920 } // namespace |
OLD | NEW |