Bug 684455 - Test for Becky! Internet Mail addressbook importer. r=mconley, sr=standard8

This commit is contained in:
Hiroyuki Ikezoe 2016-05-13 07:24:20 +02:00
Родитель e9bcdd774d
Коммит ec95be6836
7 изменённых файлов: 107 добавлений и 0 удалений

Просмотреть файл

@ -98,5 +98,35 @@
"LastName" : "Doe",
"PrimaryEmail" : "johndoe@host.invalid"
}
],
"becky_addressbook" :
[
{
"DisplayName" : "The first man",
"PrimaryEmail" : "first@host.invalid",
"HomePhone" : "11-1111-1111",
"WorkPhone" : "22-2222-2222",
"CellularNumber" : "333-3333-3333",
"Company" : "Organization",
"Notes" : "This is a note."
},
{
"DisplayName" : "The second man",
"PrimaryEmail" : "second@host.invalid",
"HomePhone" : "44-4444-4444",
"WorkPhone" : "55-5555-5555",
"CellularNumber" : "666-6666-6666",
"Company" : "Organization",
"Notes" : "This is a note."
},
{
"DisplayName" : "The third man",
"PrimaryEmail" : "third@host.invalid",
"HomePhone" : "77-7777-7777",
"WorkPhone" : "88-8888-8888",
"CellularNumber" : "999-9999-9999",
"Company" : "Organization",
"Notes" : "This is a note."
}
]
}

Просмотреть файл

@ -0,0 +1,24 @@
BEGIN:VCARD
UID:4E4D17E8.0043655C
FN:The first man
ORG:Organization;Post;
X-BECKY-IMAGE:0
N:The nick name of the first man
TEL;HOME:11-1111-1111
TEL;WORK:22-2222-2222
TEL;CELL:333-3333-3333
EMAIL;PREF:first@host.invalid
NOTE;ENCODING=QUOTED-PRINTABLE:This is a note.
END:VCARD
BEGIN:VCARD
UID:4EBBF6FE.00AC632B
FN:The second man
ORG:Organization;post;
X-BECKY-IMAGE:0
N:The nick name of the second man
TEL;HOME:44-4444-4444
TEL;WORK:55-5555-5555
TEL;CELL:666-6666-6666
EMAIL;PREF:second@host.invalid
NOTE;ENCODING=QUOTED-PRINTABLE:This is a note.
END:VCARD

Просмотреть файл

@ -0,0 +1,12 @@
BEGIN:VCARD
UID:4E57AB44.0001D53E
FN:The third man
ORG:Organization;post;
X-BECKY-IMAGE:0
N:The third man
TEL;HOME:77-7777-7777
TEL;WORK:88-8888-8888
TEL;CELL:999-9999-9999
EMAIL;PREF:third@host.invalid
NOTE;ENCODING=QUOTED-PRINTABLE:This is a note.
END:VCARD

Просмотреть файл

@ -0,0 +1,12 @@
BEGIN:VCARD
UID:4E4D17E8.0043655C
FN:Nobody
ORG:Organization;post;
X-BECKY-IMAGE:0
N:Nobody
TEL;HOME:00-0000-0000
TEL;WORK:11-1111-1111
TEL;CELL:090-0000-0000
EMAIL;PREF:nobody@example.com
NOTE;ENCODING=QUOTED-PRINTABLE:This is a note.
END:VCARD

Просмотреть файл

@ -320,6 +320,10 @@ AbImportHelper.prototype =
var arr = JSON.parse(json)[aName];
do_check_true(arr && arr.length > 0);
return arr;
},
setSupportedAttributes: function(attributes) {
this.mSupportedAttributes = attributes;
}
};

Просмотреть файл

@ -0,0 +1,23 @@
function run_test()
{
if (!("nsIWindowsRegKey" in Ci))
return;
// Due to the import code using nsIAbManager off the main thread, we need
// to ensure that it is initialized before we start the main test.
let abMgr = Cc["@mozilla.org/abmanager;1"].getService(Ci.nsIAbManager);
let file = do_get_file("resources/becky/addressbooks");
let helper = new AbImportHelper(file, "Becky!", "addressbooks",
"becky_addressbook");
let vcfSupportedAttributes =
["FirstName", "LastName", "DisplayName", "NickName", "PrimaryEmail",
"SecondEmail", "WorkPhone", "HomePhone", "FaxNumber", "PagerNumber",
"CellularNumber", "HomeAddress", "HomeAddress2", "HomeCity", "HomeState",
"HomeZipCode", "HomeCountry", "WorkAddress", "WorkAddress2", "WorkCity",
"WorkState", "WorkZipCode", "WorkCountry", "JobTitle", "Department",
"Company", "BirthYear", "BirthMonth", "BirthDay", "WebPage1", "WebPage2",
"Custom1", "Custom2", "Custom3", "Custom4", "Notes", "_AimScreenName"];
helper.setSupportedAttributes(vcfSupportedAttributes);
helper.beginImport();
}

Просмотреть файл

@ -6,6 +6,8 @@ support-files = resources/*
[test_bug_263304.js]
[test_bug_437556.js]
[test_csv_GetSample.js]
[test_becky_addressbook.js]
run-if = os == 'win'
[test_csv_import.js]
[test_csv_import_quote.js]
[test_ldif_import.js]