commsconfig/commsdatabaseshim/ts_commdb/Step_009_xx.cpp
changeset 72 ae47d0499bee
parent 68 5da8188e392b
child 77 c9776eadbffd
equal deleted inserted replaced
68:5da8188e392b 72:ae47d0499bee
     1 // Copyright (c) 2006-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 009.XX
       
    15 // 
       
    16 //
       
    17 
       
    18 // EPOC includes
       
    19 #include <e32base.h>
       
    20 #include <commdb.h>
       
    21 
       
    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_009_xx.h"
       
    29 
       
    30 
       
    31 
       
    32 //
       
    33 //	Test step 009.001
       
    34 //
       
    35 
       
    36 // constructor
       
    37 CCommDbTest009_01::CCommDbTest009_01()
       
    38 	{
       
    39 	// store the name of this test case
       
    40 	iTestStepName = _L("step_009_01");
       
    41 	}
       
    42 
       
    43 // destructor
       
    44 CCommDbTest009_01::~CCommDbTest009_01()
       
    45 	{
       
    46 	}
       
    47 
       
    48 
       
    49 TVerdict CCommDbTest009_01::doTestStepPreambleL()
       
    50 	{	
       
    51 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
    52 	return EPass;
       
    53 	}
       
    54 
       
    55 #define ISP_INIT_STRING_TEST_VALUE	_L8("Test Value")
       
    56 #define COMMDB_NAME_TEST_VALUE	_L("Test record")
       
    57 //#define ISP_IF_NAME_TEST_VALUE	_L("Test record")
       
    58 
       
    59 
       
    60 TInt CCommDbTest009_01::executeStepL()
       
    61 	{
       
    62 	TInt ret=KErrGeneral;
       
    63 	TUint32 id;
       
    64 
       
    65 	//NB. The table MUST be empty for this test to work!
       
    66 
       
    67 	//Try to insert a record
       
    68 	
       
    69 	CDBLEAVE( iTheView->InsertRecord( id ), KErrNone );
       
    70 
       
    71 	//Insert some text
       
    72 	iTheView->WriteTextL( TPtrC(ISP_INIT_STRING), ISP_INIT_STRING_TEST_VALUE );
       
    73 
       
    74 	//Must write to these columns as they cannot hold null values
       
    75 	iTheView->WriteBoolL(TPtrC(ISP_DIAL_RESOLUTION),ETrue);
       
    76 	iTheView->WriteBoolL(TPtrC(ISP_USE_LOGIN_SCRIPT),ETrue);
       
    77 	iTheView->WriteBoolL(TPtrC(ISP_PROMPT_FOR_LOGIN),EFalse);
       
    78 //	iTheView->WriteTextL(TPtrC(ISP_IF_NAME), ISP_IF_NAME_TEST_VALUE );
       
    79 	iTheView->WriteBoolL(TPtrC(ISP_IF_PROMPT_FOR_AUTH),EFalse);
       
    80 	iTheView->WriteBoolL(TPtrC(ISP_IP_ADDR_FROM_SERVER),ETrue);
       
    81 	iTheView->WriteBoolL(TPtrC(ISP_IP_DNS_ADDR_FROM_SERVER),ETrue);
       
    82 	iTheView->WriteBoolL(TPtrC(ISP_IP6_DNS_ADDR_FROM_SERVER),ETrue);
       
    83 	iTheView->WriteTextL(TPtrC(COMMDB_NAME),COMMDB_NAME_TEST_VALUE);
       
    84 
       
    85 	CDBLEAVE( iTheView->PutRecordChanges(), KErrNone );
       
    86 
       
    87 
       
    88 	//Read the value from the field and compare it to the value we've just written
       
    89 	CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone );
       
    90 
       
    91 	TBuf8<KCommsDbSvrMaxFieldLength> value;
       
    92 	iTheView->ReadTextL( TPtrC(ISP_INIT_STRING), value );
       
    93  	if( !value.Compare( ISP_INIT_STRING_TEST_VALUE ) )
       
    94 		{
       
    95 		ret = KErrNone;
       
    96 		}
       
    97 
       
    98 
       
    99 	return ret;
       
   100 	}
       
   101 
       
   102 
       
   103 TVerdict CCommDbTest009_01::doTestStepL( )
       
   104 	{
       
   105 	Log(_L("Step 009.01 called "));
       
   106 
       
   107 
       
   108 	if ( executeStepL() == KErrNone )
       
   109 		iTestStepResult = EPass;
       
   110 	else
       
   111 		iTestStepResult = EFail;
       
   112 
       
   113 		
       
   114 	return iTestStepResult;
       
   115 	}
       
   116 
       
   117 
       
   118 //
       
   119 //	Test step 009.002
       
   120 //
       
   121 
       
   122 // constructor
       
   123 CCommDbTest009_02::CCommDbTest009_02()
       
   124 	{
       
   125 	// store the name of this test case
       
   126 	iTestStepName = _L("step_009_02");
       
   127 	}
       
   128 
       
   129 // destructor
       
   130 CCommDbTest009_02::~CCommDbTest009_02()
       
   131 	{
       
   132 	}
       
   133 
       
   134 
       
   135 TVerdict CCommDbTest009_02::doTestStepPreambleL()
       
   136 	{	
       
   137 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   138 	return EPass;
       
   139 	}
       
   140 
       
   141 
       
   142 #define ISP_DESCRIPTION_TEST_VALUE	_L16("ISP description test value")
       
   143 
       
   144 TInt CCommDbTest009_02::executeStepL()
       
   145 	{
       
   146 	TInt ret=KErrGeneral;
       
   147 	TUint32 id;
       
   148 
       
   149 	//NB. The table MUST be empty for this test to work!
       
   150 
       
   151 	//Try to insert a record
       
   152 	CDBLEAVE( iTheView->InsertRecord( id ), KErrNone );
       
   153 
       
   154 	//Insert some text
       
   155 	iTheView->WriteTextL( TPtrC(ISP_DESCRIPTION), ISP_DESCRIPTION_TEST_VALUE );
       
   156 
       
   157 	//Must write to these columns as they cannot hold null values
       
   158 	iTheView->WriteBoolL(TPtrC(ISP_DIAL_RESOLUTION),ETrue);
       
   159 	iTheView->WriteBoolL(TPtrC(ISP_USE_LOGIN_SCRIPT),ETrue);
       
   160 	iTheView->WriteBoolL(TPtrC(ISP_PROMPT_FOR_LOGIN),EFalse);
       
   161 //	iTheView->WriteTextL(TPtrC(ISP_IF_NAME), ISP_IF_NAME_TEST_VALUE );
       
   162 	iTheView->WriteBoolL(TPtrC(ISP_IF_PROMPT_FOR_AUTH),EFalse);
       
   163 	iTheView->WriteBoolL(TPtrC(ISP_IP_ADDR_FROM_SERVER),ETrue);
       
   164 	iTheView->WriteBoolL(TPtrC(ISP_IP_DNS_ADDR_FROM_SERVER),ETrue);
       
   165 	iTheView->WriteBoolL(TPtrC(ISP_IP6_DNS_ADDR_FROM_SERVER),ETrue);
       
   166 	iTheView->WriteTextL(TPtrC(COMMDB_NAME),COMMDB_NAME_TEST_VALUE);
       
   167 
       
   168 	CDBLEAVE( iTheView->PutRecordChanges(), KErrNone);
       
   169 	
       
   170 	//Read the value from the field and compare it to the value we've just written
       
   171 	CDBLEAVE( iTheView->GotoFirstRecord(),  KErrNone ) ;
       
   172 
       
   173 	TBuf<KCommsDbSvrMaxFieldLength> value;
       
   174 	iTheView->ReadTextL( TPtrC(ISP_DESCRIPTION), value );
       
   175 	if( !value.Compare( ISP_DESCRIPTION_TEST_VALUE ) )
       
   176 		{
       
   177 		ret = KErrNone;
       
   178 		}
       
   179 	
       
   180 	return ret;
       
   181 	}
       
   182 
       
   183 
       
   184 TVerdict CCommDbTest009_02::doTestStepL( )
       
   185 	{
       
   186 	Log(_L("Step 009.02 called "));
       
   187 
       
   188 	if ( executeStepL() == KErrNone )
       
   189 		iTestStepResult = EPass;
       
   190 	else
       
   191 		iTestStepResult = EFail;
       
   192 	
       
   193 	return iTestStepResult;
       
   194 	}
       
   195 
       
   196 
       
   197 
       
   198 
       
   199 //
       
   200 //	Test step 009.003
       
   201 //
       
   202 
       
   203 // constructor
       
   204 CCommDbTest009_03::CCommDbTest009_03()
       
   205 	{
       
   206 	// store the name of this test case
       
   207 	iTestStepName = _L("step_009_03");
       
   208 	}
       
   209 
       
   210 // destructor
       
   211 CCommDbTest009_03::~CCommDbTest009_03()
       
   212 	{
       
   213 	}
       
   214 
       
   215 
       
   216 TVerdict CCommDbTest009_03::doTestStepPreambleL()
       
   217 	{	
       
   218 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   219 	return EPass;
       
   220 	}
       
   221 
       
   222 #define ISP_BEARER_TYPE_TEST_VALUE		0x1
       
   223 
       
   224 TInt CCommDbTest009_03::executeStepL()
       
   225 	{
       
   226 	TInt ret=KErrGeneral;
       
   227 	TUint32 id;
       
   228 
       
   229 	//NB. The table MUST be empty for this test to work!
       
   230 
       
   231 	//Try to insert a record
       
   232 	CDBLEAVE( iTheView->InsertRecord( id ),  KErrNone );
       
   233 
       
   234 	//Insert a value
       
   235 	iTheView->WriteUintL( TPtrC(ISP_BEARER_TYPE), ISP_BEARER_TYPE_TEST_VALUE );
       
   236 
       
   237 	//Must write to these columns as they cannot hold null values
       
   238 	iTheView->WriteBoolL(TPtrC(ISP_DIAL_RESOLUTION),ETrue);
       
   239 	iTheView->WriteBoolL(TPtrC(ISP_USE_LOGIN_SCRIPT),ETrue);
       
   240 	iTheView->WriteBoolL(TPtrC(ISP_PROMPT_FOR_LOGIN),EFalse);
       
   241 //	iTheView->WriteTextL(TPtrC(ISP_IF_NAME), ISP_IF_NAME_TEST_VALUE );
       
   242 	iTheView->WriteBoolL(TPtrC(ISP_IF_PROMPT_FOR_AUTH),EFalse);
       
   243 	iTheView->WriteBoolL(TPtrC(ISP_IP_ADDR_FROM_SERVER),ETrue);
       
   244 	iTheView->WriteBoolL(TPtrC(ISP_IP_DNS_ADDR_FROM_SERVER),ETrue);
       
   245 	iTheView->WriteBoolL(TPtrC(ISP_IP6_DNS_ADDR_FROM_SERVER),ETrue);
       
   246 	iTheView->WriteTextL(TPtrC(COMMDB_NAME),COMMDB_NAME_TEST_VALUE);
       
   247 
       
   248 	CDBLEAVE( iTheView->PutRecordChanges(),  KErrNone );
       
   249 
       
   250 	//Read the value from the field and compare it to the value we've just written
       
   251 	CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone );
       
   252 
       
   253 	TUint32 value;
       
   254 	iTheView->ReadUintL( TPtrC(ISP_BEARER_TYPE), value );
       
   255 	if( value == ISP_BEARER_TYPE_TEST_VALUE )
       
   256 		{
       
   257 		ret = KErrNone;
       
   258 		}
       
   259 		
       
   260 
       
   261 	return ret;
       
   262 	}
       
   263 
       
   264 
       
   265 TVerdict CCommDbTest009_03::doTestStepL( )
       
   266 	{
       
   267 	Log(_L("Step 009.03 called "));
       
   268 
       
   269 	if ( executeStepL() == KErrNone )
       
   270 		iTestStepResult = EPass;
       
   271 	else
       
   272 		iTestStepResult = EFail;
       
   273 
       
   274 
       
   275 	return iTestStepResult;
       
   276 	}
       
   277 
       
   278 
       
   279 
       
   280 
       
   281 
       
   282 
       
   283 
       
   284 //
       
   285 //	Test step 009.004
       
   286 //
       
   287 
       
   288 // constructor
       
   289 CCommDbTest009_04::CCommDbTest009_04()
       
   290 	{
       
   291 	// store the name of this test case
       
   292 	iTestStepName = _L("step_009_04");
       
   293 	}
       
   294 
       
   295 // destructor
       
   296 CCommDbTest009_04::~CCommDbTest009_04()
       
   297 	{
       
   298 	}
       
   299 
       
   300 
       
   301 TVerdict CCommDbTest009_04::doTestStepPreambleL()
       
   302 	{	
       
   303 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   304 	return EPass;
       
   305 	}
       
   306 
       
   307 #define ISP_ENABLE_SW_COMP_TEST_VALUE	ETrue
       
   308 
       
   309 TInt CCommDbTest009_04::executeStepL()
       
   310 	{
       
   311 	TInt ret=KErrGeneral;
       
   312 	TUint32 id;
       
   313 
       
   314 	//NB. The table MUST be empty for this test to work!
       
   315 
       
   316 	//Try to insert a record
       
   317 	CDBLEAVE( iTheView->InsertRecord( id ),  KErrNone );
       
   318 		
       
   319 	//Insert a value
       
   320 	iTheView->WriteBoolL( TPtrC(ISP_ENABLE_SW_COMP), ISP_ENABLE_SW_COMP_TEST_VALUE );
       
   321 
       
   322 	//Must write to these columns as they cannot hold null values
       
   323 	iTheView->WriteBoolL(TPtrC(ISP_DIAL_RESOLUTION),ETrue);
       
   324 	iTheView->WriteBoolL(TPtrC(ISP_USE_LOGIN_SCRIPT),ETrue);
       
   325 	iTheView->WriteBoolL(TPtrC(ISP_PROMPT_FOR_LOGIN),EFalse);
       
   326 //	iTheView->WriteTextL(TPtrC(ISP_IF_NAME), ISP_IF_NAME_TEST_VALUE );
       
   327 	iTheView->WriteBoolL(TPtrC(ISP_IF_PROMPT_FOR_AUTH),EFalse);
       
   328 	iTheView->WriteBoolL(TPtrC(ISP_IP_ADDR_FROM_SERVER),ETrue);
       
   329 	iTheView->WriteBoolL(TPtrC(ISP_IP_DNS_ADDR_FROM_SERVER),ETrue);
       
   330 	iTheView->WriteBoolL(TPtrC(ISP_IP6_DNS_ADDR_FROM_SERVER),ETrue);
       
   331 	iTheView->WriteTextL(TPtrC(COMMDB_NAME),COMMDB_NAME_TEST_VALUE);
       
   332 
       
   333 	CDBLEAVE( iTheView->PutRecordChanges(), KErrNone );
       
   334 	
       
   335 	//Read the value from the field and compare it to the value we've just written
       
   336 	CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone );
       
   337 	
       
   338 	TBool value;
       
   339 	iTheView->ReadBoolL( TPtrC(ISP_ENABLE_SW_COMP), value );
       
   340 	if( value )
       
   341 		{
       
   342 		ret = KErrNone;
       
   343 		}
       
   344 
       
   345 
       
   346 	return ret;
       
   347 	}
       
   348 
       
   349 
       
   350 TVerdict CCommDbTest009_04::doTestStepL( )
       
   351 	{
       
   352 	Log(_L("Step 009.04 called "));
       
   353 
       
   354 
       
   355 	if ( executeStepL() == KErrNone )
       
   356 		iTestStepResult = EPass;
       
   357 	else
       
   358 		iTestStepResult = EFail;
       
   359 
       
   360 
       
   361 	return iTestStepResult;
       
   362 	}
       
   363 
       
   364 
       
   365 
       
   366 
       
   367 
       
   368 //
       
   369 //	Test step 009.005
       
   370 //
       
   371 
       
   372 // constructor
       
   373 CCommDbTest009_05::CCommDbTest009_05()
       
   374 	{
       
   375 	// store the name of this test case
       
   376 	iTestStepName = _L("step_009_05");
       
   377 	}
       
   378 
       
   379 // destructor
       
   380 CCommDbTest009_05::~CCommDbTest009_05()
       
   381 	{
       
   382 	}
       
   383 
       
   384 TVerdict CCommDbTest009_05::doTestStepPreambleL()
       
   385 	{	
       
   386 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   387 	return EPass;
       
   388 	}
       
   389 
       
   390 
       
   391 #define ISP_LOGIN_SCRIPT_TEST_VALUE	 _L("This is a test string that will be used in the test. It must be longer than 50 characters")
       
   392 
       
   393 TInt CCommDbTest009_05::executeStepL()
       
   394 	{
       
   395 	TInt ret=KErrGeneral;
       
   396 	TUint32 id;
       
   397 
       
   398 	//NB. The table MUST be empty for this test to work!
       
   399 
       
   400 	//Try to insert a record
       
   401 	CDBLEAVE( iTheView->InsertRecord( id ), KErrNone );
       
   402 
       
   403 	//Insert a value
       
   404 	iTheView->WriteLongTextL( TPtrC(ISP_LOGIN_SCRIPT), TPtrC(ISP_LOGIN_SCRIPT_TEST_VALUE) );
       
   405 
       
   406 	//Must write to these columns as they cannot hold null values
       
   407 	iTheView->WriteBoolL(TPtrC(ISP_DIAL_RESOLUTION),ETrue);
       
   408 	iTheView->WriteBoolL(TPtrC(ISP_USE_LOGIN_SCRIPT),ETrue);
       
   409 	iTheView->WriteBoolL(TPtrC(ISP_PROMPT_FOR_LOGIN),EFalse);
       
   410 //	iTheView->WriteTextL(TPtrC(ISP_IF_NAME), ISP_IF_NAME_TEST_VALUE );
       
   411 	iTheView->WriteBoolL(TPtrC(ISP_IF_PROMPT_FOR_AUTH),EFalse);
       
   412 	iTheView->WriteBoolL(TPtrC(ISP_IP_ADDR_FROM_SERVER),ETrue);
       
   413 	iTheView->WriteBoolL(TPtrC(ISP_IP_DNS_ADDR_FROM_SERVER),ETrue);
       
   414 	iTheView->WriteBoolL(TPtrC(ISP_IP6_DNS_ADDR_FROM_SERVER),ETrue);
       
   415 	iTheView->WriteTextL(TPtrC(COMMDB_NAME),COMMDB_NAME_TEST_VALUE);
       
   416 
       
   417 	CDBLEAVE( iTheView->PutRecordChanges(), KErrNone );
       
   418 
       
   419 
       
   420 	//Read the value from the field and compare it to the value we've just written
       
   421 	CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone );
       
   422 	
       
   423 	HBufC* value = iTheView->ReadLongTextLC( TPtrC(ISP_LOGIN_SCRIPT) );
       
   424 
       
   425 	if ( value )
       
   426 		{
       
   427 		if( !value->Compare( ISP_LOGIN_SCRIPT_TEST_VALUE) )
       
   428 			{
       
   429 			ret = KErrNone;
       
   430 			}
       
   431 		CleanupStack::PopAndDestroy();
       
   432 		}
       
   433 
       
   434 	return ret;
       
   435 	}
       
   436 
       
   437 
       
   438 TVerdict CCommDbTest009_05::doTestStepL( )
       
   439 	{
       
   440 	Log(_L("Step 009.05 called "));
       
   441 
       
   442 	if ( executeStepL() == KErrNone )
       
   443 		iTestStepResult = EPass;
       
   444 	else
       
   445 		iTestStepResult = EFail;
       
   446 		
       
   447 	return iTestStepResult;
       
   448 	}
       
   449 
       
   450 
       
   451 
       
   452 
       
   453 
       
   454 //
       
   455 //	Test step 009.06
       
   456 //
       
   457 
       
   458 // constructor
       
   459 CCommDbTest009_06::CCommDbTest009_06()
       
   460 	{
       
   461 	// store the name of this test case
       
   462 	iTestStepName = _L("step_009_06");
       
   463 	}
       
   464 
       
   465 // destructor
       
   466 CCommDbTest009_06::~CCommDbTest009_06()
       
   467 	{
       
   468 	}
       
   469 
       
   470 
       
   471 TVerdict CCommDbTest009_06::doTestStepPreambleL()
       
   472 	{	
       
   473 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   474 	return EPass;
       
   475 	}
       
   476 
       
   477 
       
   478 #define TEST_DATA		_L("Test data")
       
   479 
       
   480 
       
   481 TInt CCommDbTest009_06::executeStepL()
       
   482 	{
       
   483 	TInt ret=KErrNone;
       
   484 	TUint32 id;
       
   485 
       
   486 	//NB. The table MUST be empty for this test to work!
       
   487 
       
   488 	//NB. This test will cause a PANIC
       
   489 
       
   490 	//Try to insert a record
       
   491 	CDBLEAVE( iTheView->InsertRecord( id ), KErrNone );
       
   492 
       
   493 	//Insert a value in an invalid column
       
   494 	iTheView->WriteTextL( KInvalidColumnName, TPtrC(TEST_DATA) );
       
   495 
       
   496 	// We should never get here because we should have hit a panic
       
   497 	// If the Panic doesnt happen, we'll cause a leave
       
   498 
       
   499 	User::Leave( KErrGeneral );
       
   500 
       
   501 	return ret;
       
   502 	}
       
   503 
       
   504 
       
   505 TVerdict CCommDbTest009_06::doTestStepL( )
       
   506 	{
       
   507 
       
   508 	//This test step needs to trap a Panic
       
   509 
       
   510 	TRAPD( r, executeStepL() );
       
   511 
       
   512 	if ( r == KErrNotFound )
       
   513 		iTestStepResult = EPass;
       
   514 	else
       
   515 		iTestStepResult = EFail;
       
   516 
       
   517 		
       
   518 	return iTestStepResult;
       
   519 	}
       
   520 
       
   521 
       
   522 
       
   523 //
       
   524 //	Test step 009.07
       
   525 //
       
   526 
       
   527 // constructor
       
   528 CCommDbTest009_07::CCommDbTest009_07()
       
   529 	{
       
   530 	// store the name of this test case
       
   531 	iTestStepName = _L("step_009_07");
       
   532 	}
       
   533 
       
   534 // destructor
       
   535 CCommDbTest009_07::~CCommDbTest009_07()
       
   536 	{
       
   537 	}
       
   538 
       
   539 
       
   540 TVerdict CCommDbTest009_07::doTestStepPreambleL()
       
   541 	{	
       
   542 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   543 	return EPass;
       
   544 	}
       
   545 
       
   546 
       
   547 TInt CCommDbTest009_07::executeStepL()
       
   548 	{
       
   549 	TInt ret=KErrNone;
       
   550 
       
   551 	//NB. This test will cause a PANIC
       
   552 
       
   553 	//Try to insert a record without a call to InsertRecord()
       
   554 	
       
   555 	//Insert a value in column
       
   556 	iTheView->WriteBoolL( TPtrC(ISP_ENABLE_SW_COMP), ETrue );
       
   557 
       
   558 	// We should never get here because we should have hit a panic
       
   559 	// If the Panic doesnt happen, we'll cause a leave
       
   560 
       
   561 	User::Leave( KErrGeneral );
       
   562 
       
   563 	return ret;
       
   564 	}
       
   565 
       
   566 
       
   567 TVerdict CCommDbTest009_07::doTestStepL( )
       
   568 	{
       
   569 	//This test step needs to trap a Panic
       
   570 
       
   571 	TRAPD( r, executeStepL() );
       
   572 
       
   573 	if ( r == KErrNone )
       
   574 		iTestStepResult = EFail;
       
   575 	else
       
   576 		iTestStepResult = EFail;
       
   577 
       
   578 
       
   579 	return iTestStepResult;
       
   580 	}
       
   581 
       
   582 
       
   583 
       
   584 
       
   585 
       
   586 
       
   587 
       
   588 //
       
   589 //	Test step 009.08
       
   590 //
       
   591 
       
   592 // constructor
       
   593 CCommDbTest009_08::CCommDbTest009_08()
       
   594 	{
       
   595 	// store the name of this test case
       
   596 	iTestStepName = _L("step_009_08");
       
   597 
       
   598 	}
       
   599 
       
   600 // destructor
       
   601 CCommDbTest009_08::~CCommDbTest009_08()
       
   602 	{
       
   603 	}
       
   604 
       
   605 
       
   606 TVerdict CCommDbTest009_08::doTestStepPreambleL()
       
   607 	{	
       
   608 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   609 	return EPass;
       
   610 	}
       
   611 
       
   612 
       
   613 TInt CCommDbTest009_08::executeStepL()
       
   614 	{
       
   615 	TInt ret=KErrNone;
       
   616 
       
   617 	//NB. This test will cause a PANIC
       
   618 	//Try to PutRecordChanges() without a call to InsertRecord()
       
   619 
       
   620 	//Insert a value
       
   621 	iTheView->WriteUintL( TPtrC(ISP_ENABLE_SW_COMP), ISP_ENABLE_SW_COMP_TEST_VALUE );
       
   622 
       
   623 	//Must write to these columns as they cannot hold null values
       
   624 	iTheView->WriteBoolL(TPtrC(ISP_DIAL_RESOLUTION),ETrue);
       
   625 	iTheView->WriteBoolL(TPtrC(ISP_USE_LOGIN_SCRIPT),ETrue);
       
   626 	iTheView->WriteBoolL(TPtrC(ISP_PROMPT_FOR_LOGIN),EFalse);
       
   627 //	iTheView->WriteTextL(TPtrC(ISP_IF_NAME), ISP_IF_NAME_TEST_VALUE );
       
   628 	iTheView->WriteBoolL(TPtrC(ISP_IF_PROMPT_FOR_AUTH),EFalse);
       
   629 	iTheView->WriteBoolL(TPtrC(ISP_IP_ADDR_FROM_SERVER),ETrue);
       
   630 	iTheView->WriteBoolL(TPtrC(ISP_IP_DNS_ADDR_FROM_SERVER),ETrue);
       
   631 	iTheView->WriteBoolL(TPtrC(ISP_IP6_DNS_ADDR_FROM_SERVER),ETrue);
       
   632 	iTheView->WriteTextL(TPtrC(COMMDB_NAME),COMMDB_NAME_TEST_VALUE);
       
   633 
       
   634 	iTheView->PutRecordChanges();
       
   635 
       
   636 	// We should never get here because we should have hit a panic
       
   637 	// If the Panic doesnt happen, we'll cause a leave
       
   638 
       
   639 	User::Leave( KErrGeneral );
       
   640 
       
   641 	return ret;
       
   642 	}
       
   643 
       
   644 
       
   645 TVerdict CCommDbTest009_08::doTestStepL( )
       
   646 	{
       
   647 	//This test step needs to trap a Panic
       
   648 
       
   649 	if ( executeStepL() ==  KErrNone )
       
   650 		iTestStepResult = EFail;
       
   651 	else
       
   652 		iTestStepResult = EFail;
       
   653 
       
   654 	return iTestStepResult;
       
   655 	}
       
   656 
       
   657 //
       
   658 //	Test step 009.09
       
   659 //
       
   660 
       
   661 // constructor
       
   662 CCommDbTest009_09::CCommDbTest009_09()
       
   663 	{
       
   664 	// store the name of this test case
       
   665 	iTestStepName = _L("step_009_09");
       
   666 	}
       
   667 
       
   668 // destructor
       
   669 CCommDbTest009_09::~CCommDbTest009_09()
       
   670 	{
       
   671 	}
       
   672 
       
   673 
       
   674 TVerdict CCommDbTest009_09::doTestStepPreambleL()
       
   675 	{
       
   676 	return EPass;
       
   677 	}
       
   678 
       
   679 
       
   680 
       
   681 TInt CCommDbTest009_09::executeStepL()
       
   682 	{
       
   683 	return KErrInUse;
       
   684 	}
       
   685 
       
   686 
       
   687 TVerdict CCommDbTest009_09::doTestStepL( )
       
   688 	{
       
   689 	Log(_L("Step 009.09 called"));
       
   690 			
       
   691 	//This test step needs to trap a Panic
       
   692 
       
   693 	if ( executeStepL() == KErrInUse )
       
   694 		iTestStepResult = EPass;
       
   695 	else
       
   696 		iTestStepResult = EFail;
       
   697 	return iTestStepResult;
       
   698 	}
       
   699 
       
   700 //
       
   701 //	Test step 009.10
       
   702 //
       
   703 
       
   704 // constructor
       
   705 CCommDbTest009_10::CCommDbTest009_10()
       
   706 	{
       
   707 	// store the name of this test case
       
   708 	iTestStepName = _L("step_009_10");
       
   709 	}
       
   710 
       
   711 // destructor
       
   712 CCommDbTest009_10::~CCommDbTest009_10()
       
   713 	{
       
   714 	}
       
   715 
       
   716 
       
   717 TVerdict CCommDbTest009_10::doTestStepPreambleL()
       
   718 	{	
       
   719 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   720 	return EPass;
       
   721 	}
       
   722 
       
   723 
       
   724 #define ISP_INIT_STRING_LONG_VALUE	_L8("aVeryVeryLongColumnValueThatIsLongerThanFiftyCharacters")
       
   725 
       
   726 
       
   727 TInt CCommDbTest009_10::executeStepL()
       
   728 	{
       
   729 	TInt ret=KErrGeneral;
       
   730 	TUint32 id;
       
   731 
       
   732 	//Try to insert a record
       
   733 	CDBLEAVE( iTheView->InsertRecord( id ), KErrNone );
       
   734 
       
   735 	//Write a long string
       
   736 	TRAP(ret, iTheView->WriteTextL( TPtrC(ISP_INIT_STRING), ISP_INIT_STRING_LONG_VALUE ) );
       
   737 	
       
   738 	return ret;
       
   739 	}
       
   740 
       
   741 
       
   742 TVerdict CCommDbTest009_10::doTestStepL( )
       
   743 	{
       
   744 	Log(_L("Step 009.10 called"));
       
   745 
       
   746 		if (  executeStepL() == KErrOverflow )
       
   747 		iTestStepResult = EPass;
       
   748 	else
       
   749 		iTestStepResult = EFail;
       
   750 
       
   751 	return iTestStepResult;
       
   752 	}
       
   753 
       
   754 
       
   755 
       
   756 
       
   757 //
       
   758 //	Test step 009.11
       
   759 //
       
   760 
       
   761 // constructor
       
   762 CCommDbTest009_11::CCommDbTest009_11()
       
   763 	{
       
   764 	// store the name of this test case
       
   765 	iTestStepName = _L("step_009_11");
       
   766 	}
       
   767 
       
   768 // destructor
       
   769 CCommDbTest009_11::~CCommDbTest009_11()
       
   770 	{
       
   771 	}
       
   772 
       
   773 TVerdict CCommDbTest009_11::doTestStepL( )
       
   774 	{
       
   775 	Log(_L("Step 009.11 called "));
       
   776 
       
   777 	iTestStepResult = EPass;
       
   778 
       
   779 	// Have backup of Database in c:\default7.dat
       
   780 	// Heap test for 009.01
       
   781 
       
   782 	CCommDbTest009_01* step009_01 = new(ELeave) CCommDbTest009_01;
       
   783 	CleanupStack::PushL(step009_01);
       
   784 	step009_01->iSuite = iSuite;
       
   785 	doTestStepWithHeapFailureL( *step009_01, KErrNone);
       
   786 	if ( step009_01->iTestStepResult == EFail )
       
   787 		iTestStepResult = EFail;
       
   788 	CleanupStack::PopAndDestroy(step009_01);
       
   789 
       
   790 
       
   791 	return iTestStepResult;
       
   792 
       
   793 	}
       
   794 
       
   795 
       
   796 // constructor
       
   797 CCommDbTest009_12::CCommDbTest009_12()
       
   798 	{
       
   799 	// store the name of this test case
       
   800 	iTestStepName = _L("step_009_12");
       
   801 	}
       
   802 
       
   803 // destructor
       
   804 CCommDbTest009_12::~CCommDbTest009_12()
       
   805 	{
       
   806 	}
       
   807 
       
   808 TVerdict CCommDbTest009_12::doTestStepL( )
       
   809 	{
       
   810 		// store the name of this test case
       
   811 	iTestStepName = _L("step_009_12");
       
   812 	iTestStepResult = EPass;
       
   813 	
       
   814 	CCommDbTest009_02* step009_02 = new(ELeave) CCommDbTest009_02;
       
   815 	CleanupStack::PushL(step009_02);
       
   816 	step009_02->iSuite = iSuite;
       
   817 	doTestStepWithHeapFailureL( *step009_02, KErrNone);
       
   818 	if ( step009_02->iTestStepResult == EFail )
       
   819 		iTestStepResult = EFail;
       
   820 	CleanupStack::PopAndDestroy(step009_02);
       
   821 
       
   822 	return iTestStepResult;
       
   823 	}
       
   824 	
       
   825 // constructor
       
   826 CCommDbTest009_13::CCommDbTest009_13()
       
   827 	{
       
   828 	// store the name of this test case
       
   829 	iTestStepName = _L("step_009_13");
       
   830 	}
       
   831 
       
   832 // destructor
       
   833 CCommDbTest009_13::~CCommDbTest009_13()
       
   834 	{
       
   835 	}
       
   836 
       
   837 TVerdict CCommDbTest009_13::doTestStepL( )
       
   838 	{
       
   839 		// store the name of this test case
       
   840 	iTestStepName = _L("step_009_13");
       
   841 	iTestStepResult = EPass;
       
   842 	
       
   843 		// Heap test for 009.03
       
   844 	CCommDbTest009_03* step009_03 = new(ELeave) CCommDbTest009_03;
       
   845 	CleanupStack::PushL(step009_03);
       
   846 	step009_03->iSuite = iSuite;
       
   847 	doTestStepWithHeapFailureL( *step009_03, KErrNone);
       
   848 	if ( step009_03->iTestStepResult == EFail )
       
   849 		iTestStepResult = EFail;
       
   850 	CleanupStack::PopAndDestroy(step009_03);
       
   851 	
       
   852 	return iTestStepResult;
       
   853 	}
       
   854 	
       
   855 // constructor
       
   856 CCommDbTest009_14::CCommDbTest009_14()
       
   857 	{
       
   858 	// store the name of this test case
       
   859 	iTestStepName = _L("step_009_14");
       
   860 	}
       
   861 
       
   862 // destructor
       
   863 CCommDbTest009_14::~CCommDbTest009_14()
       
   864 	{
       
   865 	}
       
   866 
       
   867 TVerdict CCommDbTest009_14::doTestStepL( )
       
   868 	{
       
   869 		// store the name of this test case
       
   870 	iTestStepName = _L("step_009_14");
       
   871 	iTestStepResult = EPass;
       
   872 	
       
   873 		// Heap test for 009.04
       
   874 	CCommDbTest009_04* step009_04 = new(ELeave) CCommDbTest009_04;
       
   875 	CleanupStack::PushL(step009_04);
       
   876 	step009_04->iSuite = iSuite;
       
   877 	doTestStepWithHeapFailureL( *step009_04, KErrNone);
       
   878 	if ( step009_04->iTestStepResult == EFail )
       
   879 		iTestStepResult = EFail;
       
   880 	CleanupStack::PopAndDestroy(step009_04);
       
   881 
       
   882 	return iTestStepResult;
       
   883 	}
       
   884 	
       
   885 // constructor
       
   886 CCommDbTest009_15::CCommDbTest009_15()
       
   887 	{
       
   888 	// store the name of this test case
       
   889 	iTestStepName = _L("step_009_15");
       
   890 	}
       
   891 
       
   892 // destructor
       
   893 CCommDbTest009_15::~CCommDbTest009_15()
       
   894 	{
       
   895 	}
       
   896 
       
   897 TVerdict CCommDbTest009_15::doTestStepL( )
       
   898 	{
       
   899 		// store the name of this test case
       
   900 	iTestStepName = _L("step_009_15");
       
   901 	iTestStepResult = EPass;
       
   902 	
       
   903 		// Heap test for 009.05
       
   904 	CCommDbTest009_05* step009_05 = new(ELeave) CCommDbTest009_05;
       
   905 	CleanupStack::PushL(step009_05);
       
   906 	step009_05->iSuite = iSuite;
       
   907 	doTestStepWithHeapFailureL( *step009_05, KErrNone);
       
   908 	if ( step009_05->iTestStepResult == EFail )
       
   909 		iTestStepResult = EFail;
       
   910 	CleanupStack::PopAndDestroy(step009_05);
       
   911 	
       
   912 			// Heap test for 009.06
       
   913 	CCommDbTest009_06* step009_06 = new(ELeave) CCommDbTest009_06;
       
   914 	CleanupStack::PushL(step009_06);
       
   915 	step009_06->iSuite = iSuite;
       
   916 	doTestStepWithHeapFailureL( *step009_06, KErrNotFound);
       
   917 	if ( step009_06->iTestStepResult == EFail )
       
   918 		iTestStepResult = EFail;
       
   919 	CleanupStack::PopAndDestroy(step009_06);
       
   920 
       
   921 	return iTestStepResult;
       
   922 	}
       
   923 	
       
   924 // constructor
       
   925 CCommDbTest009_16::CCommDbTest009_16()
       
   926 	{
       
   927 	// store the name of this test case
       
   928 	iTestStepName = _L("step_009_16");
       
   929 	}
       
   930 
       
   931 // destructor
       
   932 CCommDbTest009_16::~CCommDbTest009_16()
       
   933 	{
       
   934 	}
       
   935 
       
   936 TVerdict CCommDbTest009_16::doTestStepL( )
       
   937 	{
       
   938 		// store the name of this test case
       
   939 	iTestStepName = _L("step_009_16");
       
   940 	iTestStepResult = EPass;
       
   941 	
       
   942 		// Heap test for 009.09
       
   943 	CCommDbTest009_09* step009_09 = new(ELeave) CCommDbTest009_09;
       
   944 	CleanupStack::PushL(step009_09);
       
   945 	step009_09->iSuite = iSuite;
       
   946 	doTestStepWithHeapFailureL( *step009_09, KErrInUse);
       
   947 	if ( step009_09->iTestStepResult == EFail )
       
   948 		iTestStepResult = EFail;
       
   949 	CleanupStack::PopAndDestroy(step009_09);
       
   950 
       
   951 		// Heap test for 009.10
       
   952 	CCommDbTest009_10* step009_10 = new(ELeave) CCommDbTest009_10;
       
   953 	CleanupStack::PushL(step009_10);
       
   954 	step009_10->iSuite = iSuite;
       
   955 	doTestStepWithHeapFailureL( *step009_10, KErrOverflow);
       
   956 	if ( step009_10->iTestStepResult == EFail )
       
   957 		iTestStepResult = EFail;
       
   958 	CleanupStack::PopAndDestroy(step009_10);
       
   959 
       
   960 	return iTestStepResult;
       
   961 	}
       
   962 	
       
   963 
       
   964 // constructor
       
   965 CCommDbTest009_17::CCommDbTest009_17()
       
   966 {
       
   967 	// store the name of this test case
       
   968 	iTestStepName = _L("step_009_17");
       
   969 }
       
   970 
       
   971 // destructor
       
   972 CCommDbTest009_17::~CCommDbTest009_17()
       
   973 {
       
   974 }
       
   975 
       
   976 TVerdict CCommDbTest009_17::doTestStepPreambleL()
       
   977 	{
       
   978 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   979 	return EPass;
       
   980 	}
       
   981 
       
   982 TInt CCommDbTest009_17::executeStepL()
       
   983 {
       
   984 	TBuf<50> buff;
       
   985 
       
   986 	TInt ret(0);
       
   987 
       
   988 	CDBLEAVE( ret = iTheView->GotoFirstRecord(), KErrNone );
       
   989 
       
   990 	iTheView->UpdateRecord();
       
   991 	
       
   992 	iTheView->SetNullL( TPtrC(ISP_IF_CALLBACK_INFO ));
       
   993 	
       
   994 	User::LeaveIfError(iTheView->PutRecordChanges());
       
   995 		
       
   996 	iTheView->ReadTextL(TPtrC(ISP_IF_CALLBACK_INFO ), buff);
       
   997 
       
   998 	if(buff.Length() == 0)
       
   999 		{
       
  1000 		ret = KErrNone;
       
  1001 		}
       
  1002 	else
       
  1003 		{
       
  1004 		ret	= KErrGeneral;
       
  1005 		}
       
  1006 
       
  1007 	return ret;
       
  1008 }
       
  1009 
       
  1010 // do Test step 009.17
       
  1011 TVerdict CCommDbTest009_17::doTestStepL( )
       
  1012 {
       
  1013 
       
  1014 	Log(_L("Step 009.17 called "));
       
  1015     if (executeStepL() == KErrNone)
       
  1016 	iTestStepResult = EPass;
       
  1017 	else
       
  1018 		iTestStepResult = EFail;
       
  1019 
       
  1020 
       
  1021 	return iTestStepResult;
       
  1022 }
       
  1023 
       
  1024 //
       
  1025 //	Test step 009.18
       
  1026 //
       
  1027 
       
  1028 // constructor
       
  1029 CCommDbTest009_18::CCommDbTest009_18()
       
  1030 	{
       
  1031 	// store the name of this test case
       
  1032 	iTestStepName = _L("step_009_18");
       
  1033 	}
       
  1034 
       
  1035 // destructor
       
  1036 CCommDbTest009_18::~CCommDbTest009_18()
       
  1037 	{
       
  1038 	}
       
  1039 
       
  1040 TVerdict CCommDbTest009_18::doTestStepPreambleL()
       
  1041 	{
       
  1042 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
  1043 	return EPass;
       
  1044 	}
       
  1045 
       
  1046 TInt CCommDbTest009_18::executeStepL()
       
  1047 	{
       
  1048 	TBuf<KCommsDbSvrMaxColumnNameLength> tableName;
       
  1049 	iTestStepResult = EFail;
       
  1050 	iTheView->GetTableName( tableName ); 
       
  1051 	if ( tableName.Compare( TPtrC(DIAL_OUT_ISP)) != KErrNone )
       
  1052 		{	
       
  1053 		iTestStepResult = EFail;	
       
  1054 		}
       
  1055 	else
       
  1056 		{
       
  1057 		iTestStepResult = EPass;
       
  1058 		} 
       
  1059 	return iTestStepResult;
       
  1060 	}
       
  1061 
       
  1062 // do Test step 009.18
       
  1063 TVerdict CCommDbTest009_18::doTestStepL( )
       
  1064 	{
       
  1065 	iTestStepResult = EFail;
       
  1066 	Log(_L("Step 009.18 called "));
       
  1067 	if (executeStepL() != KErrNone)
       
  1068 		{
       
  1069 		iTestStepResult = EFail;	
       
  1070 		}
       
  1071 	else
       
  1072 		{
       
  1073 		iTestStepResult = EPass;
       
  1074 		}
       
  1075 	return iTestStepResult;
       
  1076 	}
       
  1077 
       
  1078 //
       
  1079 //	Test step 009.19
       
  1080 //
       
  1081 
       
  1082 // constructor
       
  1083 CCommDbTest009_19::CCommDbTest009_19()
       
  1084 	{
       
  1085 	// store the name of this test case
       
  1086 	iTestStepName = _L("step_009_19");
       
  1087 	}
       
  1088 
       
  1089 // destructor
       
  1090 CCommDbTest009_19::~CCommDbTest009_19()
       
  1091 	{
       
  1092 	}
       
  1093 
       
  1094 TVerdict CCommDbTest009_19::doTestStepL( )
       
  1095 	{
       
  1096 	Log(_L("Step 009.19 called "));
       
  1097 
       
  1098 	iTestStepResult = EPass;
       
  1099 
       
  1100 		// Heap test for 009.17
       
  1101 		
       
  1102 	CCommDbTest009_17* step009_17 = new(ELeave) CCommDbTest009_17;
       
  1103 	CleanupStack::PushL(step009_17);
       
  1104 	step009_17->iSuite = iSuite;
       
  1105 	if ( doTestStepWithHeapFailureL( *step009_17, KErrNone) == EFail )
       
  1106 		iTestStepResult = EFail;
       
  1107 	CleanupStack::PopAndDestroy(step009_17);
       
  1108 
       
  1109 	return iTestStepResult;	
       
  1110 
       
  1111 	}
       
  1112 
       
  1113 //
       
  1114 //	Test step 009.20
       
  1115 //
       
  1116 
       
  1117 // constructor
       
  1118 CCommDbTest009_20::CCommDbTest009_20()
       
  1119 	{
       
  1120 	// store the name of this test case
       
  1121 	iTestStepName = _L("step_009_20");
       
  1122 	}
       
  1123 
       
  1124 // destructor
       
  1125 CCommDbTest009_20::~CCommDbTest009_20()
       
  1126 	{
       
  1127 	}
       
  1128 
       
  1129 TVerdict CCommDbTest009_20::doTestStepL( )
       
  1130 	{
       
  1131 
       
  1132 	iTestStepResult = EPass;
       
  1133 
       
  1134 		// Heap test for 009.07
       
  1135 		
       
  1136 	CCommDbTest009_07* step009_07 = new(ELeave) CCommDbTest009_07;
       
  1137 	CleanupStack::PushL(step009_07);
       
  1138 	step009_07->iSuite = iSuite;
       
  1139 	if ( doTestStepWithHeapFailureL( *step009_07, KErrNone) == EFail )
       
  1140 		iTestStepResult = EFail;
       
  1141 	CleanupStack::PopAndDestroy(step009_07);
       
  1142 
       
  1143 	return iTestStepResult;	
       
  1144 
       
  1145 	}
       
  1146 
       
  1147 //
       
  1148 //	Test step 009.21
       
  1149 //
       
  1150 
       
  1151 // constructor
       
  1152 CCommDbTest009_21::CCommDbTest009_21()
       
  1153 	{
       
  1154 	// store the name of this test case
       
  1155 	iTestStepName = _L("step_009_21");
       
  1156 	}
       
  1157 
       
  1158 // destructor
       
  1159 CCommDbTest009_21::~CCommDbTest009_21()
       
  1160 	{
       
  1161 	}
       
  1162 
       
  1163 TVerdict CCommDbTest009_21::doTestStepL( )
       
  1164 	{
       
  1165 
       
  1166 	iTestStepResult = EPass;
       
  1167 
       
  1168 		// Heap test for 009.08
       
  1169 		
       
  1170 	CCommDbTest009_08* step009_08 = new(ELeave) CCommDbTest009_08;
       
  1171 	CleanupStack::PushL(step009_08);
       
  1172 	step009_08->iSuite = iSuite;
       
  1173 	if ( doTestStepWithHeapFailureL( *step009_08, KErrNone) == EFail )
       
  1174 		iTestStepResult = EFail;
       
  1175 	CleanupStack::PopAndDestroy(step009_08);
       
  1176 
       
  1177 	return iTestStepResult;	
       
  1178 
       
  1179 	}
       
  1180 
       
  1181 //EOF