os/security/cryptoservices/certificateandkeymgmt/tcertstore/t_certstoretests.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of the License "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
sl@0
    19
#include <e32std.h>
sl@0
    20
#include <fbs.h>
sl@0
    21
#include "t_testhandler.h"
sl@0
    22
#include "t_certstoreactionsclient.h"
sl@0
    23
#include "t_certstoreactionslistcertificates.h"
sl@0
    24
#include "t_unifiedcertstorewritablecertstorecount.h"
sl@0
    25
#include "t_unifiedcertstorereadonlycertstorecount.h"
sl@0
    26
#include "t_unifiedcertstorecertstorecount.h"
sl@0
    27
#include "t_certstoredefs.h"
sl@0
    28
#include "t_certstoreactions.h"
sl@0
    29
#include "t_certstoreactionsfilecertstore.h"
sl@0
    30
#include "t_unifiedcertstoreadd.h"
sl@0
    31
#include "t_unifiedcertstoreremove.h"
sl@0
    32
#include "T_unifiedcertstoreapplications.h"
sl@0
    33
#include "t_unifiedcertstoreactiongetcert.h"
sl@0
    34
#include "t_ccttokentypeinfoattributes.h"
sl@0
    35
#include "t_certstoreactionshandle.h"
sl@0
    36
#include "t_retrieve.h"
sl@0
    37
#include "t_concurrentcertstore.h"
sl@0
    38
#include "t_certstoretests.h"
sl@0
    39
#include "t_testcertfordeletable.h"
sl@0
    40
#include "t_filetokens.h"
sl@0
    41
#include <ecom/ecom.h>
sl@0
    42
sl@0
    43
#include "tscriptandhardcoded.h"
sl@0
    44
#include "t_swicertstoreactions.h"
sl@0
    45
sl@0
    46
START_SCRIPT_LIST
sl@0
    47
SCRIPT_ITEM(CCreateFileCertStore, KCreateFileCertStore),
sl@0
    48
SCRIPT_ITEM(CImportKey, KImportKey),
sl@0
    49
SCRIPT_ITEM(CAddCertificate, KAddCert),
sl@0
    50
SCRIPT_ITEM(CInitialiseCertStore, KInitStore),
sl@0
    51
SCRIPT_ITEM(COnlyCreateCertStore, KOnlyCreateStore),
sl@0
    52
SCRIPT_ITEM(CDeleteCertStore, KDeleteStore),
sl@0
    53
SCRIPT_ITEM(CDeleteCertificate, KDeleteCert),
sl@0
    54
SCRIPT_ITEM(CDeleteRetrieveCACertificate, KDeleteRetrieveCACert),
sl@0
    55
SCRIPT_ITEM(CDeleteRetrieveUserCertificate, KDeleteRetrieveUserCert),
sl@0
    56
SCRIPT_ITEM(CListCertificates, KListCert),
sl@0
    57
SCRIPT_ITEM(CRetrieveCertificate, KRetrieveCert),
sl@0
    58
SCRIPT_ITEM(CUnifiedCertStoreApplications, KGetApplications),
sl@0
    59
SCRIPT_ITEM(CSetApplications, KSetApplications),
sl@0
    60
SCRIPT_ITEM(CSetTrusters, KSetTruster),
sl@0
    61
SCRIPT_ITEM(CGetTrusters, KGetTrusters),
sl@0
    62
SCRIPT_ITEM(CInitCertificateAppInfoManager, KInitAppManager),
sl@0
    63
SCRIPT_ITEM(CDeleteCertificateAppInfoManager, KDeleteAppManager),
sl@0
    64
SCRIPT_ITEM(CAddClient, KAddClient),
sl@0
    65
SCRIPT_ITEM(CGetClients, KGetClients),
sl@0
    66
SCRIPT_ITEM(CRemoveClient, KRemoveClient),
sl@0
    67
SCRIPT_ITEM(CUnifiedCertStoreWritableCertStoreCount, KCUnifiedCertStoreWritableCertStoreCount),
sl@0
    68
SCRIPT_ITEM(CUnifiedCertStoreReadOnlyCertStoreCount, KCUnifiedCertStoreReadOnlyCertStoreCount),
sl@0
    69
SCRIPT_ITEM(CUnifiedCertStoreCertStoreCount, KCUnifiedCertStoreCertStoreCount),
sl@0
    70
SCRIPT_ITEM(CUnifiedCertStoreGetCert, KCUnifiedCertStoreGetCert),
sl@0
    71
SCRIPT_ITEM(CInitSWICertStoreAction, KInitSWICertStore),
sl@0
    72
SCRIPT_ITEM(CGetCapabilitiesAction, KGetCapabilities),
sl@0
    73
SCRIPT_ITEM(CGetMandatoryAction, KGetMandatory),
sl@0
    74
SCRIPT_ITEM(CGetSystemUpgradeAction, KGetSystemUpgrade),
sl@0
    75
SCRIPT_ITEM(CGetDeletionAction, KGetDeletable),
sl@0
    76
SCRIPT_ITEM(CCTTokenTypeInfoAttributes, KCCTTokenTypeInfoAttributes),
sl@0
    77
SCRIPT_ITEM(CCertStoreHandle, KCCTCertInfoHandle),
sl@0
    78
SCRIPT_ITEM(CTestConcurrentCertStore, KTestConcurrentCertStore),
sl@0
    79
SCRIPT_ITEM(CTestCertForDeletable, KCTestCertForDeletable),
sl@0
    80
SCRIPT_ITEM(CServerOOMTestStart, KServerOOMTestStart),
sl@0
    81
SCRIPT_ITEM(CServerOOMTestStop, KServerOOMTestStop),
sl@0
    82
SCRIPT_ITEM(CMultipleReadersAction, KMultipleReaders),
sl@0
    83
SCRIPT_ITEM(CCheckServerHeapError, KCheckServerHeapError)
sl@0
    84
END_SCRIPT_LIST
sl@0
    85
sl@0
    86
void DeleteKeyStoreL()
sl@0
    87
	{
sl@0
    88
	RFs fs;
sl@0
    89
	User::LeaveIfError(fs.Connect());
sl@0
    90
	CleanupClosePushL(fs);
sl@0
    91
	
sl@0
    92
	TDriveUnit sysDrive (RFs::GetSystemDrive());
sl@0
    93
	TBuf<64> datFile (sysDrive.Name());
sl@0
    94
	datFile.Append(_L("\\system\\data\\keys.dat"));
sl@0
    95
	User::LeaveIfError(fs.Delete(datFile));
sl@0
    96
	CleanupStack::PopAndDestroy(&fs);
sl@0
    97
	}
sl@0
    98
sl@0
    99
void DoTests()
sl@0
   100
	{
sl@0
   101
	// Need to delete the keystore first
sl@0
   102
	TRAP_IGNORE(DeleteKeyStoreL());
sl@0
   103
	
sl@0
   104
	TDriveUnit sysDrive (RFs::GetSystemDrive());
sl@0
   105
	TBuf<64> scriptFile (sysDrive.Name());
sl@0
   106
	scriptFile.Append(_L("\\tcertstore\\scripts\\unifiedcertstore1-conf1.txt"));
sl@0
   107
	
sl@0
   108
	TBuf<24> logFile (sysDrive.Name());
sl@0
   109
	logFile.Append(_L("\\tcertstore.log"));
sl@0
   110
	CScriptSetup::CreateAndRunTestsL(theTestTypes, scriptFile, logFile);
sl@0
   111
	}
sl@0
   112
sl@0
   113
void DoTests(const TDesC& aScriptFile, const TDesC& aLogFile, TBool isConcurrent)
sl@0
   114
	{
sl@0
   115
	TRAP_IGNORE(DeleteKeyStoreL());
sl@0
   116
	CNullConsole console;
sl@0
   117
	CConsoleBase* consolePtr = (isConcurrent) ? &console : NULL;
sl@0
   118
	CScriptSetup::CreateAndRunTestsL(theTestTypes, aScriptFile, aLogFile, EFalse, consolePtr);
sl@0
   119
	}