Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Unified Diff: components/autofill/core/common/form_field_data_unittest.cc

Issue 23033010: [password autofill] Add serialization for FormData and FormFieldData (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Windows Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/autofill/core/common/form_field_data.cc ('k') | components/components_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/common/form_field_data_unittest.cc
diff --git a/components/autofill/core/common/form_field_data_unittest.cc b/components/autofill/core/common/form_field_data_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7f4ef09f2d2e6901e285848f78e9efa45ac1e21f
--- /dev/null
+++ b/components/autofill/core/common/form_field_data_unittest.cc
@@ -0,0 +1,43 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/autofill/core/common/form_field_data.h"
+
+#include "base/i18n/rtl.h"
+#include "base/pickle.h"
+#include "base/strings/utf_string_conversions.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace autofill {
+
+TEST(FormFieldDataTest, SerializeAndDeserialize) {
+ FormFieldData data;
+ data.label = ASCIIToUTF16("label");
+ data.name = ASCIIToUTF16("name");
+ data.value = ASCIIToUTF16("value");
+ data.form_control_type = "password";
+ data.autocomplete_attribute = "off";
+ data.max_length = 200;
+ data.is_autofilled = true;
+ data.is_checked = true;
+ data.is_checkable = true;
+ data.is_focusable = true;
+ data.should_autocomplete = false;
+ data.text_direction = base::i18n::RIGHT_TO_LEFT;
+ data.option_values.push_back(ASCIIToUTF16("First"));
+ data.option_values.push_back(ASCIIToUTF16("Second"));
+ data.option_contents.push_back(ASCIIToUTF16("First"));
+ data.option_contents.push_back(ASCIIToUTF16("Second"));
+
+ Pickle pickle;
+ SerializeFormFieldData(data, &pickle);
+
+ PickleIterator iter(pickle);
+ FormFieldData actual;
+ EXPECT_TRUE(DeserializeFormFieldData(&iter, &actual));
+
+ EXPECT_EQ(actual, data);
+}
+
+} // namespace autofill
« no previous file with comments | « components/autofill/core/common/form_field_data.cc ('k') | components/components_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698