os/security/cryptoservices/certificateandkeymgmt/tcertstore/t_certstoretests.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/cryptoservices/certificateandkeymgmt/tcertstore/t_certstoretests.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,119 @@
     1.4 +/*
     1.5 +* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#include <e32std.h>
    1.23 +#include <fbs.h>
    1.24 +#include "t_testhandler.h"
    1.25 +#include "t_certstoreactionsclient.h"
    1.26 +#include "t_certstoreactionslistcertificates.h"
    1.27 +#include "t_unifiedcertstorewritablecertstorecount.h"
    1.28 +#include "t_unifiedcertstorereadonlycertstorecount.h"
    1.29 +#include "t_unifiedcertstorecertstorecount.h"
    1.30 +#include "t_certstoredefs.h"
    1.31 +#include "t_certstoreactions.h"
    1.32 +#include "t_certstoreactionsfilecertstore.h"
    1.33 +#include "t_unifiedcertstoreadd.h"
    1.34 +#include "t_unifiedcertstoreremove.h"
    1.35 +#include "T_unifiedcertstoreapplications.h"
    1.36 +#include "t_unifiedcertstoreactiongetcert.h"
    1.37 +#include "t_ccttokentypeinfoattributes.h"
    1.38 +#include "t_certstoreactionshandle.h"
    1.39 +#include "t_retrieve.h"
    1.40 +#include "t_concurrentcertstore.h"
    1.41 +#include "t_certstoretests.h"
    1.42 +#include "t_testcertfordeletable.h"
    1.43 +#include "t_filetokens.h"
    1.44 +#include <ecom/ecom.h>
    1.45 +
    1.46 +#include "tscriptandhardcoded.h"
    1.47 +#include "t_swicertstoreactions.h"
    1.48 +
    1.49 +START_SCRIPT_LIST
    1.50 +SCRIPT_ITEM(CCreateFileCertStore, KCreateFileCertStore),
    1.51 +SCRIPT_ITEM(CImportKey, KImportKey),
    1.52 +SCRIPT_ITEM(CAddCertificate, KAddCert),
    1.53 +SCRIPT_ITEM(CInitialiseCertStore, KInitStore),
    1.54 +SCRIPT_ITEM(COnlyCreateCertStore, KOnlyCreateStore),
    1.55 +SCRIPT_ITEM(CDeleteCertStore, KDeleteStore),
    1.56 +SCRIPT_ITEM(CDeleteCertificate, KDeleteCert),
    1.57 +SCRIPT_ITEM(CDeleteRetrieveCACertificate, KDeleteRetrieveCACert),
    1.58 +SCRIPT_ITEM(CDeleteRetrieveUserCertificate, KDeleteRetrieveUserCert),
    1.59 +SCRIPT_ITEM(CListCertificates, KListCert),
    1.60 +SCRIPT_ITEM(CRetrieveCertificate, KRetrieveCert),
    1.61 +SCRIPT_ITEM(CUnifiedCertStoreApplications, KGetApplications),
    1.62 +SCRIPT_ITEM(CSetApplications, KSetApplications),
    1.63 +SCRIPT_ITEM(CSetTrusters, KSetTruster),
    1.64 +SCRIPT_ITEM(CGetTrusters, KGetTrusters),
    1.65 +SCRIPT_ITEM(CInitCertificateAppInfoManager, KInitAppManager),
    1.66 +SCRIPT_ITEM(CDeleteCertificateAppInfoManager, KDeleteAppManager),
    1.67 +SCRIPT_ITEM(CAddClient, KAddClient),
    1.68 +SCRIPT_ITEM(CGetClients, KGetClients),
    1.69 +SCRIPT_ITEM(CRemoveClient, KRemoveClient),
    1.70 +SCRIPT_ITEM(CUnifiedCertStoreWritableCertStoreCount, KCUnifiedCertStoreWritableCertStoreCount),
    1.71 +SCRIPT_ITEM(CUnifiedCertStoreReadOnlyCertStoreCount, KCUnifiedCertStoreReadOnlyCertStoreCount),
    1.72 +SCRIPT_ITEM(CUnifiedCertStoreCertStoreCount, KCUnifiedCertStoreCertStoreCount),
    1.73 +SCRIPT_ITEM(CUnifiedCertStoreGetCert, KCUnifiedCertStoreGetCert),
    1.74 +SCRIPT_ITEM(CInitSWICertStoreAction, KInitSWICertStore),
    1.75 +SCRIPT_ITEM(CGetCapabilitiesAction, KGetCapabilities),
    1.76 +SCRIPT_ITEM(CGetMandatoryAction, KGetMandatory),
    1.77 +SCRIPT_ITEM(CGetSystemUpgradeAction, KGetSystemUpgrade),
    1.78 +SCRIPT_ITEM(CGetDeletionAction, KGetDeletable),
    1.79 +SCRIPT_ITEM(CCTTokenTypeInfoAttributes, KCCTTokenTypeInfoAttributes),
    1.80 +SCRIPT_ITEM(CCertStoreHandle, KCCTCertInfoHandle),
    1.81 +SCRIPT_ITEM(CTestConcurrentCertStore, KTestConcurrentCertStore),
    1.82 +SCRIPT_ITEM(CTestCertForDeletable, KCTestCertForDeletable),
    1.83 +SCRIPT_ITEM(CServerOOMTestStart, KServerOOMTestStart),
    1.84 +SCRIPT_ITEM(CServerOOMTestStop, KServerOOMTestStop),
    1.85 +SCRIPT_ITEM(CMultipleReadersAction, KMultipleReaders),
    1.86 +SCRIPT_ITEM(CCheckServerHeapError, KCheckServerHeapError)
    1.87 +END_SCRIPT_LIST
    1.88 +
    1.89 +void DeleteKeyStoreL()
    1.90 +	{
    1.91 +	RFs fs;
    1.92 +	User::LeaveIfError(fs.Connect());
    1.93 +	CleanupClosePushL(fs);
    1.94 +	
    1.95 +	TDriveUnit sysDrive (RFs::GetSystemDrive());
    1.96 +	TBuf<64> datFile (sysDrive.Name());
    1.97 +	datFile.Append(_L("\\system\\data\\keys.dat"));
    1.98 +	User::LeaveIfError(fs.Delete(datFile));
    1.99 +	CleanupStack::PopAndDestroy(&fs);
   1.100 +	}
   1.101 +
   1.102 +void DoTests()
   1.103 +	{
   1.104 +	// Need to delete the keystore first
   1.105 +	TRAP_IGNORE(DeleteKeyStoreL());
   1.106 +	
   1.107 +	TDriveUnit sysDrive (RFs::GetSystemDrive());
   1.108 +	TBuf<64> scriptFile (sysDrive.Name());
   1.109 +	scriptFile.Append(_L("\\tcertstore\\scripts\\unifiedcertstore1-conf1.txt"));
   1.110 +	
   1.111 +	TBuf<24> logFile (sysDrive.Name());
   1.112 +	logFile.Append(_L("\\tcertstore.log"));
   1.113 +	CScriptSetup::CreateAndRunTestsL(theTestTypes, scriptFile, logFile);
   1.114 +	}
   1.115 +
   1.116 +void DoTests(const TDesC& aScriptFile, const TDesC& aLogFile, TBool isConcurrent)
   1.117 +	{
   1.118 +	TRAP_IGNORE(DeleteKeyStoreL());
   1.119 +	CNullConsole console;
   1.120 +	CConsoleBase* consolePtr = (isConcurrent) ? &console : NULL;
   1.121 +	CScriptSetup::CreateAndRunTestsL(theTestTypes, aScriptFile, aLogFile, EFalse, consolePtr);
   1.122 +	}