authenticationservices/authenticationserver/test/reftestplugin/tpinplugin/tpinpluginteststep.h
changeset 29 ece3df019add
equal deleted inserted replaced
19:cd501b96611d 29:ece3df019add
       
     1 /*
       
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef TPINPLUGINTESTSTEP_H
       
    20 #define TPINPLUGINTESTSTEP_H
       
    21 
       
    22 #include <test/TestExecuteStepBase.h>
       
    23 #include <authserver/authtypes.h>
       
    24 #include <pinplugindialogdefs.h>
       
    25 #include <authserver/authplugininterface.h>
       
    26 #include "pinplugin.h"
       
    27 
       
    28 class CPinPluginTestStep : public CTestStep
       
    29 	{
       
    30 public:
       
    31 	/** Constructor */
       
    32 	CPinPluginTestStep();
       
    33 
       
    34 	/** Destructor */
       
    35 	~CPinPluginTestStep();
       
    36 	
       
    37 	/**	
       
    38 	 Override of base class virtual
       
    39  	 @return - TVerdict code
       
    40   	 */
       
    41 	virtual TVerdict doTestStepPreambleL();
       
    42 
       
    43 	/**
       
    44  	 Override of base class virtual
       
    45  	 @return - TVerdict code
       
    46  	 */
       
    47 	virtual TVerdict doTestStepPostambleL();
       
    48 
       
    49 	/**
       
    50 	 Override of base class pure virtual
       
    51  	 Demonstrates reading configuration parameters fom an ini file section
       
    52  	 @return - TVerdict code
       
    53  	 */
       
    54 	virtual TVerdict doTestStepL();
       
    55 
       
    56 private:
       
    57 	TVerdict iVerdict;
       
    58 	TPtrC iPinProcessType;
       
    59 	AuthServer::TIdentityId iIdentityId;
       
    60 	};
       
    61 
       
    62 class CPinPluginTestActive : public CActive
       
    63 	{
       
    64 public:
       
    65 	static CPinPluginTestActive* NewL(CTestExecuteLogger& aLogger, AuthServer::TIdentityId& aIdentityId, TPtrC& aPinProcessType, CPinPluginTestStep &aTestStep);
       
    66 	/** Destructor */
       
    67 	~CPinPluginTestActive();
       
    68 
       
    69 	TVerdict DoTestPropertyL();
       
    70 	TVerdict DoTestDefaultDataL();	
       
    71 	TVerdict DoTestIdentifyL();
       
    72 	TVerdict DoTestTrainL();
       
    73 	TVerdict DoTestForgetL();
       
    74 	TVerdict DoTestReTrainL();
       
    75 	TVerdict DoTestServerCancelL();
       
    76 	TVerdict DoTestSequenceL();
       
    77 	TVerdict DoTestOomL();	
       
    78 		
       
    79 	//Active
       
    80 	void DoCancel();
       
    81 	void RunL();
       
    82 	CTestExecuteLogger& Logger(){return iLogger;}
       
    83 	//Log buffer
       
    84 	TBuf<150> iLogInfo;
       
    85    	CTestExecuteLogger& iLogger;
       
    86 
       
    87 private:
       
    88 	/** Constructor */
       
    89 	CPinPluginTestActive(CTestExecuteLogger& aLogger, AuthServer::TIdentityId& aIdentityId, TPtrC& aPinProcessType, CPinPluginTestStep &aTestStep);
       
    90 	void ContructL();
       
    91 	
       
    92 private:
       
    93 	void WriteOutputDetailsL();
       
    94 	void ReadOutputDetailsL(TInt& aDialogNumber, TPinValue& aPinValue, TPinPluginInfoMessage& aDisplayedMsg);
       
    95 	TBool ReadDetailsFromIni(CPinPluginTestStep& aStep);
       
    96 	void DeleteFileL();
       
    97 	TBool VerifyResultL(TInt aOutputVal);
       
    98 	TBool CheckResultL(TInt aResult);
       
    99 	TBool TrainIdentifyL();
       
   100 	TBool ForgetIdentifyL();
       
   101 	TBool DoTrainL(HBufC8*& aResult);
       
   102 	TBool DoIdentifyL(HBufC8*& aResult);
       
   103 	TBool DoForgetL();
       
   104 	CPinPlugin* LoadPluginL();
       
   105 	void UnLoadPlugin();
       
   106 	TVerdict ReturnResultL(TBool aRes);
       
   107 	void PreferDialogInputL(const TDesC& aExpectedOutput, TPinPluginDialogOperation aOp, 
       
   108 		TInt aDialogNo);
       
   109 private:
       
   110 	
       
   111 	static TInt KAuthenticationServerStackSize;
       
   112 	static TInt KAuthenticationServerInitHeapSize;
       
   113 	static TInt KAuthenticationServerMaxHeapSize;
       
   114 		
       
   115   	AuthServer::CAuthPluginInterface* iPinPlugin;
       
   116    	RFs iFs;
       
   117 	TPinPluginDialogOperation iOperation;
       
   118 	TInt iIndex;
       
   119 	TInt iNewPinLength;
       
   120 	TPinValue iPinValue;
       
   121 	TPinValue iTempPinValue;
       
   122 	TPtrC iExpectedOutput;
       
   123 	TPinPluginDialogResult iCmdResult,iCmdFinalResult;
       
   124 	TPinPluginInfoMessage iInfoMsg;
       
   125 	TInt iDialogNumber;
       
   126 	AuthServer::TIdentityId iIdentityId;
       
   127 	TPtrC iPinProcessType;	
       
   128 	TInt iOomTest;
       
   129 	HBufC* iClientMessage;
       
   130     CPinPluginTestStep &iTestStep;
       
   131 	TUid iDtor_ID_Key;
       
   132 	};
       
   133 
       
   134 class CCreateFile : public CTestStep
       
   135 	{
       
   136 public:
       
   137 	/** Constructor */
       
   138 	CCreateFile();
       
   139 
       
   140 	/** Destructor */
       
   141 	~CCreateFile();
       
   142 	
       
   143 	/**	
       
   144 	 Override of base class virtual
       
   145  	 @return - TVerdict code
       
   146   	 */
       
   147 	virtual TVerdict doTestStepPreambleL();
       
   148 
       
   149 	/**
       
   150  	 Override of base class virtual
       
   151  	 @return - TVerdict code
       
   152  	 */
       
   153 	virtual TVerdict doTestStepPostambleL();
       
   154 
       
   155 	/**
       
   156 	 Override of base class pure virtual
       
   157  	 Demonstrates reading configuration parameters fom an ini file section
       
   158  	 @return - TVerdict code
       
   159  	 */
       
   160 	virtual TVerdict doTestStepL();
       
   161 
       
   162 private:
       
   163 	TPinValue GetPinFromOutputFileL();
       
   164 
       
   165 private:
       
   166 	TPinPluginDialogOperation iOperation;
       
   167 	TPinValue iPinValue;
       
   168 	TInt iIndex;
       
   169 	TInt iNewPinLength;
       
   170 	TPinPluginDialogResult iCmdResult;
       
   171 	TPinPluginDialogResult iCmdFinalResult;
       
   172 	TInt iDialogNumber;
       
   173 	
       
   174 	};
       
   175 
       
   176 // Strings for the server create test step code
       
   177 _LIT(KPinPluginTestStep,	"tPinPluginTestStep");
       
   178 _LIT(KCreateInputFile,	"CreateInputFile");
       
   179 
       
   180 _LIT(KTrainServerCancel,  	"TrainServerCancel");
       
   181 _LIT(KReTrainServerCancel,  "ReTrainServerCancel");
       
   182 _LIT(KIdentifyServerCancel, "IdentifyServerCancel");
       
   183 
       
   184 
       
   185 #endif /* TPINPLUGINTESTSTEP_H */
       
   186 
       
   187