| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/string_util.h" | 5 #include "base/string_util.h" |
| 6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 #include "components/autofill/browser/autofill_field.h" | 7 #include "components/autofill/browser/autofill_field.h" |
| 8 #include "components/autofill/browser/field_types.h" | 8 #include "components/autofill/browser/field_types.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 field.set_server_type(ADDRESS_BILLING_LINE1); | 26 field.set_server_type(ADDRESS_BILLING_LINE1); |
| 27 EXPECT_EQ(ADDRESS_BILLING_LINE1, field.type()); | 27 EXPECT_EQ(ADDRESS_BILLING_LINE1, field.type()); |
| 28 | 28 |
| 29 // Remove the server type to make sure the heuristic type is preserved. | 29 // Remove the server type to make sure the heuristic type is preserved. |
| 30 field.set_server_type(NO_SERVER_DATA); | 30 field.set_server_type(NO_SERVER_DATA); |
| 31 EXPECT_EQ(NAME_FIRST, field.type()); | 31 EXPECT_EQ(NAME_FIRST, field.type()); |
| 32 } | 32 } |
| 33 | 33 |
| 34 TEST(AutofillFieldTest, IsEmpty) { | 34 TEST(AutofillFieldTest, IsEmpty) { |
| 35 AutofillField field; | 35 AutofillField field; |
| 36 ASSERT_EQ(string16(), field.value); | 36 ASSERT_EQ(base::string16(), field.value); |
| 37 | 37 |
| 38 // Field value is empty. | 38 // Field value is empty. |
| 39 EXPECT_TRUE(field.IsEmpty()); | 39 EXPECT_TRUE(field.IsEmpty()); |
| 40 | 40 |
| 41 // Field value is non-empty. | 41 // Field value is non-empty. |
| 42 field.value = ASCIIToUTF16("Value"); | 42 field.value = ASCIIToUTF16("Value"); |
| 43 EXPECT_FALSE(field.IsEmpty()); | 43 EXPECT_FALSE(field.IsEmpty()); |
| 44 } | 44 } |
| 45 | 45 |
| 46 TEST(AutofillFieldTest, FieldSignature) { | 46 TEST(AutofillFieldTest, FieldSignature) { |
| 47 AutofillField field; | 47 AutofillField field; |
| 48 ASSERT_EQ(string16(), field.name); | 48 ASSERT_EQ(base::string16(), field.name); |
| 49 ASSERT_EQ(std::string(), field.form_control_type); | 49 ASSERT_EQ(std::string(), field.form_control_type); |
| 50 | 50 |
| 51 // Signature is empty. | 51 // Signature is empty. |
| 52 EXPECT_EQ("2085434232", field.FieldSignature()); | 52 EXPECT_EQ("2085434232", field.FieldSignature()); |
| 53 | 53 |
| 54 // Field name is set. | 54 // Field name is set. |
| 55 field.name = ASCIIToUTF16("Name"); | 55 field.name = ASCIIToUTF16("Name"); |
| 56 EXPECT_EQ("1606968241", field.FieldSignature()); | 56 EXPECT_EQ("1606968241", field.FieldSignature()); |
| 57 | 57 |
| 58 // Field form control type is set. | 58 // Field form control type is set. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 84 field.set_server_type(NAME_LAST); | 84 field.set_server_type(NAME_LAST); |
| 85 EXPECT_TRUE(field.IsFieldFillable()); | 85 EXPECT_TRUE(field.IsFieldFillable()); |
| 86 | 86 |
| 87 // Both types set. | 87 // Both types set. |
| 88 field.set_heuristic_type(NAME_FIRST); | 88 field.set_heuristic_type(NAME_FIRST); |
| 89 field.set_server_type(NAME_LAST); | 89 field.set_server_type(NAME_LAST); |
| 90 EXPECT_TRUE(field.IsFieldFillable()); | 90 EXPECT_TRUE(field.IsFieldFillable()); |
| 91 } | 91 } |
| 92 | 92 |
| 93 } // namespace | 93 } // namespace |
| OLD | NEW |