authenticationservices/authenticationserver/test/tAuthSvr/src/step_EnumIdenties.cpp
changeset 102 deec7e509f66
parent 94 0e6c5a9328b5
child 108 ca9a0fc2f082
equal deleted inserted replaced
94:0e6c5a9328b5 102:deec7e509f66
     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 * CTestStep derived implementation
       
    16 *
       
    17 */
       
    18 
       
    19  
       
    20 #include "tAuthSvrStep.h"
       
    21 //#include <testexecutelog.h>
       
    22 
       
    23 #include "authserver/authclient.h"
       
    24 #include "authserver/authmgrclient.h"
       
    25 #include "authserver/identity.h"
       
    26 
       
    27 //using namespace AuthServer;
       
    28 
       
    29 CTEnumIdentities::CTEnumIdentities(CTAuthSvrServer& aParent): iParent(aParent)
       
    30 /**
       
    31  * Constructor
       
    32  */
       
    33 	{
       
    34 	// Call base class method to set up the human readable name for logging
       
    35 	SetTestStepName(KTEnumIdentities);
       
    36 	}
       
    37 
       
    38 
       
    39 TVerdict CTRegIdentity::doTestStepL()
       
    40 /**
       
    41  * @return - TVerdict code
       
    42  * Override of base class pure virtual
       
    43  * 
       
    44  */
       
    45 	{	
       
    46 	INFO_PRINTF1(_L("In EnumIdentities Step"));
       
    47 	SetTestStepResult(EPass);
       
    48 	
       
    49 	//If any test step leaves or panics, the test step thread exits and no further calls are made. 
       
    50 	if (TestStepResult() != EPass)
       
    51 		{
       
    52 		return TestStepResult();
       
    53 		}
       
    54 
       
    55 __UHEAP_MARK;		// Check for memory leaks
       
    56 
       
    57 	InitAuthServerFromFile();
       
    58 	AuthServer::RAuthMgrClient client4 = (iParent.Cl());	//This is an R class, so the copy constructor provides the actual handle
       
    59 		
       
    60 	//User::LeaveIfError(iParent.Cl().Connect());	
       
    61 	//CleanupClosePushL(iParent.Cl());
       
    62 	User::LeaveIfError(client4.Connect());	
       
    63 	CleanupClosePushL(client4);
       
    64 	
       
    65 	//Call the Enumerate Identities API
       
    66 	AuthServer::RIdentityIdArray idArray;	//Initialisation
       
    67 	iParent.Cl().IdentitiesL(idArray);
       
    68 	
       
    69 	
       
    70 	//AuthServer::CIdentity aIdentity1 = new (ELeave) AuthServer::CIdentity(AuthServer::KUnknown, 0);
       
    71 	
       
    72 	TUint32 id1 = 0;
       
    73 	AuthServer::CProtectionKey *key1 (AuthServer::CProtectionKey::NewL(8));
       
    74 		
       
    75  	AuthServer::CIdentity *aIdentity1 = new AuthServer::CIdentity(id1, key1);
       
    76  	TRequestStatus reqStatus = KRequestPending;	//for async calls
       
    77 	
       
    78 	TRAPD(err, iParent.Cl().RegisterIdentity(*aIdentity1, reqStatus));
       
    79 		
       
    80 	User::WaitForRequest(reqStatus); //delay
       
    81 	//Check reqStatus
       
    82 	if (reqStatus.Int() == KErrNone)	//The request completed ok
       
    83 		{					
       
    84 		INFO_PRINTF2(_L("Request completed ok. reqStatus = %d"), reqStatus.Int());
       
    85 		SetTestStepResult(EPass);
       
    86 		}
       
    87 	else 	// The request failed
       
    88 		{					
       
    89 		INFO_PRINTF2(_L("Request failed. reqStatus = %d"), reqStatus.Int());
       
    90 		SetTestStepResult(EFail);
       
    91 		}
       
    92 	
       
    93 	//CleanupStack::PopAndDestroy(&(iParent.Cl());
       
    94 	CleanupStack::PopAndDestroy(&client4);
       
    95 	
       
    96 __UHEAP_MARKEND;
       
    97 	return TestStepResult();	
       
    98 	}