msi: Add tests for registering and unregistering MIME info.

This commit is contained in:
Hans Leidekker 2010-04-02 10:40:28 +02:00 committed by Alexandre Julliard
parent 3050cde95e
commit 7aad77ae58
1 changed files with 102 additions and 0 deletions

View File

@ -1799,6 +1799,62 @@ static const CHAR rei_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
"PublishProduct\t\t5200\n" "PublishProduct\t\t5200\n"
"InstallFinalize\t\t6000\n"; "InstallFinalize\t\t6000\n";
static const CHAR rmi_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
"s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
"File\tFile\n"
"mime.txt\tmime\tmime.txt\t1000\t\t\t8192\t1\n";
static const CHAR rmi_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
"s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
"Feature\tFeature\n"
"mime\t\t\tmime feature\t1\t2\tMSITESTDIR\t0\n";
static const CHAR rmi_feature_comp_dat[] = "Feature_\tComponent_\n"
"s38\ts72\n"
"FeatureComponents\tFeature_\tComponent_\n"
"mime\tmime\n";
static const CHAR rmi_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
"s72\tS38\ts72\ti2\tS255\tS72\n"
"Component\tComponent\n"
"mime\t{A1D630CE-13A7-4882-AFDD-148E2BBAFC6D}\tMSITESTDIR\t0\t\tmime.txt\n";
static const CHAR rmi_extension_dat[] = "Extension\tComponent_\tProgId_\tMIME_\tFeature_\n"
"s255\ts72\tS255\tS64\ts38\n"
"Extension\tExtension\tComponent_\n"
"mime\tmime\t\tmime/type\tmime\n";
static const CHAR rmi_verb_dat[] = "Extension_\tVerb\tSequence\tCommand\tArgument\n"
"s255\ts32\tI2\tL255\tL255\n"
"Verb\tExtension_\tVerb\n"
"mime\tOpen\t1\t&Open\t/argument\n";
static const CHAR rmi_mime_dat[] = "ContentType\tExtension_\tCLSID\n"
"s64\ts255\tS38\n"
"MIME\tContentType\n"
"mime/type\tmime\t\n";
static const CHAR rmi_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
"s72\tS255\tI2\n"
"InstallExecuteSequence\tAction\n"
"LaunchConditions\t\t100\n"
"CostInitialize\t\t800\n"
"FileCost\t\t900\n"
"CostFinalize\t\t1000\n"
"InstallValidate\t\t1400\n"
"InstallInitialize\t\t1500\n"
"ProcessComponents\t\t1600\n"
"RemoveFiles\t\t1700\n"
"InstallFiles\t\t2000\n"
"UnregisterExtensionInfo\t\t3000\n"
"UnregisterMIMEInfo\t\t3500\n"
"RegisterExtensionInfo\t\t4000\n"
"RegisterMIMEInfo\t\t4500\n"
"RegisterProduct\t\t5000\n"
"PublishFeatures\t\t5100\n"
"PublishProduct\t\t5200\n"
"InstallFinalize\t\t6000\n";
typedef struct _msi_table typedef struct _msi_table
{ {
const CHAR *filename; const CHAR *filename;
@ -2746,6 +2802,21 @@ static const msi_table rei_tables[] =
ADD_TABLE(property) ADD_TABLE(property)
}; };
static const msi_table rmi_tables[] =
{
ADD_TABLE(directory),
ADD_TABLE(rmi_component),
ADD_TABLE(rmi_feature),
ADD_TABLE(rmi_feature_comp),
ADD_TABLE(rmi_file),
ADD_TABLE(rmi_extension),
ADD_TABLE(rmi_verb),
ADD_TABLE(rmi_mime),
ADD_TABLE(rmi_install_exec_seq),
ADD_TABLE(media),
ADD_TABLE(property)
};
/* cabinet definitions */ /* cabinet definitions */
/* make the max size large so there is only one cab file */ /* make the max size large so there is only one cab file */
@ -9144,6 +9215,36 @@ static void test_register_extension_info(void)
delete_test_files(); delete_test_files();
} }
static void test_register_mime_info(void)
{
UINT r;
LONG res;
HKEY hkey;
create_test_files();
create_file("msitest\\mime.txt", 1000);
create_database(msifile, rmi_tables, sizeof(rmi_tables) / sizeof(msi_table));
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
r = MsiInstallProductA(msifile, NULL);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
res = RegOpenKeyA(HKEY_CLASSES_ROOT, "MIME\\Database\\Content Type\\mime/type", &hkey);
ok(res == ERROR_SUCCESS, "key not created\n");
RegCloseKey(hkey);
r = MsiInstallProductA(msifile, "REMOVE=ALL");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
res = RegOpenKeyA(HKEY_CLASSES_ROOT, "MIME\\Database\\Content Type\\mime/type", &hkey);
ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
ok(!delete_pf("msitest\\mime.txt", TRUE), "file not removed\n");
ok(!delete_pf("msitest", FALSE), "directory not removed\n");
delete_test_files();
}
START_TEST(install) START_TEST(install)
{ {
DWORD len; DWORD len;
@ -9253,6 +9354,7 @@ START_TEST(install)
test_remove_env_strings(); test_remove_env_strings();
test_register_class_info(); test_register_class_info();
test_register_extension_info(); test_register_extension_info();
test_register_mime_info();
DeleteFileA(log_file); DeleteFileA(log_file);