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_data.h" | 5 #include "components/autofill/core/common/form_data.h" |
6 | 6 |
7 #include "base/pickle.h" | 7 #include "base/pickle.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 namespace autofill { | 11 namespace autofill { |
12 | 12 |
13 TEST(FormDataTest, SerializeAndDeserialize) { | 13 TEST(FormDataTest, SerializeAndDeserialize) { |
14 FormData data; | 14 FormData data; |
15 data.name = base::ASCIIToUTF16("name"); | 15 data.name = base::ASCIIToUTF16("name"); |
16 data.method = base::ASCIIToUTF16("POST"); | |
17 data.origin = GURL("origin"); | 16 data.origin = GURL("origin"); |
18 data.action = GURL("action"); | 17 data.action = GURL("action"); |
19 data.user_submitted = true; | 18 data.user_submitted = true; |
20 | 19 |
21 FormFieldData field_data; | 20 FormFieldData field_data; |
22 field_data.label = base::ASCIIToUTF16("label"); | 21 field_data.label = base::ASCIIToUTF16("label"); |
23 field_data.name = base::ASCIIToUTF16("name"); | 22 field_data.name = base::ASCIIToUTF16("name"); |
24 field_data.value = base::ASCIIToUTF16("value"); | 23 field_data.value = base::ASCIIToUTF16("value"); |
25 field_data.form_control_type = "password"; | 24 field_data.form_control_type = "password"; |
26 field_data.autocomplete_attribute = "off"; | 25 field_data.autocomplete_attribute = "off"; |
(...skipping 21 matching lines...) Expand all Loading... |
48 SerializeFormData(data, &pickle); | 47 SerializeFormData(data, &pickle); |
49 | 48 |
50 PickleIterator iter(pickle); | 49 PickleIterator iter(pickle); |
51 FormData actual; | 50 FormData actual; |
52 EXPECT_TRUE(DeserializeFormData(&iter, &actual)); | 51 EXPECT_TRUE(DeserializeFormData(&iter, &actual)); |
53 | 52 |
54 EXPECT_EQ(actual, data); | 53 EXPECT_EQ(actual, data); |
55 } | 54 } |
56 | 55 |
57 } // namespace autofill | 56 } // namespace autofill |
OLD | NEW |