зеркало из https://github.com/mozilla/gecko-dev.git
bug 951354 - test nsNSSCertificateDB for proper shutdown r=cviecco a=abillings
This commit is contained in:
Родитель
c03db3bb6d
Коммит
a3dd98815d
|
@ -0,0 +1,37 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIX509CertDB.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
{
|
||||
NS_InitXPCOM2(nullptr, nullptr, nullptr);
|
||||
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||
if (!prefs) {
|
||||
return -1;
|
||||
}
|
||||
// When NSS initializes, it attempts to get some localized strings.
|
||||
// As a result, OS X and Windows flip out if this isn't set.
|
||||
// (This isn't done automatically since this test doesn't have a
|
||||
// lot of the other boilerplate components that would otherwise
|
||||
// keep the certificate db alive longer than we want it to.)
|
||||
nsresult rv = prefs->SetBoolPref("intl.locale.matchOS", true);
|
||||
if (NS_FAILED(rv)) {
|
||||
return -1;
|
||||
}
|
||||
nsCOMPtr<nsIX509CertDB> certdb(do_GetService(NS_X509CERTDB_CONTRACTID));
|
||||
if (!certdb) {
|
||||
return -1;
|
||||
}
|
||||
} // this scopes the nsCOMPtrs
|
||||
// no nsCOMPtrs are allowed to be alive when you call NS_ShutdownXPCOM
|
||||
NS_ShutdownXPCOM(nullptr);
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
CPP_UNIT_TESTS += [
|
||||
'TestCertDB.cpp',
|
||||
]
|
|
@ -11,4 +11,8 @@ TEST_DIRS += [
|
|||
'mochitest',
|
||||
]
|
||||
|
||||
TEST_TOOL_DIRS += [
|
||||
'compiled',
|
||||
]
|
||||
|
||||
XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
|
||||
|
|
Загрузка…
Ссылка в новой задаче