authenticationservices/authenticationserver/test/tauthcliserv/tauthcliservstep.h
changeset 29 ece3df019add
equal deleted inserted replaced
19:cd501b96611d 29:ece3df019add
       
     1 /*
       
     2 * Copyright (c) 2005-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 TAUTHCLISERVSTEP_H
       
    20 #define TAUTHCLISERVSTEP_H
       
    21 
       
    22 #include <e32cmn.h>
       
    23 #include <ct/rcpointerarray.h>
       
    24 #include <ecom/ecom.h>
       
    25 
       
    26 #include <test/testexecutestepbase.h>
       
    27 #include <test/testexecutelog.h>
       
    28 
       
    29 #include "tauthcliserv.h"
       
    30 
       
    31 #ifndef __INIPARSER_H__
       
    32 #include <cinidata.h>
       
    33 #endif // __INIPARSER_H__
       
    34 
       
    35 // publicly available include file
       
    36 #include "authserver_client.h"
       
    37 #include <authserver/authplugininterface.h>
       
    38 
       
    39 // these tests use some information which is normally
       
    40 // only visible to the server, or to the client DLL.
       
    41 
       
    42 #include "authserveripc.h"
       
    43 #include "authdb.h"
       
    44 #include "transientkey.h"
       
    45 #include "transientkeyinfo.h"
       
    46 #include "evaluator.h"
       
    47 
       
    48 // load test plugin data
       
    49 #include "../tauthplugins/consts.h"
       
    50 
       
    51 using AuthServer::TIdentityId;
       
    52 using AuthServer::TPluginId;
       
    53 using AuthServer::TAuthPluginType;
       
    54 using AuthServer::TAuthTrainingStatus;
       
    55 using AuthServer::CAuthExpression;
       
    56 using AuthServer::CAuthExpressionImpl;
       
    57 using AuthServer::TAuthExpressionWrapper;
       
    58 using AuthServer::CEvaluator;
       
    59 using AuthServer::CPluginDesc;
       
    60 using AuthServer::RAuthClient;
       
    61 
       
    62 // Authserver name
       
    63 _LIT(KAuthServerName, "!AuthServer");
       
    64 
       
    65 _LIT(KTStepCreateDb,"CREATEDB");
       
    66 _LIT(KTStepClient,	"CLIENT");
       
    67 _LIT(KTStepMgrClient,	"MGRCLIENT");
       
    68 _LIT(KTStepFirstStart,	"FIRSTSTART");
       
    69 
       
    70 _LIT(KTStepAuthExprBuild, "AuthExprBuild");
       
    71 _LIT(KTStepBadExtAuthExpr, "AuthExprBadAuthExt");
       
    72 _LIT(KTStepAuthExprHighVer, "AuthExprHighVer");
       
    73 _LIT(KTStepAuthExprEval, "AuthExprEval");
       
    74 
       
    75 // debug-mode tests for client-side panicks
       
    76 _LIT(KTStepAuthExprTypePnc, "AuthExprTypePanic");
       
    77 _LIT(KTStepAuthExprTypePncBadLeft, "AuthExprTypePanicBadLeft");
       
    78 _LIT(KTStepAuthExprTypePncBadRight, "AuthExprTypePanicBadRight");
       
    79 
       
    80 // These are used in the RemoveExistingDbL() function
       
    81 // applying to DBs used by tPinAuthPlugin
       
    82 _LIT(KPlugin3100File,		"\\tAuth\\tAuthSvr\\testdata\\Pin11113100Db.ini");
       
    83 _LIT(KPlugin3101File,		"\\tAuth\\tAuthSvr\\testdata\\Pin11113101Db.ini");
       
    84 _LIT(KPlugin3102File,		"\\tAuth\\tAuthSvr\\testdata\\Pin11113102Db.ini");
       
    85 _LIT(KAuthSvrPolicyFile, 	"\\tAuth\\tAuthSvr\\testdata\\AuthSvrPolicy.ini");
       
    86 _LIT(KPinDbTag,				"Identity&PinValues");
       
    87 _LIT(KTotalDbTag,			"AllUserID&PinValues");
       
    88 _LIT(KInitPinDatabaseValue,	",");
       
    89 _LIT(KDisplayMessage,		"DisplayMessage");
       
    90 
       
    91 #define KNumPlugins 8
       
    92 
       
    93 const TInt KTestPluginId22       = 0x10274104;
       
    94 const TInt KTestPluginBlocking   = 0x10274105;
       
    95 const TInt KTestPluginIdInactive = 0x10274106;
       
    96 const TInt KTestPluginIdUnknown  = 0x10274107;
       
    97 
       
    98 
       
    99 class CTAuthcliservStepBase : public CTestStep
       
   100 	{
       
   101 protected:
       
   102 	CTAuthcliservStepBase() {}
       
   103 	virtual ~CTAuthcliservStepBase();
       
   104 	virtual TVerdict doTestStepPreambleL()
       
   105 	   {
       
   106 	   iFs.Connect();
       
   107 	
       
   108 	   CreatePlugins();
       
   109 	   CreateKeyInfo();
       
   110 	   
       
   111 	   return TestStepResult();
       
   112 	   }
       
   113 	virtual TVerdict doTestStepPostambleL()
       
   114     	{
       
   115 		iFs.Close();
       
   116 		return TestStepResult();
       
   117 		}
       
   118 	
       
   119 	inline void CreatePlugins();
       
   120 	inline void CreateKeyInfo();
       
   121 	HBufC* GetNameLC(TInt i);
       
   122 
       
   123 	void PluginData(AuthServer::TIdentityId aId,
       
   124 					AuthServer::TPluginId aPlugin,
       
   125 					TPtr8 aDes) 
       
   126 	{
       
   127 	aDes.Fill(aId*aPlugin);
       
   128 	}
       
   129 
       
   130 	void WaitForServerToReleaseDb();
       
   131 	void RemoveExistingDbL();
       
   132 	//Utility function allowing text INI file parsing abilities	
       
   133 	//Section name unspecified
       
   134 	TInt writeToNamedConfig(const TDesC &aFileName, const TDesC &aKeyName,const TPtrC &aResult);
       
   135 	
       
   136 	
       
   137 protected:
       
   138 	RFs		iFs;
       
   139 
       
   140 
       
   141 	AuthServer::CPluginDesc*       iPlugins[KNumPlugins];
       
   142 	AuthServer::CTransientKeyInfo* iId1Keys[KNumPlugins];
       
   143 	AuthServer::CTransientKeyInfo* iId2Keys[KNumPlugins];
       
   144 	AuthServer::CTransientKeyInfo* iId3Keys[KNumPlugins];
       
   145   };
       
   146 
       
   147 inline CTAuthcliservStepBase::~CTAuthcliservStepBase() 
       
   148     {
       
   149     for (TInt i = 0 ; i < KNumPlugins ; ++i)
       
   150         {
       
   151         delete iPlugins[i];
       
   152         delete iId1Keys[i];
       
   153         delete iId2Keys[i];
       
   154         delete iId3Keys[i];
       
   155         }
       
   156     }
       
   157 
       
   158 class CTStepActSch : public CTAuthcliservStepBase
       
   159 /**
       
   160 	This abstract subclass of CTAuthcliservStepBase
       
   161 	overrides the doTestStep(Pre|Post)ambleL functions
       
   162 	from CTestBase to allocate and free an active
       
   163 	scheduler.
       
   164 	
       
   165 	The scheduler is stored in the protected iActSchd
       
   166 	variable.  This class does not start or stop the
       
   167 	scheduler.
       
   168  */
       
   169 	{
       
   170 private:
       
   171 	// override CTestStep
       
   172 	inline virtual TVerdict doTestStepPreambleL();
       
   173 	inline virtual TVerdict doTestStepPostambleL();
       
   174 	
       
   175 protected:
       
   176 	/** The active scheduler which subclasses can use. */
       
   177 	CActiveScheduler* iActSchd;
       
   178 	};
       
   179 
       
   180 
       
   181 
       
   182 inline TVerdict CTStepActSch::doTestStepPreambleL()
       
   183 /**
       
   184 	Override CTestStep by allocating an active
       
   185 	scheduler which is available to the subclass.
       
   186 	
       
   187 	@return					This test step's result,
       
   188 							which isn't actually used
       
   189 							by ThreadStepExecutionL.
       
   190  */
       
   191 	{
       
   192 	CTAuthcliservStepBase::doTestStepPreambleL();
       
   193 	iActSchd = new(ELeave) CActiveScheduler;
       
   194 	return TestStepResult();
       
   195 	}
       
   196 
       
   197 
       
   198 inline TVerdict CTStepActSch::doTestStepPostambleL()
       
   199 /**
       
   200 	Override CTestStep by deleting the active
       
   201 	scheduler which allocated in doTestStepPreambleL.
       
   202 	
       
   203 	@return					This test step's result,
       
   204 							which isn't actually used
       
   205 							by ThreadStepExecutionL.
       
   206  */
       
   207 	{
       
   208 	CTAuthcliservStepBase::doTestStepPostambleL();
       
   209 	delete iActSchd;
       
   210 	return TestStepResult();
       
   211 	}
       
   212 
       
   213 
       
   214 class CTStepClient : public CTStepActSch
       
   215 	{
       
   216 public:
       
   217 	CTStepClient();
       
   218 	virtual TVerdict doTestStepL();
       
   219 	TBool TestAuthenticate(AuthServer::RAuthClient& client);
       
   220 	TBool TestAuthenticate2(AuthServer::RAuthClient& client);
       
   221 	TBool TestAuthenticate3(AuthServer::RAuthClient& client);
       
   222 	TBool TestAuthenticateFail(AuthServer::RAuthClient& client);
       
   223 
       
   224 
       
   225 
       
   226 private:
       
   227 	void GetDescriptionsFromEComL(RPointerArray<CPluginDesc>& aDescs);
       
   228 	
       
   229 	void TestIdentitiesL();
       
   230 	void GetIdentitiesLC(RArray<TIdentityId>& aIds);
       
   231 	void AddIdentityL(TIdentityId aIdentityId, const TDesC& aDesc);
       
   232 	void TestIdentityL(TIdentityId aIdentityId, const TDesC& aExpDesc);
       
   233 	void TestSetIdentityStrL();
       
   234 
       
   235 	void TestClientPluginListsL();
       
   236 	void SetSeenCountsL(const RCPointerArray<const CPluginDesc>& aPlugins);
       
   237 	void TestTypedPluginsL(RAuthClient& aClient, TAuthPluginType aPluginType);
       
   238 	void TestTrainedPluginsL();
       
   239 	void PrepareTrainedPluginsL();
       
   240 	void TestActivePluginsL(RAuthClient& aClient);
       
   241 	TBool TestAuthenticateL();
       
   242 	TBool TestMultiAuthL();
       
   243 	
       
   244 private:
       
   245 	RArray<TUid> iPluginIds;
       
   246 	};
       
   247 	
       
   248 class CTStepMgrClient : public CTStepActSch
       
   249 	{
       
   250 public:
       
   251 	CTStepMgrClient();
       
   252 	virtual TVerdict doTestStepL();
       
   253 	TBool TestRegister(AuthServer::RAuthMgrClient& client);
       
   254 	TBool TestMultiRegisterL(AuthServer::RAuthMgrClient& client);
       
   255 	
       
   256 	TBool TestMultiTrainL(AuthServer::RAuthMgrClient& client);
       
   257 	TBool TestTrain(AuthServer::RAuthMgrClient& client);
       
   258 	TBool TestCancellation(AuthServer::RAuthMgrClient& client);
       
   259 	};
       
   260 
       
   261 class CTStepFirstStart : public CTAuthcliservStepBase
       
   262 	{
       
   263 public:
       
   264 	CTStepFirstStart();
       
   265 	virtual TVerdict doTestStepL();
       
   266 	};
       
   267 
       
   268 
       
   269 inline HBufC* CTAuthcliservStepBase::GetNameLC(TInt id)
       
   270     {
       
   271     _LIT(nameTmpl, "Plugin_%d");
       
   272 	HBufC* name = HBufC::NewLC(15);
       
   273 	name->Des().Format(nameTmpl, id);
       
   274 	return name;
       
   275     }
       
   276     
       
   277 inline void CTAuthcliservStepBase::CreatePlugins()
       
   278 	{
       
   279 	using namespace AuthServer;
       
   280 	
       
   281 	const TAuthPluginType   types[KNumPlugins]
       
   282 		= { EAuthBiometric, EAuthToken, EAuthKnowledge,
       
   283 			EAuthBiometric, EAuthToken, EAuthKnowledge,
       
   284 			EAuthToken, EAuthKnowledge
       
   285 		};
       
   286 	const TAuthTrainingStatus   training[KNumPlugins]
       
   287 		= { EAuthUntrained, EAuthTrained, EAuthFullyTrained,
       
   288 			EAuthUntrained, EAuthTrained, EAuthFullyTrained,
       
   289 			EAuthTrained, EAuthFullyTrained
       
   290 		  };
       
   291 
       
   292 
       
   293 	for (TInt i = 0 ; i < KNumPlugins ; ++i)
       
   294 		{
       
   295 			HBufC* name = GetNameLC(i);
       
   296 			
       
   297 			iPlugins[i] = CPluginDesc::NewL(i,
       
   298 											*name,
       
   299 											types[i],
       
   300 											training[i],
       
   301 											i*10000,
       
   302 											i,
       
   303 											i*4);
       
   304 		    CleanupStack::PopAndDestroy(name);									
       
   305 		}
       
   306 	}
       
   307 inline void CTAuthcliservStepBase::CreateKeyInfo()
       
   308 	{
       
   309 	using namespace AuthServer;
       
   310 
       
   311 	CProtectionKey* protKey1 = CProtectionKey::NewLC(8);
       
   312 	CProtectionKey* protKey2 = CProtectionKey::NewLC(8);
       
   313 	CProtectionKey* protKey3 = CProtectionKey::NewLC(8);
       
   314 
       
   315 	HBufC8* data = HBufC8::NewLC(4);
       
   316 	
       
   317 	for (TInt plugin = 0 ; plugin < KNumPlugins ; ++plugin)
       
   318 		{
       
   319 			CTransientKey* transient = 0;
       
   320 			// id 1
       
   321 			iId1Keys[plugin] = CTransientKeyInfo::NewL(plugin);
       
   322 			PluginData(1, plugin, data->Des());
       
   323 			transient = iId1Keys[plugin]->CreateTransientKeyL(data->Des());
       
   324 			CEncryptedProtectionKey* epKey1 =
       
   325 				transient->EncryptL(*protKey1);
       
   326 			delete transient;
       
   327 			iId1Keys[plugin]->SetEncryptedProtectionKeyL(epKey1);
       
   328 			// id 2
       
   329 			PluginData(2, plugin, data->Des());
       
   330 			iId2Keys[plugin] = CTransientKeyInfo::NewL(plugin);
       
   331 			transient = iId2Keys[plugin]->CreateTransientKeyL(data->Des());
       
   332 			CEncryptedProtectionKey* epKey2 =
       
   333 				transient->EncryptL(*protKey2);
       
   334 			delete transient;
       
   335 			iId2Keys[plugin]->SetEncryptedProtectionKeyL(epKey2);
       
   336 			// id 3
       
   337 			PluginData(3, plugin, data->Des());
       
   338 			iId3Keys[plugin] = CTransientKeyInfo::NewL(plugin);
       
   339 			transient = iId3Keys[plugin]->CreateTransientKeyL(data->Des());
       
   340 			CEncryptedProtectionKey* epKey3 =
       
   341 				transient->EncryptL(*protKey3);
       
   342 			delete transient;
       
   343 			iId3Keys[plugin]->SetEncryptedProtectionKeyL(epKey3);
       
   344 		}
       
   345 	CleanupStack::Pop(4, protKey1);
       
   346 	}
       
   347 
       
   348 // -------- Authentication expression tests --------
       
   349 
       
   350 class CTStepAuthExprBuild : public CTAuthcliservStepBase
       
   351 /**
       
   352 	This test step ensures that complex authentication
       
   353 	expressions can be constructed, or fail cleanly in OOM.
       
   354  */
       
   355 	{
       
   356 public:
       
   357 	CTStepAuthExprBuild();
       
   358 	
       
   359 	// implement CTestStep
       
   360 	virtual TVerdict doTestStepL();
       
   361 	
       
   362 private:
       
   363 	void RunTestsL();
       
   364 	void TestExprLD(
       
   365 		void (CTStepAuthExprBuild::*aTestFuncL)(AuthServer::CAuthExpression*),
       
   366 		AuthServer::CAuthExpression* aExpr);
       
   367 
       
   368 #ifdef AUTH_EXPR_BINARY_OPS
       
   369 	inline void OpTestExprLD(
       
   370 		void (CTStepAuthExprBuild::*aTestFuncL)(AuthServer::CAuthExpression*),
       
   371 		AuthServer::CAuthExpression* aExpr)
       
   372 		{
       
   373 		TestExprLD(aTestFuncL, aExpr);
       
   374 		}
       
   375 #else
       
   376 	// this isn't an empty inline because don't want compiler
       
   377 	// to build expression with binary operators.
       
   378 	#define OpTestExprLD(___f, ___expr)
       
   379 #endif
       
   380 
       
   381 	void TestSimpleExprL();
       
   382 	void TestPluginIdL(AuthServer::CAuthExpression* aExpr);
       
   383 	void TestPluginTypeL(AuthServer::CAuthExpression* aExpr);
       
   384 
       
   385 	void TestSimpleExprCombsConsL();
       
   386 	void TestTypeAndTypeL(AuthServer::CAuthExpression* aExpr);
       
   387 	void TestTypeOrTypeL(AuthServer::CAuthExpression* aExpr);
       
   388 	void TestIdAndTypeL(AuthServer::CAuthExpression* aExpr);
       
   389 	void TestTypeAndIdL(AuthServer::CAuthExpression* aExpr);
       
   390 	void TestIdAndIdL(AuthServer::CAuthExpression* aExpr);
       
   391 
       
   392 	void TestComplexExprCombsConsL();
       
   393 	void TestAndAndL(AuthServer::CAuthExpression* aExpr);
       
   394 	void TestAndOrL(AuthServer::CAuthExpression* aExpr);
       
   395 	void TestOrAndL(AuthServer::CAuthExpression* aExpr);
       
   396 	void TestOrOrL(AuthServer::CAuthExpression* aExpr);
       
   397 
       
   398 	void TestFailedCombsL();
       
   399 	void TestCorruptPersistL();
       
   400 	};
       
   401 
       
   402 class CTStepAuthExprTypePnc : public CTAuthcliservStepBase
       
   403 /**
       
   404 	This test step ensures the client is panicked when
       
   405 	they attempt to retrieve the type of a corrupt expression.
       
   406  */
       
   407 	{
       
   408 public:
       
   409 	CTStepAuthExprTypePnc();
       
   410 	
       
   411 	// implement CTestStep
       
   412 	virtual TVerdict doTestStepL();
       
   413 	};
       
   414 
       
   415 class CTStepAuthExprTypePncBadLeft : public CTAuthcliservStepBase
       
   416 /**
       
   417 	This test step ensures the client is panicked when
       
   418 	they attempt to retrieve the type of a expression,
       
   419 	where the left subtree is corrupt.
       
   420  */
       
   421 	{
       
   422 public:
       
   423 	CTStepAuthExprTypePncBadLeft();
       
   424 	
       
   425 	// implement CTestStep
       
   426 	virtual TVerdict doTestStepL();
       
   427 	};
       
   428 
       
   429 class CTStepAuthExprTypePncBadRight : public CTAuthcliservStepBase
       
   430 /**
       
   431 	This test step ensures the client is panicked when
       
   432 	they attempt to retrieve the type of a expression,
       
   433 	where the right subtree is corrupt.
       
   434  */
       
   435 	{
       
   436 public:
       
   437 	CTStepAuthExprTypePncBadRight();
       
   438 	
       
   439 	// implement CTestStep
       
   440 	virtual TVerdict doTestStepL();
       
   441 	};
       
   442 
       
   443 class CTStepAuthExprHighVer : public CTAuthcliservStepBase
       
   444 /**
       
   445 	This step tests sending an unsupported authentication
       
   446 	expression to the server.
       
   447 	
       
   448 	The server should fail the request.
       
   449  */
       
   450 	{
       
   451 public:
       
   452 	CTStepAuthExprHighVer();
       
   453 	
       
   454 	// implement CTestStep
       
   455 	virtual TVerdict doTestStepL();
       
   456 	};
       
   457 	
       
   458 class CTStepBadExtAuthExpr : public CTAuthcliservStepBase
       
   459 /**
       
   460 	This step tests trying to authenticate a server with
       
   461 	an invalid authentication expression.
       
   462 	
       
   463 	The client code should be panicked.
       
   464  */
       
   465 	{
       
   466 public:
       
   467 	CTStepBadExtAuthExpr();
       
   468 	
       
   469 	// implement CTestStep
       
   470 	virtual TVerdict doTestStepL();
       
   471 	};
       
   472 	
       
   473 
       
   474 class TTestPluginInterface : public AuthServer::MEvaluatorPluginInterface
       
   475 /**
       
   476 	This implementation records which calls were made
       
   477 	to the interface, so the test code can test the
       
   478 	evaluator made the right calls in the right order.
       
   479  */
       
   480 	{
       
   481 public:
       
   482 	virtual void Evaluate(TPluginId aPluginId, TIdentityId& aIdentity,
       
   483 			   CAuthExpressionImpl::TType aType, TRequestStatus& aStatus);
       
   484 	virtual void Evaluate(TAuthPluginType aPluginType, TIdentityId& aIdentity,
       
   485 			   CAuthExpressionImpl::TType aType, TRequestStatus& aStatus);
       
   486 	virtual void CancelEvaluate() {} ;
       
   487 public:
       
   488 	class TCallEntry
       
   489 		{
       
   490 	public:
       
   491 		inline TCallEntry(TPluginId aPluginId)
       
   492 		:	iCallType(CAuthExpressionImpl::EPluginId),
       
   493 			iPluginId(aPluginId)
       
   494 			{
       
   495 			// empty.
       
   496 			}
       
   497 		
       
   498 		inline TCallEntry(TAuthPluginType aPluginType)
       
   499 		:	iCallType(CAuthExpressionImpl::EPluginType),
       
   500 			iPluginType(aPluginType)
       
   501 			{
       
   502 			// empty.
       
   503 			}
       
   504 		
       
   505 		bool operator==(const TCallEntry& aRhs) const;
       
   506 		
       
   507 	public:
       
   508 		/** Type of call - ID or plugin type. */
       
   509 		CAuthExpressionImpl::TType iCallType;
       
   510 		
       
   511 		union
       
   512 			{
       
   513 			TPluginId iPluginId;
       
   514 			TAuthPluginType iPluginType;
       
   515 			};
       
   516 		};
       
   517 
       
   518 	/**
       
   519 		The sequence of Evaluate requests which have been received
       
   520 		by this object.  This is a non-standard case of a T class
       
   521 		owning resources.  These resources are freed by CLaunchEval
       
   522 		because it is not worth making this an R-class or C-class
       
   523 		for test code.
       
   524 	 */
       
   525 	RArray<TCallEntry> iCallLog;
       
   526 	};
       
   527 
       
   528 class TTestClientInterface : public AuthServer::MEvaluatorClientInterface
       
   529 /**
       
   530 	This implementation records whether the evaluation
       
   531 	succeeded or failed, so the test code can check the
       
   532 	result.
       
   533  */
       
   534 	{
       
   535 public:
       
   536 	virtual void EvaluationSucceeded(TIdentityId aIdentityId);
       
   537 	virtual void EvaluationFailed(TInt aReason);
       
   538 	
       
   539 public:
       
   540 	enum TCompletionMode {ENone = 0x10, ESucceeded, EFailed};
       
   541 	TCompletionMode iMode;
       
   542 	/** This is valid iff iMode == ESucceeded. */
       
   543 	TIdentityId iIdentityId;
       
   544 	/** This is valid iff iMode == EFailed. */
       
   545 	TInt iReason;
       
   546 	};
       
   547 
       
   548 
       
   549 class CLaunchEval : public CActive
       
   550 /**
       
   551 	Active object which launches an evaluation.
       
   552 	
       
   553 	This object is defined so there is one pending
       
   554 	object when the active scheduler is started.
       
   555  */
       
   556 	{
       
   557 public:
       
   558 	static CLaunchEval* NewL();
       
   559 	virtual ~CLaunchEval();
       
   560 	
       
   561 	void Evaluate(const CAuthExpression* aExpr);
       
   562 	
       
   563 private:
       
   564 	CLaunchEval();
       
   565 	void ConstructL();
       
   566 	void ResetInterfaces();
       
   567 
       
   568 	// implement CActive
       
   569 	virtual void RunL();
       
   570 	virtual void DoCancel();
       
   571 
       
   572 public:	
       
   573 	TTestClientInterface iClientInterface;
       
   574 	TTestPluginInterface iPluginInterface;
       
   575 	
       
   576 private:
       
   577 	/**
       
   578 		Expression to evaluate.  This is set for each
       
   579 		call to Evaluate.
       
   580 	 */
       
   581 	const CAuthExpression* iExpr;
       
   582 	
       
   583 	/** Evaluator, which is allocated at construction. */
       
   584 	CEvaluator* iEval;
       
   585 	};
       
   586 
       
   587 
       
   588 class CTStepAuthExprEval : public CTStepActSch
       
   589 /**
       
   590 	This step tests trying to authenticate a server with
       
   591 	an invalid authentication expression.
       
   592 	
       
   593 	The client code should be panicked.
       
   594  */
       
   595 	{
       
   596 public:
       
   597 	CTStepAuthExprEval();
       
   598 	
       
   599 	// implement CTestStep
       
   600 	virtual TVerdict doTestStepL();
       
   601 	
       
   602 private:
       
   603 	void TestEvalCreateL();
       
   604 	void TestEvalSimpleL();
       
   605 	void TestEvalAndL();
       
   606 	void TestEvalOrL();
       
   607 	void TestEvalResultL(
       
   608 		CLaunchEval* aLaunchEval, TIdentityId aIdentityId,
       
   609 		const TTestPluginInterface::TCallEntry* aExpEntries, TInt aEntryCount);
       
   610 	
       
   611 	void TestRPNReallocL();
       
   612 	void RunOomTestsL(
       
   613 		TAuthExpressionWrapper (*aAllocator)(TInt),
       
   614 		TIdentityId aExpectedIdentity, TInt aInitDepth);
       
   615 	};
       
   616 	
       
   617 const TPluginId KTestPluginId0 = 'PID0';
       
   618 const TPluginId KTestPluginId1 = 'PID1';
       
   619 const TPluginId KTestPluginId2 = 'PID2';
       
   620 const TPluginId KTestPluginUnknown = 'UNKW';
       
   621 
       
   622 // These constants are defined to provide short
       
   623 // names for readability only.
       
   624 
       
   625 const CAuthExpressionImpl::TType KAnd = CAuthExpressionImpl::EAnd;
       
   626 const CAuthExpressionImpl::TType KOr = CAuthExpressionImpl::EOr;
       
   627 const CAuthExpressionImpl::TType KPluginId = CAuthExpressionImpl::EPluginId;
       
   628 const CAuthExpressionImpl::TType KPluginType = CAuthExpressionImpl::EPluginType;
       
   629 #endif	/* TAUTHCLISERVSTEP_H */