| 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 "components/autofill/core/common/form_field_data.h" | 9 #include "components/autofill/core/common/form_field_data.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 FillInDummyFormData(&data); | 140 FillInDummyFormData(&data); |
| 141 | 141 |
| 142 Pickle pickle; | 142 Pickle pickle; |
| 143 SerializeIncorrectFormat(data, &pickle); | 143 SerializeIncorrectFormat(data, &pickle); |
| 144 | 144 |
| 145 PickleIterator iter(pickle); | 145 PickleIterator iter(pickle); |
| 146 FormData actual; | 146 FormData actual; |
| 147 EXPECT_FALSE(DeserializeFormData(&iter, &actual)); | 147 EXPECT_FALSE(DeserializeFormData(&iter, &actual)); |
| 148 } | 148 } |
| 149 | 149 |
| 150 TEST(FormDataTest, SerializeAndDeserializeInStrings) { |
| 151 FormData data; |
| 152 FillInDummyFormData(&data); |
| 153 data.is_form_tag = false; |
| 154 |
| 155 std::string serialized_data; |
| 156 SerializeFormDataToBase64String(data, &serialized_data); |
| 157 |
| 158 FormData actual; |
| 159 EXPECT_TRUE(DeserializeFormDataFromBase64String(serialized_data, &actual)); |
| 160 |
| 161 EXPECT_TRUE(actual.SameFormAs(data)); |
| 162 } |
| 163 |
| 150 } // namespace autofill | 164 } // namespace autofill |
| OLD | NEW |