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 #ifndef COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // Serialize and deserialize FormFieldData. These are used when FormData objects | 96 // Serialize and deserialize FormFieldData. These are used when FormData objects |
97 // are serialized and deserialized. | 97 // are serialized and deserialized. |
98 void SerializeFormFieldData(const FormFieldData& form_field_data, | 98 void SerializeFormFieldData(const FormFieldData& form_field_data, |
99 base::Pickle* serialized); | 99 base::Pickle* serialized); |
100 bool DeserializeFormFieldData(base::PickleIterator* pickle_iterator, | 100 bool DeserializeFormFieldData(base::PickleIterator* pickle_iterator, |
101 FormFieldData* form_field_data); | 101 FormFieldData* form_field_data); |
102 | 102 |
103 // So we can compare FormFieldDatas with EXPECT_EQ(). | 103 // So we can compare FormFieldDatas with EXPECT_EQ(). |
104 std::ostream& operator<<(std::ostream& os, const FormFieldData& field); | 104 std::ostream& operator<<(std::ostream& os, const FormFieldData& field); |
105 | 105 |
106 bool IsCheckable(const FormFieldData::CheckStatus& check_status); | |
107 bool IsChecked(const FormFieldData::CheckStatus& check_status); | |
108 void SetCheckStatus(FormFieldData* form_field_data, | |
109 bool isCheckable, | |
110 bool isChecked); | |
111 | |
112 // Prefer to use this macro in place of |EXPECT_EQ()| for comparing | 106 // Prefer to use this macro in place of |EXPECT_EQ()| for comparing |
113 // |FormFieldData|s in test code. | 107 // |FormFieldData|s in test code. |
114 #define EXPECT_FORM_FIELD_DATA_EQUALS(expected, actual) \ | 108 #define EXPECT_FORM_FIELD_DATA_EQUALS(expected, actual) \ |
115 do { \ | 109 do { \ |
116 EXPECT_EQ(expected.label, actual.label); \ | 110 EXPECT_EQ(expected.label, actual.label); \ |
117 EXPECT_EQ(expected.name, actual.name); \ | 111 EXPECT_EQ(expected.name, actual.name); \ |
118 EXPECT_EQ(expected.value, actual.value); \ | 112 EXPECT_EQ(expected.value, actual.value); \ |
119 EXPECT_EQ(expected.form_control_type, actual.form_control_type); \ | 113 EXPECT_EQ(expected.form_control_type, actual.form_control_type); \ |
120 EXPECT_EQ(expected.autocomplete_attribute, actual.autocomplete_attribute); \ | 114 EXPECT_EQ(expected.autocomplete_attribute, actual.autocomplete_attribute); \ |
121 EXPECT_EQ(expected.placeholder, actual.placeholder); \ | 115 EXPECT_EQ(expected.placeholder, actual.placeholder); \ |
122 EXPECT_EQ(expected.max_length, actual.max_length); \ | 116 EXPECT_EQ(expected.max_length, actual.max_length); \ |
123 EXPECT_EQ(expected.css_classes, actual.css_classes); \ | 117 EXPECT_EQ(expected.css_classes, actual.css_classes); \ |
124 EXPECT_EQ(expected.is_autofilled, actual.is_autofilled); \ | 118 EXPECT_EQ(expected.is_autofilled, actual.is_autofilled); \ |
125 EXPECT_EQ(expected.check_status, actual.check_status); \ | 119 EXPECT_EQ(expected.check_status, actual.check_status); \ |
126 EXPECT_EQ(expected.properties_mask, actual.properties_mask); \ | 120 EXPECT_EQ(expected.properties_mask, actual.properties_mask); \ |
127 } while (0) | 121 } while (0) |
128 | 122 |
129 } // namespace autofill | 123 } // namespace autofill |
130 | 124 |
131 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_ | 125 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_ |
OLD | NEW |