authenticationservices/authenticationserver/test/tauthcliserv/step_firststart.cpp
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 #include "tauthcliservstep.h"
       
    20 #include <test/testexecutelog.h>
       
    21 
       
    22 #include "authserver/authmgrclient.h"
       
    23 #include "authserver/identity.h"
       
    24 
       
    25 #include <s32file.h>
       
    26 
       
    27 using namespace AuthServer;
       
    28 
       
    29 CTStepFirstStart::CTStepFirstStart()
       
    30 	{
       
    31 	SetTestStepName(KTStepFirstStart);
       
    32 	}
       
    33 
       
    34 TVerdict CTStepFirstStart::doTestStepL()
       
    35 	{
       
    36 	if (TestStepResult() != EPass)
       
    37 		{
       
    38 		INFO_PRINTF1(_L("Previous step failed"));
       
    39 
       
    40 		return TestStepResult();
       
    41 		}
       
    42 __UHEAP_MARK;		// Check for memory leaks
       
    43     SetTestStepResult(EFail);
       
    44     
       
    45 	TBool res = ETrue;
       
    46 	TBool tmp = ETrue;
       
    47 	TInt  err = KErrNone;
       
    48 
       
    49  	User::SetJustInTime(ETrue);
       
    50 
       
    51     TRAP(err, RemoveExistingDbL());
       
    52     
       
    53 	RAuthClient client;
       
    54 	err = client.Connect();
       
    55 	CleanupClosePushL(client);
       
    56 
       
    57     TEST(tmp = (err == KErrNone));
       
    58     res = tmp && res;
       
    59     INFO_PRINTF2(_L("Connect result = %d"), err);
       
    60     
       
    61 	RIdentityIdArray ids;
       
    62 	client.IdentitiesL(ids); 
       
    63 	
       
    64 	TEST(tmp = ids.Count() == 1);
       
    65     res = tmp && res;
       
    66 
       
    67 	HBufC* str = client.IdentityStringL(ids[0]);
       
    68 	CleanupStack::PushL(str);
       
    69 	
       
    70 	ids.Close();
       
    71 	
       
    72 	SetTestStepResult(res ? EPass : EFail);
       
    73 
       
    74 	CleanupStack::PopAndDestroy(2, &client);
       
    75 __UHEAP_MARKEND;	
       
    76 	return TestStepResult();
       
    77 	}
       
    78