commsconfig/commsdatabaseshim/ts_commdb/Step_021_xx.cpp
changeset 72 ae47d0499bee
parent 68 5da8188e392b
child 77 c9776eadbffd
equal deleted inserted replaced
68:5da8188e392b 72:ae47d0499bee
     1 // Copyright (c) 2001-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 // This contains CommDb Unit Test Cases 021.XX
       
    15 // 
       
    16 //
       
    17 
       
    18 // EPOC includes
       
    19 #include <e32base.h>
       
    20 #include <commdb.h>
       
    21 #include <d32comm.h>
       
    22 
       
    23 // Test system includes
       
    24 #include <networking/log.h>
       
    25 #include <networking/teststep.h>
       
    26 #include "Teststepcommdb.h"
       
    27 #include "TestSuiteCommdb.h"
       
    28 #include "Step_021_xx.h"
       
    29 
       
    30 
       
    31 //
       
    32 //	Test step 021.01
       
    33 //
       
    34 
       
    35 // constructor
       
    36 CCommDbTest021_01::CCommDbTest021_01()
       
    37 	{
       
    38 	// store the name of this test case
       
    39 	iTestStepName = _L("step_021_01");
       
    40 	}
       
    41 
       
    42 // destructor
       
    43 CCommDbTest021_01::~CCommDbTest021_01()
       
    44 	{
       
    45 	}
       
    46 
       
    47 
       
    48 TVerdict CCommDbTest021_01::doTestStepPreambleL()
       
    49 	{
       
    50 	// Have a temp copy of database
       
    51 	openDbL();
       
    52 	return EPass;
       
    53 	}
       
    54 
       
    55 TInt CCommDbTest021_01::executeStepL()
       
    56 	{
       
    57 	TInt ret=KErrGeneral;
       
    58 
       
    59 	//Sets and verifies the client timeout
       
    60 
       
    61 	//Set up the agent first
       
    62 	_LIT(KAgent1,"Agent1");
       
    63 	_LIT(KAgentExt,"Csd");
       
    64 	TRAPD(r1,iTheDb->SetAgentL(TPtrC(DIAL_OUT_ISP),KAgent1));
       
    65 	TRAPD(r2,iTheDb->SetAgentExtL(TPtrC(DIAL_OUT_ISP),KAgentExt));
       
    66 
       
    67 	TUint timeout = 6;
       
    68 	TInt value(0);
       
    69 
       
    70 	TRAPD(r3,iTheDb->SetAgentClientTimeoutL(TPtrC(DIAL_OUT_ISP),timeout));
       
    71 	TRAPD(r4,value = iTheDb->GetAgentClientTimeoutL(TPtrC(DIAL_OUT_ISP)));
       
    72 
       
    73 	if(r1==KErrNotSupported && r2==KErrNotSupported && r3==KErrNotSupported
       
    74 		&& (r4==KErrNotSupported || value==KErrNotSupported))
       
    75 		{
       
    76 		return KErrNotSupported;
       
    77 		}
       
    78 	
       
    79 	return ret;
       
    80 	}
       
    81 
       
    82 
       
    83 
       
    84 TVerdict CCommDbTest021_01::doTestStepL( )
       
    85 	{
       
    86 	Log(_L("Step 021.01 called "));
       
    87 
       
    88 
       
    89 	if ( executeStepL() == KErrNotSupported )
       
    90 		iTestStepResult = EPass;
       
    91 	else
       
    92 		iTestStepResult = EFail;
       
    93 
       
    94 	return iTestStepResult;
       
    95 	}
       
    96 
       
    97 
       
    98 //
       
    99 //	Test step 021.02
       
   100 //
       
   101 
       
   102 // constructor
       
   103 CCommDbTest021_02::CCommDbTest021_02()
       
   104 	{
       
   105 	// store the name of this test case
       
   106 	iTestStepName = _L("step_021_02");
       
   107 	}
       
   108 
       
   109 // destructor
       
   110 CCommDbTest021_02::~CCommDbTest021_02()
       
   111 	{
       
   112 	}
       
   113 
       
   114 
       
   115 TVerdict CCommDbTest021_02::doTestStepPreambleL()
       
   116 	{	
       
   117 	openDbL();
       
   118 	return EPass;
       
   119 	}
       
   120 
       
   121 TInt CCommDbTest021_02::executeStepL()
       
   122 	{
       
   123 	TInt ret=KErrGeneral;
       
   124 
       
   125 	//Try to set the timeout for an incorrect table
       
   126 
       
   127 	//Set up the agent first
       
   128 	_LIT(KAgent1,"Agent1");
       
   129 	_LIT(KAgentExt,"Csd");
       
   130 	TRAPD(r1,iTheDb->SetAgentL(TPtrC(DIAL_OUT_ISP),KAgent1));
       
   131 	TRAPD(r2,iTheDb->SetAgentExtL(TPtrC(DIAL_OUT_ISP),KAgentExt));
       
   132 
       
   133 	TUint timeout = 0x100;
       
   134 	TRAPD(r3, iTheDb->SetAgentClientTimeoutL(TPtrC(LOCATION), timeout));
       
   135 
       
   136 	if(r1==KErrNotSupported && r2==KErrNotSupported && r3==KErrNotSupported)
       
   137 		{
       
   138 		return KErrNotSupported;
       
   139 		}
       
   140 		
       
   141 	return ret;
       
   142 	}
       
   143 
       
   144 
       
   145 
       
   146 TVerdict CCommDbTest021_02::doTestStepL( )
       
   147 	{
       
   148 	Log(_L("Step 021.02 called "));
       
   149 
       
   150 
       
   151 	if ( executeStepL() == KErrNotSupported )
       
   152 		iTestStepResult = EPass;
       
   153 	else
       
   154 		iTestStepResult = EFail;
       
   155 
       
   156 	return iTestStepResult;
       
   157 	}
       
   158 
       
   159 //
       
   160 //	Test step 021.03
       
   161 //
       
   162 
       
   163 // constructor
       
   164 CCommDbTest021_03::CCommDbTest021_03()
       
   165 	{
       
   166 	// store the name of this test case
       
   167 	iTestStepName = _L("step_021_03");
       
   168 	}
       
   169 
       
   170 // destructor
       
   171 CCommDbTest021_03::~CCommDbTest021_03()
       
   172 	{
       
   173 	}
       
   174 
       
   175 
       
   176 TVerdict CCommDbTest021_03::doTestStepPreambleL()
       
   177 	{	
       
   178 	openDbL();
       
   179 	return EPass;
       
   180 	}
       
   181 
       
   182 TInt CCommDbTest021_03::executeStepL()
       
   183 	{
       
   184 	TInt ret=KErrGeneral;
       
   185 
       
   186 	//Sets and verifies the routet timeout
       
   187 
       
   188 	//Set up the agent first
       
   189 	_LIT(KAgent1,"Agent1");
       
   190 	_LIT(KAgentExt,"Csd");
       
   191 	TRAPD(r1,iTheDb->SetAgentL(TPtrC(DIAL_OUT_ISP),KAgent1));
       
   192 	TRAPD(r2,iTheDb->SetAgentExtL(TPtrC(DIAL_OUT_ISP),KAgentExt));
       
   193 
       
   194 	TUint timeout = 0x100;
       
   195 	TInt value(0);
       
   196 
       
   197 	TRAPD(r3,iTheDb->SetAgentRouteTimeoutL(TPtrC(DIAL_OUT_ISP),timeout));
       
   198 	TRAPD(r4,value = iTheDb->GetAgentRouteTimeoutL(TPtrC(DIAL_OUT_ISP)));
       
   199 
       
   200 	if(r1==KErrNotSupported && r2==KErrNotSupported && r3==KErrNotSupported
       
   201 		&& (r4==KErrNotSupported || value==KErrNotSupported))
       
   202 		{
       
   203 		return KErrNotSupported;
       
   204 		}
       
   205 	
       
   206 	return ret;
       
   207 	}
       
   208 
       
   209 
       
   210 
       
   211 TVerdict CCommDbTest021_03::doTestStepL( )
       
   212 	{
       
   213 	Log(_L("Step 021.03 called "));
       
   214 
       
   215 
       
   216 	if ( executeStepL() == KErrNotSupported )
       
   217 		iTestStepResult = EPass;
       
   218 	else
       
   219 		iTestStepResult = EFail;
       
   220 
       
   221 	return iTestStepResult;
       
   222 	}
       
   223 
       
   224 
       
   225 //
       
   226 //	Test step 021.04
       
   227 //
       
   228 
       
   229 // constructor
       
   230 CCommDbTest021_04::CCommDbTest021_04()
       
   231 	{
       
   232 	// store the name of this test case
       
   233 	iTestStepName = _L("step_021_04");
       
   234 	}
       
   235 
       
   236 // destructor
       
   237 CCommDbTest021_04::~CCommDbTest021_04()
       
   238 	{
       
   239 	}
       
   240 
       
   241 
       
   242 TVerdict CCommDbTest021_04::doTestStepPreambleL()
       
   243 	{	
       
   244 	openDbL();
       
   245 	return EPass;
       
   246 	}
       
   247 
       
   248 TInt CCommDbTest021_04::executeStepL()
       
   249 	{
       
   250 	TInt ret=KErrGeneral;
       
   251 
       
   252 	//Try to set the timeout for an incorrect table
       
   253 
       
   254 	//Set up the agent first
       
   255 	_LIT(KAgent1,"Agent1");
       
   256 	_LIT(KAgentExt,"Csd");
       
   257 	TRAPD(r1,iTheDb->SetAgentL(TPtrC(DIAL_OUT_ISP),KAgent1));
       
   258 	TRAPD(r2,iTheDb->SetAgentExtL(TPtrC(DIAL_OUT_ISP),KAgentExt));
       
   259 
       
   260 	TUint timeout = 0x100;
       
   261 	
       
   262 	TRAPD(r3, iTheDb->SetAgentRouteTimeoutL(TPtrC(LOCATION), timeout) );
       
   263 
       
   264 	if(r1==KErrNotSupported && r2==KErrNotSupported && r3==KErrNotSupported)
       
   265 		{
       
   266 		return KErrNotSupported;
       
   267 		}
       
   268 	
       
   269 	return ret;
       
   270 	}
       
   271 
       
   272 
       
   273 
       
   274 TVerdict CCommDbTest021_04::doTestStepL( )
       
   275 	{
       
   276 	Log(_L("Step 021.04 called "));
       
   277 
       
   278 
       
   279 	if ( executeStepL() == KErrNotSupported )
       
   280 		iTestStepResult = EPass;
       
   281 	else
       
   282 		iTestStepResult = EFail;
       
   283 
       
   284 	return iTestStepResult;
       
   285 	}
       
   286 
       
   287 
       
   288 
       
   289 
       
   290 //
       
   291 //	Test step 021.05
       
   292 //
       
   293 
       
   294 // constructor
       
   295 CCommDbTest021_05::CCommDbTest021_05()
       
   296 	{
       
   297 	// store the name of this test case
       
   298 	iTestStepName = _L("step_021_05");
       
   299 	}
       
   300 
       
   301 // destructor
       
   302 CCommDbTest021_05::~CCommDbTest021_05()
       
   303 	{
       
   304 	}
       
   305 
       
   306 TVerdict CCommDbTest021_05::doTestStepL( )
       
   307 	{
       
   308 	Log(_L("Step 021.05 called "));
       
   309 
       
   310 	iTestStepResult = EPass;
       
   311 
       
   312 		// Heap test for 021.01
       
   313 
       
   314 	CCommDbTest021_01* step021_01 = new(ELeave) CCommDbTest021_01;
       
   315 	CleanupStack::PushL(step021_01);
       
   316 	step021_01->iSuite = iSuite;
       
   317 	if ( doTestStepWithHeapFailureL( *step021_01, KErrNotSupported) == EFail )
       
   318 		iTestStepResult = EFail;
       
   319 	CleanupStack::PopAndDestroy(step021_01);
       
   320 
       
   321 
       
   322 		// Heap test for 021.02
       
   323 
       
   324 	CCommDbTest021_02* step021_02 = new CCommDbTest021_02;
       
   325 	CleanupStack::PushL(step021_02);
       
   326 	step021_02->iSuite = iSuite;
       
   327 	if ( doTestStepWithHeapFailureL( *step021_02, KErrNotSupported) == EFail )
       
   328 		iTestStepResult = EFail;
       
   329 	CleanupStack::PopAndDestroy(step021_02);
       
   330 
       
   331 		// Heap test for 021.03
       
   332 
       
   333 	CCommDbTest021_03* step021_03 = new CCommDbTest021_03;
       
   334 	CleanupStack::PushL(step021_03);
       
   335 	step021_03->iSuite = iSuite;
       
   336 	if ( doTestStepWithHeapFailureL( *step021_03, KErrNotSupported) == EFail )
       
   337 		iTestStepResult = EFail;
       
   338 	CleanupStack::PopAndDestroy(step021_03);
       
   339 
       
   340 
       
   341 		// Heap test for 021.04
       
   342 
       
   343 	CCommDbTest021_04* step021_04 = new CCommDbTest021_04;
       
   344 	CleanupStack::PushL(step021_04);
       
   345 	step021_04->iSuite = iSuite;
       
   346 	if ( doTestStepWithHeapFailureL( *step021_04, KErrNotSupported) == EFail )
       
   347 		iTestStepResult = EFail;
       
   348 	CleanupStack::PopAndDestroy(step021_04);
       
   349 
       
   350 
       
   351 
       
   352 	return iTestStepResult;	
       
   353 
       
   354 }