diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-19 23:51:04 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-19 23:51:04 +0000 |
commit | 0faac1d9b905b77b439e563b5b144267f9c77839 (patch) | |
tree | 386ece3cf4eda990c6556cc73ad3c659c9f27352 /components/test | |
parent | 4220210df8cacf45b93d913059aed3704bb27287 (diff) | |
download | chromium_src-0faac1d9b905b77b439e563b5b144267f9c77839.zip chromium_src-0faac1d9b905b77b439e563b5b144267f9c77839.tar.gz chromium_src-0faac1d9b905b77b439e563b5b144267f9c77839.tar.bz2 |
Moving Autofill-related test support files out of chrome_tests_unit.gypi.
Mostly this is just a mechanical modification of .gypi files. For one
class, DataDrivenTest, a dependency on chrome/common/chrome_paths.h
needed to be broken.
BUG=254754
Review URL: https://chromiumcodereview.appspot.com/19578005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212697 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/test')
20 files changed, 717 insertions, 0 deletions
diff --git a/components/test/data/autofill/merge/input/ambiguous.in b/components/test/data/autofill/merge/input/ambiguous.in new file mode 100644 index 0000000..3c55a6a --- /dev/null +++ b/components/test/data/autofill/merge/input/ambiguous.in @@ -0,0 +1,19 @@ +--- +NAME_FIRST: John +NAME_FIRST: James +NAME_MIDDLE: Kilgore +NAME_MIDDLE: +NAME_LAST: Doe +NAME_LAST: +EMAIL_ADDRESS: john.doe@example.com +EMAIL_ADDRESS: x.doe@example.com +COMPANY_NAME: TestCo +ADDRESS_HOME_LINE1: 1600 Amphitheatre Parkway +ADDRESS_HOME_LINE2: (Bldg. 1950) +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94043 +ADDRESS_HOME_COUNTRY: United States +PHONE_HOME_WHOLE_NUMBER: 6505558888 +PHONE_HOME_WHOLE_NUMBER: 6505559999 +PHONE_HOME_WHOLE_NUMBER: 6505559999 diff --git a/components/test/data/autofill/merge/input/case.in b/components/test/data/autofill/merge/input/case.in new file mode 100644 index 0000000..4657046 --- /dev/null +++ b/components/test/data/autofill/merge/input/case.in @@ -0,0 +1,26 @@ +--- +NAME_FIRST: John +NAME_MIDDLE: Kilgore +NAME_LAST: Doe +EMAIL_ADDRESS: john.doe@example.com +COMPANY_NAME: TestCo +ADDRESS_HOME_LINE1: 1600 Amphitheatre Parkway +ADDRESS_HOME_LINE2: (Bldg. 1950) +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94043 +ADDRESS_HOME_COUNTRY: United States +PHONE_HOME_WHOLE_NUMBER: 6505558888 +--- +NAME_FIRST: john +NAME_MIDDLE: kilgore +NAME_LAST: doe +EMAIL_ADDRESS: john.doe@example.com +COMPANY_NAME: testCo +ADDRESS_HOME_LINE1: 1600 amphitheatre parkway +ADDRESS_HOME_LINE2: (bldg. 1950) +ADDRESS_HOME_CITY: mountain view +ADDRESS_HOME_STATE: ca +ADDRESS_HOME_ZIP: 94043 +ADDRESS_HOME_COUNTRY: united states +PHONE_HOME_WHOLE_NUMBER: 6505558888 diff --git a/components/test/data/autofill/merge/input/email.in b/components/test/data/autofill/merge/input/email.in new file mode 100644 index 0000000..c970da0 --- /dev/null +++ b/components/test/data/autofill/merge/input/email.in @@ -0,0 +1,143 @@ +--- +NAME_FIRST: j@x.com +NAME_MIDDLE: Kilgore +NAME_LAST: Doe +EMAIL_ADDRESS: john.doe@example.com +COMPANY_NAME: TestCo +ADDRESS_HOME_LINE1: 1600 Amphitheatre Parkway +ADDRESS_HOME_LINE2: (Bldg. 1950) +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94043 +ADDRESS_HOME_COUNTRY: United States +PHONE_HOME_WHOLE_NUMBER: 6505558888 +--- +NAME_FIRST: John +NAME_MIDDLE: j@x.com +NAME_LAST: Doe +EMAIL_ADDRESS: john.doe@example.com +COMPANY_NAME: TestCo +ADDRESS_HOME_LINE1: 1601 Amphitheatre Parkway +ADDRESS_HOME_LINE2: (Bldg. 1950) +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94043 +ADDRESS_HOME_COUNTRY: United States +PHONE_HOME_WHOLE_NUMBER: 6505558888 +--- +NAME_FIRST: John +NAME_MIDDLE: Kilgore +NAME_LAST: j@x.com +EMAIL_ADDRESS: john.doe@example.com +COMPANY_NAME: TestCo +ADDRESS_HOME_LINE1: 1602 Amphitheatre Parkway +ADDRESS_HOME_LINE2: (Bldg. 1950) +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94043 +ADDRESS_HOME_COUNTRY: United States +PHONE_HOME_WHOLE_NUMBER: 6505558888 +--- +NAME_FIRST: John +NAME_MIDDLE: Kilgore +NAME_LAST: Doe +EMAIL_ADDRESS: john.doe@example.com +COMPANY_NAME: j@x.com +ADDRESS_HOME_LINE1: 1603 Amphitheatre Parkway +ADDRESS_HOME_LINE2: (Bldg. 1950) +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94043 +ADDRESS_HOME_COUNTRY: United States +PHONE_HOME_WHOLE_NUMBER: 6505558888 +--- +NAME_FIRST: John +NAME_MIDDLE: Kilgore +NAME_LAST: Doe +EMAIL_ADDRESS: john.doe@example.com +COMPANY_NAME: TestCo +ADDRESS_HOME_LINE1: j@x.com +ADDRESS_HOME_LINE2: (Bldg. 1950) +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94043 +ADDRESS_HOME_COUNTRY: United States +PHONE_HOME_WHOLE_NUMBER: 6505558888 +--- +NAME_FIRST: John +NAME_MIDDLE: Kilgore +NAME_LAST: Doe +EMAIL_ADDRESS: john.doe@example.com +COMPANY_NAME: TestCo +ADDRESS_HOME_LINE1: 1604 Amphitheatre Parkway +ADDRESS_HOME_LINE2: j@x.com +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94043 +ADDRESS_HOME_COUNTRY: United States +PHONE_HOME_WHOLE_NUMBER: 6505558888 +--- +NAME_FIRST: John +NAME_MIDDLE: Kilgore +NAME_LAST: Doe +EMAIL_ADDRESS: john.doe@example.com +COMPANY_NAME: TestCo +ADDRESS_HOME_LINE1: 1605 Amphitheatre Parkway +ADDRESS_HOME_LINE2: (Bldg. 1950) +ADDRESS_HOME_CITY: j@x.com +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94043 +ADDRESS_HOME_COUNTRY: United States +PHONE_HOME_WHOLE_NUMBER: 6505558888 +--- +NAME_FIRST: John +NAME_MIDDLE: Kilgore +NAME_LAST: Doe +EMAIL_ADDRESS: john.doe@example.com +COMPANY_NAME: TestCo +ADDRESS_HOME_LINE1: 1606 Amphitheatre Parkway +ADDRESS_HOME_LINE2: (Bldg. 1950) +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: j@x.com +ADDRESS_HOME_ZIP: 94043 +ADDRESS_HOME_COUNTRY: United States +PHONE_HOME_WHOLE_NUMBER: 6505558888 +--- +NAME_FIRST: John +NAME_MIDDLE: Kilgore +NAME_LAST: Doe +EMAIL_ADDRESS: john.doe@example.com +COMPANY_NAME: TestCo +ADDRESS_HOME_LINE1: 1607 Amphitheatre Parkway +ADDRESS_HOME_LINE2: (Bldg. 1950) +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: j@x.com +ADDRESS_HOME_COUNTRY: United States +PHONE_HOME_WHOLE_NUMBER: 6505558888 +--- +NAME_FIRST: John +NAME_MIDDLE: Kilgore +NAME_LAST: Doe +EMAIL_ADDRESS: john.doe@example.com +COMPANY_NAME: TestCo +ADDRESS_HOME_LINE1: 1608 Amphitheatre Parkway +ADDRESS_HOME_LINE2: (Bldg. 1950) +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94043 +ADDRESS_HOME_COUNTRY: j@x.com +PHONE_HOME_WHOLE_NUMBER: 6505558888 +--- +NAME_FIRST: John +NAME_MIDDLE: Kilgore +NAME_LAST: Doe +EMAIL_ADDRESS: john.doe@example.com +COMPANY_NAME: TestCo +ADDRESS_HOME_LINE1: 1609 Amphitheatre Parkway +ADDRESS_HOME_LINE2: (Bldg. 1950) +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94043 +ADDRESS_HOME_COUNTRY: United States +PHONE_HOME_WHOLE_NUMBER: j@x.com diff --git a/components/test/data/autofill/merge/input/identical.in b/components/test/data/autofill/merge/input/identical.in new file mode 100644 index 0000000..ff34555 --- /dev/null +++ b/components/test/data/autofill/merge/input/identical.in @@ -0,0 +1,26 @@ +--- +NAME_FIRST: John +NAME_MIDDLE: Kilgore +NAME_LAST: Doe +EMAIL_ADDRESS: john.doe@example.com +COMPANY_NAME: TestCo +ADDRESS_HOME_LINE1: 1600 Amphitheatre Parkway +ADDRESS_HOME_LINE2: (Bldg. 1950) +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94043 +ADDRESS_HOME_COUNTRY: United States +PHONE_HOME_WHOLE_NUMBER: 6505558888 +--- +NAME_FIRST: John +NAME_MIDDLE: Kilgore +NAME_LAST: Doe +EMAIL_ADDRESS: john.doe@example.com +COMPANY_NAME: TestCo +ADDRESS_HOME_LINE1: 1600 Amphitheatre Parkway +ADDRESS_HOME_LINE2: (Bldg. 1950) +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94043 +ADDRESS_HOME_COUNTRY: United States +PHONE_HOME_WHOLE_NUMBER: 6505558888 diff --git a/components/test/data/autofill/merge/input/multimerge.in b/components/test/data/autofill/merge/input/multimerge.in new file mode 100644 index 0000000..5e4ef80 --- /dev/null +++ b/components/test/data/autofill/merge/input/multimerge.in @@ -0,0 +1,26 @@ +--- +NAME_FIRST: Alice +NAME_MIDDLE: Anne +NAME_LAST: Akins +EMAIL_ADDRESS: aa@a.com +COMPANY_NAME: Acme +ADDRESS_HOME_LINE1: 1 Main Street +ADDRESS_HOME_LINE2: Apt 1 +ADDRESS_HOME_CITY: San Francisco +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94102 +ADDRESS_HOME_COUNTRY: United States +PHONE_HOME_WHOLE_NUMBER: 16502101111 +--- +NAME_FIRST: Billy +NAME_MIDDLE: Bob +NAME_LAST: Bruner +EMAIL_ADDRESS: bb@b.com +COMPANY_NAME: Acme +ADDRESS_HOME_LINE1: 1 Main Street +ADDRESS_HOME_LINE2: Apt 1 +ADDRESS_HOME_CITY: San Francisco +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94102 +ADDRESS_HOME_COUNTRY: United States +PHONE_HOME_WHOLE_NUMBER: 6502343333 diff --git a/components/test/data/autofill/merge/input/primarycase.in b/components/test/data/autofill/merge/input/primarycase.in new file mode 100644 index 0000000..5e56fa3 --- /dev/null +++ b/components/test/data/autofill/merge/input/primarycase.in @@ -0,0 +1,26 @@ +--- +NAME_FIRST: Alice +NAME_MIDDLE: Anne +NAME_LAST: Akins +EMAIL_ADDRESS: aa@a.com +COMPANY_NAME: Acme +ADDRESS_HOME_LINE1: 1 Main Street +ADDRESS_HOME_LINE2: Apt 1 +ADDRESS_HOME_CITY: San Francisco +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94102 +ADDRESS_HOME_COUNTRY: United States +PHONE_HOME_WHOLE_NUMBER: 16502101111 +--- +NAME_FIRST: Billy +NAME_MIDDLE: Bob +NAME_LAST: Bruner +EMAIL_ADDRESS: bb@b.com +COMPANY_NAME: Acme +ADDRESS_HOME_LINE1: 1 MAIN STREET +ADDRESS_HOME_LINE2: Apt 1 +ADDRESS_HOME_CITY: SAN FRANCISCO +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94102 +ADDRESS_HOME_COUNTRY: United States +PHONE_HOME_WHOLE_NUMBER: 6502343333 diff --git a/components/test/data/autofill/merge/input/singlemerge.in b/components/test/data/autofill/merge/input/singlemerge.in new file mode 100644 index 0000000..4e208ab --- /dev/null +++ b/components/test/data/autofill/merge/input/singlemerge.in @@ -0,0 +1,26 @@ +--- +NAME_FIRST: Alice +NAME_MIDDLE: Anne +NAME_LAST: Akins +EMAIL_ADDRESS: aa@a.com +COMPANY_NAME: Acme +ADDRESS_HOME_LINE1: 1 Main Street +ADDRESS_HOME_LINE2: Apt 1 +ADDRESS_HOME_CITY: San Francisco +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94102 +ADDRESS_HOME_COUNTRY: United States +PHONE_HOME_WHOLE_NUMBER: 16502101111 +--- +NAME_FIRST: Alice +NAME_MIDDLE: Anne +NAME_LAST: Akins +EMAIL_ADDRESS: aa@a.com +COMPANY_NAME: Box Co +ADDRESS_HOME_LINE1: 1 Main Street +ADDRESS_HOME_LINE2: Apt 2 +ADDRESS_HOME_CITY: San Francisco +ADDRESS_HOME_STATE: NY +ADDRESS_HOME_ZIP: 11001 +ADDRESS_HOME_COUNTRY: Canada +PHONE_HOME_WHOLE_NUMBER: 16502101111 diff --git a/components/test/data/autofill/merge/input/validation.in b/components/test/data/autofill/merge/input/validation.in new file mode 100644 index 0000000..634f23f --- /dev/null +++ b/components/test/data/autofill/merge/input/validation.in @@ -0,0 +1,72 @@ +--- +NAME_FIRST: John +NAME_LAST: Doe +EMAIL_ADDRESS: john.doe@example.com +COMPANY_NAME: TestCo +ADDRESS_HOME_LINE1: 1600 Amphitheatre Parkway +ADDRESS_HOME_LINE2: (Bldg. 1950) +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94043 +ADDRESS_HOME_COUNTRY: United States +PHONE_HOME_WHOLE_NUMBER: 6505558888 +--- +NAME_FIRST: John +NAME_LAST: Doe +EMAIL_ADDRESS: john.doe@example.com +ADDRESS_HOME_LINE1: 1600 Amphitheatre Parkway +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94043 +ADDRESS_HOME_COUNTRY: United States +PHONE_HOME_WHOLE_NUMBER: 6505558888 +--- +NAME_FIRST: Jim +NAME_LAST: Smith +EMAIL_ADDRESS: john.doe@example.com +ADDRESS_HOME_LINE2: Apt 2 +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94043 +--- +NAME_FIRST: David +NAME_LAST: Smith +EMAIL_ADDRESS: bademail +ADDRESS_HOME_LINE1: 4 Main Street +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94043 +ADDRESS_HOME_COUNTRY: United States +--- +NAME_FIRST: Jane +NAME_LAST: Smith +EMAIL_ADDRESS: jane.smith@example.com +ADDRESS_HOME_LINE1: 1600 Amphitheatre Parkway +ADDRESS_HOME_LINE2: (Bldg. 1950) +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94043 +ADDRESS_HOME_COUNTRY: Bad Country +PHONE_HOME_WHOLE_NUMBER: 6505558888 +--- +NAME_FIRST: Joe +NAME_LAST: Jones +EMAIL_ADDRESS: joejones@example.com +ADDRESS_HOME_LINE1: 1600 Amphitheatre Parkway +ADDRESS_HOME_LINE2: (Bldg. 1950) +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: BadState +ADDRESS_HOME_ZIP: 94043 +ADDRESS_HOME_COUNTRY: United States +PHONE_HOME_WHOLE_NUMBER: 6505558888 +--- +NAME_FIRST: Jim +NAME_LAST: Jones +EMAIL_ADDRESS: jimjones@example.com +ADDRESS_HOME_LINE1: 1600 Amphitheatre Parkway +ADDRESS_HOME_LINE2: (Bldg. 1950) +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: bogus +ADDRESS_HOME_COUNTRY: United States +PHONE_HOME_WHOLE_NUMBER: 6505558888 diff --git a/components/test/data/autofill/merge/output/ambiguous.out b/components/test/data/autofill/merge/output/ambiguous.out new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/components/test/data/autofill/merge/output/ambiguous.out diff --git a/components/test/data/autofill/merge/output/case.out b/components/test/data/autofill/merge/output/case.out new file mode 100644 index 0000000..5b28e19 --- /dev/null +++ b/components/test/data/autofill/merge/output/case.out @@ -0,0 +1,13 @@ +--- +NAME_FIRST: John +NAME_MIDDLE: Kilgore +NAME_LAST: Doe +EMAIL_ADDRESS: john.doe@example.com +COMPANY_NAME: TestCo +ADDRESS_HOME_LINE1: 1600 Amphitheatre Parkway +ADDRESS_HOME_LINE2: (Bldg. 1950) +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94043 +ADDRESS_HOME_COUNTRY: US +PHONE_HOME_WHOLE_NUMBER: (650) 555-8888 diff --git a/components/test/data/autofill/merge/output/email.out b/components/test/data/autofill/merge/output/email.out new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/components/test/data/autofill/merge/output/email.out diff --git a/components/test/data/autofill/merge/output/identical.out b/components/test/data/autofill/merge/output/identical.out new file mode 100644 index 0000000..5b28e19 --- /dev/null +++ b/components/test/data/autofill/merge/output/identical.out @@ -0,0 +1,13 @@ +--- +NAME_FIRST: John +NAME_MIDDLE: Kilgore +NAME_LAST: Doe +EMAIL_ADDRESS: john.doe@example.com +COMPANY_NAME: TestCo +ADDRESS_HOME_LINE1: 1600 Amphitheatre Parkway +ADDRESS_HOME_LINE2: (Bldg. 1950) +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94043 +ADDRESS_HOME_COUNTRY: US +PHONE_HOME_WHOLE_NUMBER: (650) 555-8888 diff --git a/components/test/data/autofill/merge/output/multimerge.out b/components/test/data/autofill/merge/output/multimerge.out new file mode 100644 index 0000000..ecefee1 --- /dev/null +++ b/components/test/data/autofill/merge/output/multimerge.out @@ -0,0 +1,18 @@ +--- +NAME_FIRST: Alice +NAME_FIRST: Billy +NAME_MIDDLE: Anne +NAME_MIDDLE: Bob +NAME_LAST: Akins +NAME_LAST: Bruner +EMAIL_ADDRESS: aa@a.com +EMAIL_ADDRESS: bb@b.com +COMPANY_NAME: Acme +ADDRESS_HOME_LINE1: 1 Main Street +ADDRESS_HOME_LINE2: Apt 1 +ADDRESS_HOME_CITY: San Francisco +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94102 +ADDRESS_HOME_COUNTRY: US +PHONE_HOME_WHOLE_NUMBER: +1 650-210-1111 +PHONE_HOME_WHOLE_NUMBER: (650) 234-3333 diff --git a/components/test/data/autofill/merge/output/primarycase.out b/components/test/data/autofill/merge/output/primarycase.out new file mode 100644 index 0000000..ecefee1 --- /dev/null +++ b/components/test/data/autofill/merge/output/primarycase.out @@ -0,0 +1,18 @@ +--- +NAME_FIRST: Alice +NAME_FIRST: Billy +NAME_MIDDLE: Anne +NAME_MIDDLE: Bob +NAME_LAST: Akins +NAME_LAST: Bruner +EMAIL_ADDRESS: aa@a.com +EMAIL_ADDRESS: bb@b.com +COMPANY_NAME: Acme +ADDRESS_HOME_LINE1: 1 Main Street +ADDRESS_HOME_LINE2: Apt 1 +ADDRESS_HOME_CITY: San Francisco +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94102 +ADDRESS_HOME_COUNTRY: US +PHONE_HOME_WHOLE_NUMBER: +1 650-210-1111 +PHONE_HOME_WHOLE_NUMBER: (650) 234-3333 diff --git a/components/test/data/autofill/merge/output/singlemerge.out b/components/test/data/autofill/merge/output/singlemerge.out new file mode 100644 index 0000000..76e4e25 --- /dev/null +++ b/components/test/data/autofill/merge/output/singlemerge.out @@ -0,0 +1,13 @@ +--- +NAME_FIRST: Alice +NAME_MIDDLE: Anne +NAME_LAST: Akins +EMAIL_ADDRESS: aa@a.com +COMPANY_NAME: Box Co +ADDRESS_HOME_LINE1: 1 Main Street +ADDRESS_HOME_LINE2: Apt 2 +ADDRESS_HOME_CITY: San Francisco +ADDRESS_HOME_STATE: NY +ADDRESS_HOME_ZIP: 11001 +ADDRESS_HOME_COUNTRY: CA +PHONE_HOME_WHOLE_NUMBER: +1 650-210-1111 diff --git a/components/test/data/autofill/merge/output/validation.out b/components/test/data/autofill/merge/output/validation.out new file mode 100644 index 0000000..8f2df39 --- /dev/null +++ b/components/test/data/autofill/merge/output/validation.out @@ -0,0 +1,13 @@ +--- +NAME_FIRST: John +NAME_MIDDLE: +NAME_LAST: Doe +EMAIL_ADDRESS: john.doe@example.com +COMPANY_NAME: TestCo +ADDRESS_HOME_LINE1: 1600 Amphitheatre Parkway +ADDRESS_HOME_LINE2: (Bldg. 1950) +ADDRESS_HOME_CITY: Mountain View +ADDRESS_HOME_STATE: CA +ADDRESS_HOME_ZIP: 94043 +ADDRESS_HOME_COUNTRY: US +PHONE_HOME_WHOLE_NUMBER: (650) 555-8888 diff --git a/components/test/data/autofill/merge/tools/autofill_merge_common.py b/components/test/data/autofill/merge/tools/autofill_merge_common.py new file mode 100644 index 0000000..6a4a788 --- /dev/null +++ b/components/test/data/autofill/merge/tools/autofill_merge_common.py @@ -0,0 +1,73 @@ +# 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. + + +class UnknownColumnNameException(Exception): + """Exception type raised when encountering an unknown column name.""" + def __init__(self, column_name): + self.column_name = column_name + def __str__(self): + return repr(self.column_name) + + +def SerializeProfiles(profiles): + """Returns a serialized string for the given |profiles|. + + |profiles| should be a list of (field_type, value) string pairs. + + """ + + lines = [] + for profile in profiles: + # Include a fixed string to separate profiles. + lines.append("---") + for (field_type, value) in profile: + if field_type == "ignored": + continue; + + lines.append("%s: %s" % (field_type, value)) + + return '\n'.join(lines) + + +def ColumnNameToFieldType(column_name): + """Converts the given |column_name| to the corresponding AutofillField type. + + |column_name| should be a string drawn from the column names of the + autofill_profiles table in the Chromium "Web Data" database. + + """ + + column_name = column_name.lower() + field_type = "unknown" + if column_name in ["guid", "label", "country", "date_modified"]: + field_type = "ignored" + elif column_name == "first_name": + field_type = "NAME_FIRST" + elif column_name == "middle_name": + field_type = "NAME_MIDDLE" + elif column_name == "last_name": + field_type = "NAME_LAST" + elif column_name == "email": + field_type = "EMAIL_ADDRESS" + elif column_name == "company_name": + field_type = "COMPANY_NAME" + elif column_name == "address_line_1": + field_type = "ADDRESS_HOME_LINE1" + elif column_name == "address_line_2": + field_type = "ADDRESS_HOME_LINE2" + elif column_name == "city": + field_type = "ADDRESS_HOME_CITY" + elif column_name == "state": + field_type = "ADDRESS_HOME_STATE" + elif column_name == "zipcode": + field_type = "ADDRESS_HOME_ZIP" + elif column_name == "country_code": + field_type = "ADDRESS_HOME_COUNTRY" + elif column_name == "phone": + field_type = "PHONE_HOME_WHOLE_NUMBER" + else: + raise UnknownColumnNameException(column_name) + + return field_type diff --git a/components/test/data/autofill/merge/tools/flatten.py b/components/test/data/autofill/merge/tools/flatten.py new file mode 100755 index 0000000..81a6690 --- /dev/null +++ b/components/test/data/autofill/merge/tools/flatten.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python +# 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. + +import sys + +def main(): + """Converts a vertical serialization into a compact, horizontal serialization. + """ + + COLUMNS = ['First name', 'Middle name', 'Last name', 'Email', 'Company name', + 'Address line 1', 'Address line 2', 'City', 'State', 'ZIP code', + 'Country', 'Phone'] + + if len(sys.argv) != 2: + print "Usage: python flatten.py <path/to/serialized_profiles>" + return + + profiles = [COLUMNS] + with open(sys.argv[1], 'r') as serialized_profiles: + profile = [] + previous_field_type = '' + for line in serialized_profiles: + # Trim the newline if present. + if line[-1] == '\n': + line = line[:-1] + + if line == "---": + if len(profile): + # Reached the end of a profile. + # Save the current profile and prepare to build up the next one. + profiles.append(profile) + profile = [] + else: + # Append the current field's value to the current profile. + line_parts = line.split(': ', 1) + field_type = line_parts[0] + field_value = line_parts[1] + if field_type != previous_field_type: + profile.append("'%s'" % field_value) + else: + # This is a non-primary value for a multi-valued field. + profile[-1] += ", '%s'" % field_value + previous_field_type = field_type + + if len(profile): + profiles.append(profile) + + # Prepare format strings so that we can align the contents of each column. + transposed = zip(*profiles) + column_widths = [] + for column in transposed: + widths = [len(value) for value in column] + column_widths.append(max(widths)) + column_formats = ["{0:<" + str(width) + "}" for width in column_widths] + + for profile in profiles: + profile_format = zip(column_formats, profile) + profile = [format_.format(value) for (format_, value) in profile_format] + print " | ".join(profile) + return 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/components/test/data/autofill/merge/tools/reserialize_profiles_from_query.py b/components/test/data/autofill/merge/tools/reserialize_profiles_from_query.py new file mode 100755 index 0000000..99dc199 --- /dev/null +++ b/components/test/data/autofill/merge/tools/reserialize_profiles_from_query.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python +# 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. + +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', '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) + return 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/components/test/data/autofill/merge/tools/serialize_profiles.py b/components/test/data/autofill/merge/tools/serialize_profiles.py new file mode 100755 index 0000000..18df1f2 --- /dev/null +++ b/components/test/data/autofill/merge/tools/serialize_profiles.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python +# 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. + +import os.path +import sqlite3 +import sys + +from autofill_merge_common import SerializeProfiles, ColumnNameToFieldType + + +def main(): + """Serializes the autofill_profiles table from the specified database.""" + + if len(sys.argv) != 2: + print "Usage: python serialize_profiles.py <path/to/database>" + return 1 + + database = sys.argv[1] + if not os.path.isfile(database): + print "Cannot read database at \"%s\"" % database + return 1 + + # Read the autofill_profile_names table. + try: + connection = sqlite3.connect(database, 0) + cursor = connection.cursor() + cursor.execute("SELECT * from autofill_profile_names;") + except sqlite3.OperationalError: + print ("Failed to read the autofill_profile_names table from \"%s\"" % + database) + raise + + # For backward-compatibility, the result of |cursor.description| is a list of + # 7-tuples, in which the first item is the column name, and the remaining + # items are 'None'. + types = [ColumnNameToFieldType(item[0]) for item in cursor.description] + profiles = {} + for profile in cursor: + guid = profile[0] + profiles[guid] = zip(types, profile) + + # Read the autofill_profile_emails table. + try: + cursor.execute("SELECT * from autofill_profile_emails;") + except sqlite3.OperationalError: + print ("Failed to read the autofill_profile_emails table from \"%s\"" % + database) + raise + + types = [ColumnNameToFieldType(item[0]) for item in cursor.description] + for profile in cursor: + guid = profile[0] + profiles[guid].extend(zip(types, profile)) + + # Read the autofill_profiles table. + try: + cursor.execute("SELECT * from autofill_profiles;") + except sqlite3.OperationalError: + print "Failed to read the autofill_profiles table from \"%s\"" % database + raise + + types = [ColumnNameToFieldType(item[0]) for item in cursor.description] + for profile in cursor: + guid = profile[0] + profiles[guid].extend(zip(types, profile)) + + # Read the autofill_profile_phones table. + try: + cursor.execute("SELECT * from autofill_profile_phones;") + except sqlite3.OperationalError: + print ("Failed to read the autofill_profile_phones table from \"%s\"" % + database) + raise + + for profile in cursor: + guid = profile[0] + profiles[guid].append(("PHONE_HOME_WHOLE_NUMBER", profile[2])) + + print SerializeProfiles(profiles.values()) + return 0 + + +if __name__ == '__main__': + sys.exit(main()) |