networksecurity/ipsec/ipsec_itest/src/ts_ipsec_suite.cpp
changeset 0 af10295192d8
child 71 a800ea6cb454
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file ts_ipsec_suite.cpp implements the IPsec test suite
       
    18 */
       
    19 #include <c32root.h>
       
    20 
       
    21 #include <networking/log.h>
       
    22 #include <networking/teststep.h>
       
    23 #include <networking/testsuite.h>
       
    24 //#include "ts_ipsec_main.h"
       
    25 //#include "ts_ipsec_main2.h"
       
    26 //#include "ts_ipsec_main3.h"
       
    27 //#include "ts_ipsec_main4.h"
       
    28 //#include "ts_ipsec_step.h"
       
    29 #include "ts_ipsec_suite.h"
       
    30 
       
    31 #include "ts_ipsec_crypto.h"
       
    32 #include "ts_ipsec_polapi.h"
       
    33 #include "ts_ipsec_vpnapi.h"
       
    34 #include "ts_ipsec_rconn.h"
       
    35 
       
    36 #ifndef EKA2
       
    37 GLDEF_C TInt E32Dll(enum TDllReason)
       
    38 /**
       
    39  * required for all DLLs but not used
       
    40  */
       
    41 	{
       
    42 	return KErrNone;
       
    43 	}
       
    44 #endif // EKA2
       
    45 
       
    46 EXPORT_C CTestSuiteIpsec* NewTestSuiteIpsecL()
       
    47 /**
       
    48  * this function is exported at ordinal 1.
       
    49  * it provides the interface to allow schedule test
       
    50  * to create instances of this test suite
       
    51  *
       
    52  * @return pointer to newly created CTestSuiteIpsec object
       
    53  */
       
    54     { 
       
    55 	return new (ELeave) CTestSuiteIpsec;
       
    56     }
       
    57 
       
    58 
       
    59 void CTestSuiteIpsec::AddThisTestStepL(CTestStep* aPtrTestStep)
       
    60 /**
       
    61  * Add a test step into the suite
       
    62  */
       
    63 	{
       
    64 	// add the step using tyhe base class method
       
    65 	AddTestStepL(aPtrTestStep);
       
    66 	}
       
    67 
       
    68 
       
    69 void CTestSuiteIpsec::InitialiseL( void )
       
    70 /**
       
    71  * constructor for IPSec test suite
       
    72  * this creates all the IPSec test steps and
       
    73  * stores them inside CTestSuiteEsock
       
    74  */
       
    75 	{
       
    76 	// Start the Comms Process, but avoid loading the Phonebook Synchronizer
       
    77 	_LIT(KPhbkSyncCMI, "phbsync.cmi");
       
    78 	TInt err=StartC32WithCMISuppressions(KPhbkSyncCMI);
       
    79 	User::LeaveIfError(err);
       
    80 
       
    81 	// section 1.x
       
    82 //	AddThisTestStepL( new (ELeave) CIpsecTest1_1 );
       
    83 
       
    84 	// section 2.x
       
    85 //	AddThisTestStepL( new (ELeave) CIpsecTest2_1 );
       
    86 
       
    87 	// section 3.x
       
    88 //	AddThisTestStepL( new (ELeave) CIpsecTest3_1 );
       
    89 //	AddThisTestStepL( new (ELeave) CIpsecTest3_3 );
       
    90 //	AddThisTestStepL( new (ELeave) CIpsecTest3_4 );
       
    91 //	AddThisTestStepL( new (ELeave) CIpsecTest3_5 );
       
    92 //	AddThisTestStepL( new (ELeave) CIpsecTest3_6 );
       
    93 
       
    94 	// section 4.x
       
    95 //	AddThisTestStepL( new (ELeave) CIpsecTest4_1 );
       
    96 
       
    97 	// Start the active scheduler before doing this
       
    98 	
       
    99 	iScheduler = new(ELeave) CTestScheduler;
       
   100 
       
   101 	// Section 5 - ipsecpolapi tests
       
   102 	AddThisTestStepL( new (ELeave) CIpsecPolTest_1(iScheduler) );
       
   103 	AddThisTestStepL( new (ELeave) CIpsecPolTest_2(iScheduler) );
       
   104 
       
   105 	// Section 6 - vpnapi tests
       
   106 	AddThisTestStepL( new (ELeave) CIpsecVpnTest_1(iScheduler) );
       
   107 
       
   108 	// Section 7 - Ipsec Connection tests
       
   109 	AddThisTestStepL( new (ELeave) CIpsecConnTest_1(iScheduler) );
       
   110 	AddThisTestStepL( new (ELeave) CIpsecConnTest_2(iScheduler) );
       
   111 	AddThisTestStepL( new (ELeave) CIpsecConnTest_3(iScheduler) );
       
   112 	AddThisTestStepL( new (ELeave) CIpsecConnTest_4(iScheduler) ); // IPSec plug-in removed
       
   113 	AddThisTestStepL( new (ELeave) CIpsecTestCypto() );
       
   114 	}
       
   115 
       
   116 CTestSuiteIpsec::~CTestSuiteIpsec()
       
   117 	{
       
   118 	// Get rid of the AS if present
       
   119 	if (iScheduler)
       
   120 		delete iScheduler;
       
   121 	
       
   122 	}
       
   123 
       
   124 TInt CTestSuiteIpsec::HandleCompletion(TAny* aArgs)
       
   125 	{
       
   126 	TCallbackArgs* args = (TCallbackArgs*)aArgs;
       
   127 	((CTestScheduler*)(CActiveScheduler::Current()))->SetResult(args);
       
   128 	return KErrNone;
       
   129 	}
       
   130 /*
       
   131 void CTestSuiteIpsec::Log( TRefByValue<const TDesC16> format, ... ) 
       
   132 		{
       
   133 		VA_LIST aList;
       
   134 		VA_START( aList, format );
       
   135 
       
   136 		TBuf <MAX_LOG_LINE_LENGTH> LineBuf;
       
   137 		TestLog16Overflow iOverflow16;
       
   138 
       
   139 		LineBuf.AppendFormatList( format, aList, &iOverflow16 );
       
   140 
       
   141 		CTestSuite::Log(_L("%S"),&LineBuf);
       
   142 		VA_END( aList );
       
   143 		}
       
   144 */