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

Unified Diff: chrome/test/data/autofill/merge/tools/reserialize_profiles_from_query.py

Issue 6312174: Add a data-driven unit test to validate autofill profile merging during aggregation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename reserialization script Created 9 years, 10 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
Index: chrome/test/data/autofill/merge/tools/reserialize_profiles_from_query.py
diff --git a/chrome/test/data/autofill/merge/tools/reserialize_profiles_from_query.py b/chrome/test/data/autofill/merge/tools/reserialize_profiles_from_query.py
new file mode 100644
index 0000000000000000000000000000000000000000..9e1c63f41e438b9aaa8cb90085f8e2bad3fff99b
--- /dev/null
+++ b/chrome/test/data/autofill/merge/tools/reserialize_profiles_from_query.py
@@ -0,0 +1,38 @@
+# Copyright (c) 2011 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.
+
+import sys
+
+from autofill_merge_common import SerializeProfiles, ColumnNameToFieldType
+
+def main():
+ """Serializes the output of the query 'SELECT * from autofill_profiles;'.
+
+ """
+
+ COLUMNS = ['GUID', 'LABEL', 'FIRST_NAME', 'MIDDLE_NAME', 'LAST_NAME', 'EMAIL',
+ 'COMPANY_NAME', 'ADDRESS_LINE_1', 'ADDRESS_LINE_2', 'CITY',
+ 'STATE', 'ZIPCODE', 'COUNTRY', 'PHONE', 'FAX', 'DATE_MODIFIED']
+
+ if len(sys.argv) != 2:
+ print ("Usage: python reserialize_profiles_from_query.py "
+ "<path/to/serialized_profiles>")
+ return
+
+ types = [ColumnNameToFieldType(column_name) for column_name in COLUMNS]
+ profiles = []
+ with open(sys.argv[1], 'r') as serialized_profiles:
+ for line in serialized_profiles:
+ # trim the newline if present
+ if line[-1] == '\n':
+ line = line[:-1]
+
+ values = line.split("|")
+ profiles.append(zip(types, values))
+
+ print SerializeProfiles(profiles)
+
+
+if __name__ == '__main__':
+ main()
« no previous file with comments | « chrome/test/data/autofill/merge/tools/flatten.py ('k') | chrome/test/data/autofill/merge/tools/serialize_profiles.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698