commsconfig/commsdatabaseshim/TE_commdb/src/Step_033_xx.cpp
changeset 72 ae47d0499bee
equal deleted inserted replaced
68:5da8188e392b 72:ae47d0499bee
       
     1 //
       
     2 // Copyright (c) 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 "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 // This contains CommDb Unit Test Cases 033.XX
       
    19 
       
    20 // EPOC includes
       
    21 #include <e32base.h>
       
    22 #include <commdb.h>
       
    23 #include <d32comm.h>
       
    24 
       
    25 // Test system includes
       
    26 #include "Teststepcommdb.h"
       
    27 #include "Step_033_xx.h"
       
    28 
       
    29 
       
    30 CCommDbTest033_01::CCommDbTest033_01()
       
    31 	{
       
    32 	// store the name of this test case
       
    33 	SetTestStepName(_L("step_033_01"));
       
    34 	}
       
    35 
       
    36 CCommDbTest033_01::~CCommDbTest033_01()
       
    37 	{}
       
    38 
       
    39 TVerdict CCommDbTest033_01::doTestStepL( void )
       
    40 	{
       
    41 	if(executeStepL()!=KErrNone)
       
    42          SetTestStepResult(EFail);        SetTestStepResult(EPass);	return TestStepResult();	//If we've got this far we've passed
       
    43 	}
       
    44 
       
    45 TVerdict CCommDbTest033_01::doTestStepPreambleL()
       
    46 	{
       
    47 	iTheDb=CCommsDatabase::NewL();
       
    48 
       
    49 	iPrefView = iTheDb->OpenConnectionPrefTableLC();
       
    50 	CleanupStack::Pop();
       
    51 
       
    52         SetTestStepResult(EPass);	return TestStepResult();
       
    53 	}
       
    54 
       
    55 TInt CCommDbTest033_01::executeStepL()
       
    56 	{
       
    57 	CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref1;
       
    58 	pref1.iRanking = 1;
       
    59 	pref1.iDirection = ECommDbConnectionDirectionOutgoing;
       
    60 	pref1.iDialogPref = ECommDbDialogPrefPrompt;
       
    61 	pref1.iBearer.iBearerSet = KCommDbBearerCSD;
       
    62 	pref1.iBearer.iIapId = 1;
       
    63 
       
    64 	iPrefView->InsertConnectionPreferenceL(pref1, EFalse);
       
    65 
       
    66 	CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref2;
       
    67 	pref2.iRanking = 2;
       
    68 	pref2.iDirection = ECommDbConnectionDirectionOutgoing;
       
    69 	pref2.iDialogPref = ECommDbDialogPrefPrompt;
       
    70 	pref2.iBearer.iBearerSet = KCommDbBearerCSD;
       
    71 	pref2.iBearer.iIapId = 2;
       
    72 	
       
    73 	iPrefView->InsertConnectionPreferenceL(pref2, EFalse);
       
    74 
       
    75 	iPrefView->SwapConnectionPreferencesL(ECommDbConnectionDirectionOutgoing, 1, 2);
       
    76 
       
    77 	User::LeaveIfError(iPrefView->GotoFirstRecord());
       
    78 
       
    79 	CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref retrievedPref;
       
    80 	iPrefView->ReadConnectionPreferenceL(retrievedPref);
       
    81 
       
    82 	TBool rank1Found=EFalse;
       
    83 	if(retrievedPref.iRanking==1)	//should be pref2 with new ranking
       
    84 		{
       
    85 		rank1Found=ETrue;
       
    86 		if(pref2.iBearer.iIapId!=retrievedPref.iBearer.iIapId)
       
    87 			return KErrGeneral;		//something has gone wrong with the swap
       
    88 		}
       
    89 	else if(retrievedPref.iRanking==2)	//should be pref1 with new ranking
       
    90 		{
       
    91 		if(pref1.iBearer.iIapId!=retrievedPref.iBearer.iIapId)
       
    92 			return KErrGeneral;		//something has gone wrong with the swap
       
    93 		}
       
    94 	else
       
    95 		return KErrGeneral;			//We've got a rank other that 1&2 which is wrong.
       
    96 
       
    97 	User::LeaveIfError(iPrefView->GotoNextRecord());
       
    98 	iPrefView->ReadConnectionPreferenceL(retrievedPref);
       
    99 
       
   100 	if(retrievedPref.iRanking==1)
       
   101 		{
       
   102 		if(rank1Found)
       
   103 			return KErrGeneral;		//we've found 2 rank 1 records which is wrong.
       
   104 		if(pref2.iBearer.iIapId!=retrievedPref.iBearer.iIapId)
       
   105 			return KErrGeneral;		//something has gone wrong with the swap
       
   106 		}
       
   107 	else if (retrievedPref.iRanking==2)
       
   108 		{
       
   109 		if(!rank1Found)
       
   110 			return KErrGeneral;		//we've found 2 rank 2 records which is wrong.
       
   111 		if(pref1.iBearer.iIapId!=retrievedPref.iBearer.iIapId)
       
   112 			return KErrGeneral;		//something has gone wrong with the swap
       
   113 		}
       
   114 	else 
       
   115 		return KErrGeneral;
       
   116 	
       
   117 	return KErrNone;
       
   118 	}
       
   119 	
       
   120 TVerdict CCommDbTest033_01::doTestStepPostambleL()
       
   121 	{
       
   122 		//Get rid of our view
       
   123 	if(iPrefView)
       
   124 		{
       
   125 		delete iPrefView;
       
   126 		}
       
   127 	iPrefView=0;
       
   128 
       
   129 	//Create a new view that should have the record that was added in executeStepL and
       
   130 	// may have been left in by a leave condition
       
   131 	iPrefView = iTheDb->OpenConnectionPrefTableLC();
       
   132 	CleanupStack::Pop();
       
   133 
       
   134 	if(iPrefView->GotoFirstRecord() == KErrNone)
       
   135 		{
       
   136 		iPrefView->DeleteConnectionPreferenceL();
       
   137 		}
       
   138 	if(iPrefView->GotoFirstRecord() == KErrNone)
       
   139 		{
       
   140 		iPrefView->DeleteConnectionPreferenceL();
       
   141 		}
       
   142 	
       
   143 	// Cleanup after test run
       
   144 	CTestStepCommDb::doTestStepPostambleL();	
       
   145         SetTestStepResult(EPass);	return TestStepResult();
       
   146 	}
       
   147 
       
   148 /////////////////////////////////////////////////////////////////////////////////////
       
   149 
       
   150 CCommDbTest033_02::CCommDbTest033_02()
       
   151 	{
       
   152 	// store the name of this test case
       
   153 	SetTestStepName(_L("step_033_02"));
       
   154 	}
       
   155 
       
   156 CCommDbTest033_02::~CCommDbTest033_02()
       
   157 	{}
       
   158 
       
   159 TVerdict CCommDbTest033_02::doTestStepL( void )
       
   160 	{
       
   161 	if(executeStepL()!=KErrNone)
       
   162          SetTestStepResult(EFail);        SetTestStepResult(EPass);	return TestStepResult();	//If we've got this far we've passed
       
   163 	}
       
   164 
       
   165 TVerdict CCommDbTest033_02::doTestStepPreambleL()
       
   166 	{
       
   167 	iTheDb=CCommsDatabase::NewL();
       
   168 
       
   169 	iPrefView = iTheDb->OpenConnectionPrefTableLC();
       
   170 	CleanupStack::Pop();
       
   171 
       
   172         SetTestStepResult(EPass);	return TestStepResult();
       
   173 	}
       
   174 
       
   175 TInt CCommDbTest033_02::executeStepL()
       
   176 	{
       
   177 	CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref1;
       
   178 	pref1.iRanking = 1;
       
   179 	pref1.iDirection = ECommDbConnectionDirectionOutgoing;
       
   180 	pref1.iDialogPref = ECommDbDialogPrefPrompt;
       
   181 	pref1.iBearer.iBearerSet = KCommDbBearerCSD;
       
   182 	pref1.iBearer.iIapId = 1;
       
   183 
       
   184 	iPrefView->InsertConnectionPreferenceL(pref1, EFalse);
       
   185 
       
   186 	CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref2;
       
   187 	pref2.iRanking = 0;
       
   188 	pref2.iDirection = ECommDbConnectionDirectionOutgoing;
       
   189 	pref2.iDialogPref = ECommDbDialogPrefPrompt;
       
   190 	pref2.iBearer.iBearerSet = KCommDbBearerCSD;
       
   191 	pref2.iBearer.iIapId = 2;
       
   192 	
       
   193 	iPrefView->InsertConnectionPreferenceL(pref2, EFalse);
       
   194 
       
   195 	iPrefView->SwapConnectionPreferencesL(ECommDbConnectionDirectionOutgoing, 1, 0);
       
   196 
       
   197 	User::LeaveIfError(iPrefView->GotoFirstRecord());
       
   198 
       
   199 	CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref retrievedPref;
       
   200 	iPrefView->ReadConnectionPreferenceL(retrievedPref);
       
   201 
       
   202 	TBool rank1Found=EFalse;
       
   203 	if(retrievedPref.iRanking==1)	//should be pref2 with new ranking
       
   204 		{
       
   205 		rank1Found=ETrue;
       
   206 		if(pref2.iBearer.iIapId!=retrievedPref.iBearer.iIapId)
       
   207 			return KErrGeneral;		//something has gone wrong with the swap
       
   208 		}
       
   209 	else if(retrievedPref.iRanking==0)	//should be pref1 with new ranking
       
   210 		{
       
   211 		if(pref1.iBearer.iIapId!=retrievedPref.iBearer.iIapId)
       
   212 			return KErrGeneral;		//something has gone wrong with the swap
       
   213 		}
       
   214 	else
       
   215 		return KErrGeneral;			//We've got a rank other that 1&0 which is wrong.
       
   216 
       
   217 	User::LeaveIfError(iPrefView->GotoNextRecord());
       
   218 	iPrefView->ReadConnectionPreferenceL(retrievedPref);
       
   219 
       
   220 	if(retrievedPref.iRanking==1)
       
   221 		{
       
   222 		if(rank1Found)
       
   223 			return KErrGeneral;		//we've found 2 rank 1 records which is wrong.
       
   224 		if(pref2.iBearer.iIapId!=retrievedPref.iBearer.iIapId)
       
   225 			return KErrGeneral;		//something has gone wrong with the swap
       
   226 		}
       
   227 	else if (retrievedPref.iRanking==0)
       
   228 		{
       
   229 		if(!rank1Found)
       
   230 			return KErrGeneral;		//we've found 2 rank 0 records which is wrong.
       
   231 		if(pref1.iBearer.iIapId!=retrievedPref.iBearer.iIapId)
       
   232 			return KErrGeneral;		//something has gone wrong with the swap
       
   233 		}
       
   234 	else 
       
   235 		return KErrGeneral;
       
   236 	
       
   237 	return KErrNone;
       
   238 	}
       
   239 	
       
   240 TVerdict CCommDbTest033_02::doTestStepPostambleL()
       
   241 	{
       
   242 		//Get rid of our view
       
   243 	if(iPrefView)
       
   244 		{
       
   245 		delete iPrefView;
       
   246 		}
       
   247 	iPrefView=0;
       
   248 
       
   249 	//Create a new view that should have the record that was added in executeStepL and
       
   250 	// may have been left in by a leave condition
       
   251 	iPrefView = iTheDb->OpenConnectionPrefTableLC();
       
   252 	CleanupStack::Pop();
       
   253 
       
   254 	if(iPrefView->GotoFirstRecord() == KErrNone)
       
   255 		{
       
   256 		iPrefView->DeleteConnectionPreferenceL();
       
   257 		}
       
   258 	if(iPrefView->GotoFirstRecord() == KErrNone)
       
   259 		{
       
   260 		iPrefView->DeleteConnectionPreferenceL();
       
   261 		}
       
   262 	
       
   263 	// Cleanup after test run
       
   264 	CTestStepCommDb::doTestStepPostambleL();	
       
   265         SetTestStepResult(EPass);	return TestStepResult();
       
   266 	}
       
   267 
       
   268 /////////////////////////////////////////////////////////////////////////////////////
       
   269 
       
   270 CCommDbTest033_03::CCommDbTest033_03()
       
   271 	{
       
   272 	// store the name of this test case
       
   273 	SetTestStepName(_L("step_033_03"));
       
   274 	}
       
   275 
       
   276 CCommDbTest033_03::~CCommDbTest033_03()
       
   277 	{}
       
   278 
       
   279 TVerdict CCommDbTest033_03::doTestStepL( void )
       
   280 	{
       
   281 	if (executeStepL()!=KErrNotFound)
       
   282          SetTestStepResult(EFail);        SetTestStepResult(EPass);	return TestStepResult();	//If we've got this far we've passed
       
   283 	}
       
   284 
       
   285 TVerdict CCommDbTest033_03::doTestStepPreambleL()
       
   286 	{
       
   287 	iTheDb=CCommsDatabase::NewL();
       
   288 
       
   289 	iPrefView = iTheDb->OpenConnectionPrefTableLC();
       
   290 	CleanupStack::Pop();
       
   291 
       
   292         SetTestStepResult(EPass);	return TestStepResult();
       
   293 	}
       
   294 
       
   295 TInt CCommDbTest033_03::executeStepL()
       
   296 	{
       
   297 	CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref1;
       
   298 	pref1.iRanking = 1;
       
   299 	pref1.iDirection = ECommDbConnectionDirectionOutgoing;
       
   300 	pref1.iDialogPref = ECommDbDialogPrefPrompt;
       
   301 	pref1.iBearer.iBearerSet = KCommDbBearerCSD;
       
   302 	pref1.iBearer.iIapId = 1;
       
   303 
       
   304 	iPrefView->InsertConnectionPreferenceL(pref1, EFalse);
       
   305 
       
   306 	TRAPD(err, iPrefView->SwapConnectionPreferencesL(ECommDbConnectionDirectionOutgoing, 1, 2));
       
   307 
       
   308 	return err;
       
   309 	}
       
   310 	
       
   311 TVerdict CCommDbTest033_03::doTestStepPostambleL()
       
   312 	{
       
   313 		//Get rid of our view
       
   314 	if(iPrefView)
       
   315 		{
       
   316 		delete iPrefView;
       
   317 		}
       
   318 	iPrefView=0;
       
   319 
       
   320 	//Create a new view that should have the record that was added in executeStepL and
       
   321 	// may have been left in by a leave condition
       
   322 	iPrefView = iTheDb->OpenConnectionPrefTableLC();
       
   323 	CleanupStack::Pop();
       
   324 
       
   325 	if(iPrefView->GotoFirstRecord() == KErrNone)
       
   326 		{
       
   327 		iPrefView->DeleteConnectionPreferenceL();
       
   328 		}
       
   329 	if(iPrefView->GotoFirstRecord() == KErrNone)
       
   330 		{
       
   331 		iPrefView->DeleteConnectionPreferenceL();
       
   332 		}
       
   333 	
       
   334 	// Cleanup after test run
       
   335 	CTestStepCommDb::doTestStepPostambleL();	
       
   336         SetTestStepResult(EPass);	return TestStepResult();
       
   337 	}
       
   338 
       
   339 /////////////////////////////////////////////////////////////////////////////////////
       
   340 
       
   341 CCommDbTest033_04::CCommDbTest033_04()
       
   342 	{
       
   343 	// store the name of this test case
       
   344 	SetTestStepName(_L("step_033_04"));
       
   345 	}
       
   346 
       
   347 CCommDbTest033_04::~CCommDbTest033_04()
       
   348 	{}
       
   349 
       
   350 TVerdict CCommDbTest033_04::doTestStepL( void )
       
   351 	{
       
   352 	if (executeStepL()!=KErrAccessDenied)
       
   353          SetTestStepResult(EFail);        SetTestStepResult(EPass);	return TestStepResult();	//If we've got this far we've passed
       
   354 	}
       
   355 
       
   356 TVerdict CCommDbTest033_04::doTestStepPreambleL()
       
   357 	{
       
   358 	iTheDb=CCommsDatabase::NewL();
       
   359 
       
   360 	iPrefView = iTheDb->OpenConnectionPrefTableLC();
       
   361 	CleanupStack::Pop();
       
   362 
       
   363         SetTestStepResult(EPass);	return TestStepResult();
       
   364 	}
       
   365 
       
   366 TInt CCommDbTest033_04::executeStepL()
       
   367 	{
       
   368 	CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref1;
       
   369 	pref1.iRanking = 1;
       
   370 	pref1.iDirection = ECommDbConnectionDirectionOutgoing;
       
   371 	pref1.iDialogPref = ECommDbDialogPrefPrompt;
       
   372 	pref1.iBearer.iBearerSet = KCommDbBearerCSD;
       
   373 	pref1.iBearer.iIapId = 1;
       
   374 
       
   375 	iPrefView->InsertConnectionPreferenceL(pref1, ETrue);	//Make this entry read only
       
   376 
       
   377 	CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref2;
       
   378 	pref2.iRanking = 2;
       
   379 	pref2.iDirection = ECommDbConnectionDirectionOutgoing;
       
   380 	pref2.iDialogPref = ECommDbDialogPrefPrompt;
       
   381 	pref2.iBearer.iBearerSet = KCommDbBearerCSD;
       
   382 	pref2.iBearer.iIapId = 2;
       
   383 	
       
   384 	iPrefView->InsertConnectionPreferenceL(pref2, EFalse);
       
   385 
       
   386 	TRAPD(err, iPrefView->SwapConnectionPreferencesL(ECommDbConnectionDirectionOutgoing, 1, 2));
       
   387 
       
   388 	return err;
       
   389 	}
       
   390 	
       
   391 TVerdict CCommDbTest033_04::doTestStepPostambleL()
       
   392 	{
       
   393 		//Get rid of our view
       
   394 	if(iPrefView)
       
   395 		{
       
   396 		delete iPrefView;
       
   397 		}
       
   398 	iPrefView=0;
       
   399 
       
   400 	//Create a new view that should have the record that was added in executeStepL and
       
   401 	// may have been left in by a leave condition
       
   402 	iPrefView = iTheDb->OpenConnectionPrefTableLC();
       
   403 	CleanupStack::Pop();
       
   404 
       
   405 	if(iPrefView->GotoFirstRecord() == KErrNone)
       
   406 		{
       
   407 		iPrefView->DeleteConnectionPreferenceL();
       
   408 		}
       
   409 	if(iPrefView->GotoFirstRecord() == KErrNone)
       
   410 		{
       
   411 		iPrefView->DeleteConnectionPreferenceL();
       
   412 		}
       
   413 	
       
   414 	// Cleanup after test run
       
   415 	CTestStepCommDb::doTestStepPostambleL();	
       
   416         SetTestStepResult(EPass);	return TestStepResult();
       
   417 	}
       
   418 
       
   419 //////////////////////////////////////////////////////////////////////////
       
   420 
       
   421 CCommDbTest033_05::CCommDbTest033_05()
       
   422 	{
       
   423 	// store the name of this test case
       
   424 	SetTestStepName(_L("step_033_05"));
       
   425 	}
       
   426 
       
   427 CCommDbTest033_05::~CCommDbTest033_05()
       
   428 	{}
       
   429 
       
   430 TVerdict CCommDbTest033_05::doTestStepL( void )
       
   431 	{
       
   432 	INFO_PRINTF1(_L("Step 033.05 called "));
       
   433 
       
   434 	SetTestStepResult(EPass);
       
   435 	CCommDbTest033_01* step033_01 = new(ELeave) CCommDbTest033_01;
       
   436 	CleanupStack::PushL(step033_01);
       
   437 	doTestStepWithHeapFailureL( *step033_01, KErrNone);
       
   438 	CleanupStack::PopAndDestroy(step033_01);
       
   439 
       
   440 	
       
   441 	return TestStepResult();
       
   442 	}
       
   443 
       
   444 
       
   445 //////////////////////////////////////////////////////////////////////////
       
   446 
       
   447 CCommDbTest033_06::CCommDbTest033_06()
       
   448 	{
       
   449 	// store the name of this test case
       
   450 	SetTestStepName(_L("step_033_06"));
       
   451 	}
       
   452 
       
   453 CCommDbTest033_06::~CCommDbTest033_06()
       
   454 	{}
       
   455 
       
   456 TVerdict CCommDbTest033_06::doTestStepL( void )
       
   457 	{
       
   458 	INFO_PRINTF1(_L("Step 033.06 called "));
       
   459 
       
   460 	SetTestStepResult(EPass);	
       
   461 	CCommDbTest033_02* step033_02 = new(ELeave) CCommDbTest033_02;
       
   462 	CleanupStack::PushL(step033_02);
       
   463 	doTestStepWithHeapFailureL( *step033_02, KErrNone);
       
   464 	CleanupStack::PopAndDestroy(step033_02);
       
   465 	
       
   466 	return TestStepResult();
       
   467 	}
       
   468 	
       
   469 //////////////////////////////////////////////////////////////////////////
       
   470 
       
   471 CCommDbTest033_07::CCommDbTest033_07()
       
   472 	{
       
   473 	// store the name of this test case
       
   474 	SetTestStepName(_L("step_033_07"));
       
   475 	}
       
   476 
       
   477 CCommDbTest033_07::~CCommDbTest033_07()
       
   478 	{}
       
   479 
       
   480 TVerdict CCommDbTest033_07::doTestStepL( void )
       
   481 	{
       
   482 	INFO_PRINTF1(_L("Step 033.07 called "));
       
   483 
       
   484 	SetTestStepResult(EPass);	
       
   485 	CCommDbTest033_03* step033_03 = new(ELeave) CCommDbTest033_03;
       
   486 	CleanupStack::PushL(step033_03);
       
   487 	doTestStepWithHeapFailureL( *step033_03, KErrNotFound);
       
   488 	CleanupStack::PopAndDestroy(step033_03);
       
   489 
       
   490 	return TestStepResult();
       
   491 	}
       
   492 
       
   493 //////////////////////////////////////////////////////////////////////////
       
   494 
       
   495 CCommDbTest033_08::CCommDbTest033_08()
       
   496 	{
       
   497 	// store the name of this test case
       
   498 	SetTestStepName(_L("step_033_08"));
       
   499 	}
       
   500 
       
   501 CCommDbTest033_08::~CCommDbTest033_08()
       
   502 	{}
       
   503 
       
   504 TVerdict CCommDbTest033_08::doTestStepL( void )
       
   505 	{
       
   506 	INFO_PRINTF1(_L("Step 033.08 called "));
       
   507 
       
   508 	SetTestStepResult(EPass);	
       
   509 	CCommDbTest033_04* step033_04 = new(ELeave) CCommDbTest033_04;
       
   510 	CleanupStack::PushL(step033_04);
       
   511 	doTestStepWithHeapFailureL( *step033_04, KErrAccessDenied);
       
   512 	CleanupStack::PopAndDestroy(step033_04);
       
   513 		
       
   514 	return TestStepResult();
       
   515 	}
       
   516 
       
   517 /////////////////////////////////////////////////////////////////////////////////////
       
   518 
       
   519 CCommDbTest033_09::CCommDbTest033_09()
       
   520 	{
       
   521 	// store the name of this test case
       
   522 	SetTestStepName(_L("step_033_09"));
       
   523 	}
       
   524 
       
   525 TVerdict CCommDbTest033_09::doTestStepL()
       
   526 	{
       
   527 	if (executeStepL() != KErrNone)
       
   528 		{
       
   529          SetTestStepResult(EFail);		return TestStepResult();
       
   530 		}
       
   531 	
       
   532 	return TestStepResult();
       
   533 	}
       
   534 
       
   535 TVerdict CCommDbTest033_09::doTestStepPreambleL()
       
   536 	{
       
   537 	iTheDb = CCommsDatabase::NewL();
       
   538 
       
   539 	iPrefView = iTheDb->OpenConnectionPrefTableLC();
       
   540 	CleanupStack::Pop();
       
   541 
       
   542 	return TestStepResult();
       
   543 	}
       
   544 
       
   545 TInt CCommDbTest033_09::executeStepL()
       
   546 	{
       
   547 	CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref1;
       
   548 	pref1.iRanking = 0;
       
   549 	pref1.iDirection = ECommDbConnectionDirectionOutgoing;
       
   550 	pref1.iDialogPref = ECommDbDialogPrefPrompt;
       
   551 	pref1.iBearer.iBearerSet = KCommDbBearerCSD;
       
   552 	pref1.iBearer.iIapId = 1;
       
   553 
       
   554 	iPrefView->InsertConnectionPreferenceL(pref1, EFalse);
       
   555 
       
   556 	CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref2;
       
   557 	pref2.iRanking = 0;
       
   558 	pref2.iDirection = ECommDbConnectionDirectionOutgoing;
       
   559 	pref2.iDialogPref = ECommDbDialogPrefPrompt;
       
   560 	pref2.iBearer.iBearerSet = KCommDbBearerCSD;
       
   561 	pref2.iBearer.iIapId = 2;
       
   562 	
       
   563 	iPrefView->InsertConnectionPreferenceL(pref2, EFalse);
       
   564 
       
   565 	TRAPD(leaveCode, iPrefView->SwapConnectionPreferencesL(ECommDbConnectionDirectionOutgoing, 1, 0));
       
   566 	if (leaveCode != KErrArgument)
       
   567 		{
       
   568 		return KErrGeneral;
       
   569 		}
       
   570 
       
   571 	return KErrNone;
       
   572 	}
       
   573 	
       
   574 TVerdict CCommDbTest033_09::doTestStepPostambleL()
       
   575 	{
       
   576 	//
       
   577 	// Get rid of our view
       
   578 	//
       
   579 	if(iPrefView)
       
   580 		{
       
   581 		delete iPrefView;
       
   582 		iPrefView = NULL;
       
   583 		}
       
   584 
       
   585 	//
       
   586 	// Create a new view that should have the record that was added in executeStepL and
       
   587 	// may have been left in by a leave condition
       
   588 	//
       
   589 	iPrefView = iTheDb->OpenConnectionPrefTableLC();
       
   590 	CleanupStack::Pop();
       
   591 
       
   592 	if(iPrefView->GotoFirstRecord() == KErrNone)
       
   593 		{
       
   594 		iPrefView->DeleteConnectionPreferenceL();
       
   595 		}
       
   596 	if(iPrefView->GotoFirstRecord() == KErrNone)
       
   597 		{
       
   598 		iPrefView->DeleteConnectionPreferenceL();
       
   599 		}
       
   600 	
       
   601 	// Cleanup after test run
       
   602 	CTestStepCommDb::doTestStepPostambleL();	
       
   603 
       
   604 	return TestStepResult();
       
   605 	}
       
   606 
       
   607 //EOF