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/common/form_field_data.h" | 5 #include "components/autofill/core/common/form_field_data.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/pickle.h" | 8 #include "base/pickle.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 data->option_contents.push_back(base::ASCIIToUTF16("First")); | 31 data->option_contents.push_back(base::ASCIIToUTF16("First")); |
32 data->option_contents.push_back(base::ASCIIToUTF16("Second")); | 32 data->option_contents.push_back(base::ASCIIToUTF16("Second")); |
33 } | 33 } |
34 | 34 |
35 void WriteCommonSection1(const FormFieldData& data, base::Pickle* pickle) { | 35 void WriteCommonSection1(const FormFieldData& data, base::Pickle* pickle) { |
36 pickle->WriteString16(data.label); | 36 pickle->WriteString16(data.label); |
37 pickle->WriteString16(data.name); | 37 pickle->WriteString16(data.name); |
38 pickle->WriteString16(data.value); | 38 pickle->WriteString16(data.value); |
39 pickle->WriteString(data.form_control_type); | 39 pickle->WriteString(data.form_control_type); |
40 pickle->WriteString(data.autocomplete_attribute); | 40 pickle->WriteString(data.autocomplete_attribute); |
41 pickle->WriteSizeT(data.max_length); | 41 pickle->WriteInt(data.max_length); |
42 pickle->WriteBool(data.is_autofilled); | 42 pickle->WriteBool(data.is_autofilled); |
43 pickle->WriteBool(data.is_checked); | 43 pickle->WriteBool(data.is_checked); |
44 pickle->WriteBool(data.is_checkable); | 44 pickle->WriteBool(data.is_checkable); |
45 pickle->WriteBool(data.is_focusable); | 45 pickle->WriteBool(data.is_focusable); |
46 pickle->WriteBool(data.should_autocomplete); | 46 pickle->WriteBool(data.should_autocomplete); |
47 } | 47 } |
48 | 48 |
49 void WriteCommonSection2(const FormFieldData& data, base::Pickle* pickle) { | 49 void WriteCommonSection2(const FormFieldData& data, base::Pickle* pickle) { |
50 pickle->WriteInt(data.text_direction); | 50 pickle->WriteInt(data.text_direction); |
51 pickle->WriteInt(static_cast<int>(data.option_values.size())); | 51 pickle->WriteInt(static_cast<int>(data.option_values.size())); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 base::PickleIterator iter(pickle); | 100 base::PickleIterator iter(pickle); |
101 FormFieldData actual; | 101 FormFieldData actual; |
102 EXPECT_FALSE(DeserializeFormFieldData(&iter, &actual)); | 102 EXPECT_FALSE(DeserializeFormFieldData(&iter, &actual)); |
103 | 103 |
104 FormFieldData empty; | 104 FormFieldData empty; |
105 EXPECT_TRUE(actual.SameFieldAs(empty)); | 105 EXPECT_TRUE(actual.SameFieldAs(empty)); |
106 } | 106 } |
107 | 107 |
108 } // namespace autofill | 108 } // namespace autofill |
OLD | NEW |