Bug 579178 part C - Allow xpcshell to register additional manifests from the command line, and use this to load httpd.manifest in the xpcshell test harness, r=jwalden

This commit is contained in:
Benjamin Smedberg 2010-07-22 10:42:43 -04:00
Родитель b03ee925ac
Коммит ba5be64d1c
2 изменённых файлов: 21 добавлений и 2 удалений

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

@ -1141,7 +1141,7 @@ static int
usage(void)
{
fprintf(gErrFile, "%s\n", JS_GetImplementationVersion());
fprintf(gErrFile, "usage: xpcshell [-g gredir] [-PsSwWxCij] [-v version] [-f scriptfile] [-e script] [scriptfile] [scriptarg...]\n");
fprintf(gErrFile, "usage: xpcshell [-g gredir] [-r manifest]... [-PsSwWxCij] [-v version] [-f scriptfile] [-e script] [scriptfile] [scriptarg...]\n");
return 2;
}
@ -1819,6 +1819,22 @@ main(int argc, char **argv)
argv += 2;
}
while (argc > 1 && !strcmp(argv[1], "-r")) {
if (argc < 3)
return usage();
nsCOMPtr<nsILocalFile> lf;
rv = XRE_GetFileFromPath(argv[2], getter_AddRefs(lf));
if (NS_FAILED(rv)) {
printf("Couldn't get manifest file.\n");
return 1;
}
XRE_AddManifestLocation(NS_COMPONENT_LOCATION, lf);
argc -= 2;
argv += 2;
}
{
nsCOMPtr<nsIServiceManager> servMan;
rv = NS_InitXPCOM2(getter_AddRefs(servMan), appDir, &dirprovider);

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

@ -139,6 +139,9 @@ class XPCShellTests(object):
self.httpdJSPath = os.path.join(os.path.dirname(self.xpcshell), 'components', 'httpd.js')
self.httpdJSPath = replaceBackSlashes(self.httpdJSPath)
self.httpdManifest = os.path.join(os.path.dirname(self.xpcshell), 'components', 'httpd.manifest')
self.httpdManifest = replaceBackSlashes(self.httpdManifest)
if self.xrePath is None:
self.xrePath = os.path.dirname(self.xpcshell)
else:
@ -204,7 +207,7 @@ class XPCShellTests(object):
"""
# - NOTE: if you rename/add any of the constants set here, update
# do_load_child_test_harness() in head.js
self.xpcsCmd = [self.xpcshell, '-g', self.xrePath, '-j', '-s'] + \
self.xpcsCmd = [self.xpcshell, '-g', self.xrePath, '-r', self.httpdManifest, '-j', '-s'] + \
['-e', 'const _HTTPD_JS_PATH = "%s";' % self.httpdJSPath,
'-e', 'const _HEAD_JS_PATH = "%s";' % self.headJSPath,
'-f', os.path.join(self.testharnessdir, 'head.js')]