| 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; | |
| 97 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("username"), | 96 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("username"), |
| 98 ASCIIToUTF16("username"), | 97 ASCIIToUTF16("username"), |
| 99 string16(), | 98 string16(), |
| 100 ASCIIToUTF16("text"), | 99 ASCIIToUTF16("text"), |
| 101 0)); | 100 0)); |
| 102 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("password"), | 101 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("password"), |
| 103 ASCIIToUTF16("password"), | 102 ASCIIToUTF16("password"), |
| 104 string16(), | 103 string16(), |
| 105 ASCIIToUTF16("password"), | 104 ASCIIToUTF16("password"), |
| 106 0)); | 105 0)); |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 EXPECT_EQ(PHONE_HOME_NUMBER, | 910 EXPECT_EQ(PHONE_HOME_NUMBER, |
| 912 form_structure->field(1)->heuristic_type()); | 911 form_structure->field(1)->heuristic_type()); |
| 913 // Phone number suffix. | 912 // Phone number suffix. |
| 914 EXPECT_EQ(PHONE_HOME_NUMBER, | 913 EXPECT_EQ(PHONE_HOME_NUMBER, |
| 915 form_structure->field(2)->heuristic_type()); | 914 form_structure->field(2)->heuristic_type()); |
| 916 // Unknown. | 915 // Unknown. |
| 917 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(3)->heuristic_type()); | 916 EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(3)->heuristic_type()); |
| 918 } | 917 } |
| 919 | 918 |
| 920 } // namespace | 919 } // namespace |
| OLD | NEW |