commsconfig/commsdatabaseshim/ts_commdb/Step_017_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 017.XX
       
    15 // 
       
    16 //
       
    17 
       
    18 // EPOC includes
       
    19 #include <e32base.h>
       
    20 #include <commdb.h>
       
    21 #include <d32comm.h>
       
    22 #include <e32property.h>
       
    23 
       
    24 // Test system includes
       
    25 #include <networking/log.h>
       
    26 #include <networking/teststep.h>
       
    27 #include "Teststepcommdb.h"
       
    28 #include "TestSuiteCommdb.h"
       
    29 #include "Step_017_xx.h"
       
    30 
       
    31 
       
    32  	#include <commsdattypesv1_1.h>
       
    33 	using namespace CommsDat;
       
    34 
       
    35 
       
    36 //
       
    37 //	Test step 017.01
       
    38 //
       
    39 
       
    40 // constructor
       
    41 CCommDbTest017_01::CCommDbTest017_01()
       
    42 	{
       
    43 	// store the name of this test case
       
    44 	iTestStepName = _L("step_017_01");
       
    45 	}
       
    46 
       
    47 // destructor
       
    48 CCommDbTest017_01::~CCommDbTest017_01()
       
    49 	{
       
    50 	}
       
    51 
       
    52 
       
    53 TVerdict CCommDbTest017_01::doTestStepPreambleL()
       
    54 	{	
       
    55 	openDbL();
       
    56 	return EPass;
       
    57 	}
       
    58 
       
    59 // Have changed this value as 0xDEADBEEF is not valid input for all tested fields
       
    60 // linked records can only have either valid table/record data or integer < KCDMaxRecords
       
    61 #define TEST_VALUE	42 //0xDEADBEEF
       
    62 //#define TEST_VALUE	0xDEADBEEF
       
    63 
       
    64 TInt CCommDbTest017_01::GlobalSettingTestL( const TDesC& aName )
       
    65 	{
       
    66 	TUint32 newValue = 0;
       
    67 	TInt ret = KErrGeneral;
       
    68 
       
    69 	//Perform a read/write test on the global
       
    70 	iTheDb->SetGlobalSettingL( aName, TEST_VALUE );
       
    71 	iTheDb->GetGlobalSettingL( aName, newValue );
       
    72 	iTheDb->ClearGlobalSettingL( aName );
       
    73 
       
    74 	//Should leave with KErrNotFound
       
    75 	TRAPD(r, iTheDb->GetGlobalSettingL( aName, newValue ) );
       
    76 	if ( r!= KErrNotFound )
       
    77 		User::Leave(r);
       
    78 
       
    79 	if ( newValue == TEST_VALUE  )
       
    80 	{
       
    81 		ret = KErrNone;
       
    82 	}
       
    83 	return ret;
       
    84 
       
    85 }
       
    86 
       
    87 TInt CCommDbTest017_01::GlobalSettingClearL( const TDesC& aName )
       
    88 	{
       
    89 	TUint32 newValue = 0;
       
    90 
       
    91 	// Check for Global Setting existing. If exists then clear it
       
    92 	TRAPD(ret,iTheDb->GetGlobalSettingL( aName, newValue ));
       
    93 	if(ret==KErrNone)
       
    94 		{
       
    95 		iTheDb->ClearGlobalSettingL( aName );
       
    96 		}
       
    97 	else if(ret==KErrNotFound)
       
    98 		{
       
    99 		ret=KErrNone;
       
   100 		}
       
   101 	return ret;
       
   102 	}		
       
   103 
       
   104 TVerdict CCommDbTest017_01::doTestStepPostambleL()
       
   105 	{
       
   106 	TInt ret=KErrNone;
       
   107 	
       
   108 	CDBLEAVE( ret = GlobalSettingClearL(  TPtrC(REDIAL_ATTEMPTS) ), KErrNone );
       
   109 	CDBLEAVE( ret = GlobalSettingClearL(  TPtrC(SMS_BEARER) ), KErrNone );
       
   110 	CDBLEAVE( ret = GlobalSettingClearL(  TPtrC(SMS_RECEIVE_MODE) ), KErrNone );
       
   111 	CDBLEAVE( ret = GlobalSettingClearL(  TPtrC(GPRS_ATTACH_MODE) ), KErrNone );
       
   112 	CDBLEAVE( ret = GlobalSettingClearL(  TPtrC(ACCEPT_INCOMING_GPRS) ), KErrNone );
       
   113 	CDBLEAVE( ret = GlobalSettingClearL(  TPtrC(GPRS_CLASS_C_BEARER) ), KErrNone );
       
   114 	CDBLEAVE( ret = GlobalSettingClearL(  TPtrC(CONNECTION_ATTEMPTS) ), KErrNone );
       
   115 	CDBLEAVE( ret = GlobalSettingClearL(  TPtrC(MODEM_DATA_FAX) ), KErrNone );
       
   116 	CDBLEAVE( ret = GlobalSettingClearL(  TPtrC(MODEM_PHONE_SERVICES_SMS) ), KErrNone );
       
   117 	CDBLEAVE( ret = GlobalSettingClearL(  TPtrC(LOCATION_DATA_FAX) ), KErrNone );
       
   118 	CDBLEAVE( ret = GlobalSettingClearL(  TPtrC(LOCATION_PHONE_SERVICES_SMS) ), KErrNone );
       
   119 	CDBLEAVE( ret = GlobalSettingClearL(  TPtrC(MAXMBUF_HEAP) ), KErrNone );
       
   120 	CDBLEAVE( ret = GlobalSettingClearL(  TPtrC(DEFAULT_AGENT) ), KErrNone );
       
   121 	CDBLEAVE( ret = GlobalSettingClearL(  TPtrC(DEFAULT_NETWORK) ), KErrNone );
       
   122 	
       
   123 	// Cleanup after test run
       
   124 	CTestStepCommDb::doTestStepPostambleL();	
       
   125 	if(ret == KErrNone)
       
   126 		{
       
   127 		return EPass;
       
   128 		}
       
   129 	else
       
   130 		{
       
   131 		return EFail;
       
   132 		}
       
   133 	}
       
   134 
       
   135 TInt CCommDbTest017_01::executeStepL()
       
   136 	{
       
   137 	TInt ret=KErrNone;
       
   138 
       
   139 	CDBLEAVE( ret = GlobalSettingTestL( TPtrC(REDIAL_ATTEMPTS) ), KErrNone );
       
   140 	CDBLEAVE( ret = GlobalSettingTestL( TPtrC(SMS_BEARER) ), KErrNone );
       
   141 	CDBLEAVE( ret = GlobalSettingTestL( TPtrC(SMS_RECEIVE_MODE) ), KErrNone );
       
   142 	CDBLEAVE( ret = GlobalSettingTestL( TPtrC(GPRS_ATTACH_MODE) ), KErrNone );
       
   143 	CDBLEAVE( ret = GlobalSettingTestL( TPtrC(ACCEPT_INCOMING_GPRS) ), KErrNone );
       
   144 	CDBLEAVE( ret = GlobalSettingTestL( TPtrC(GPRS_CLASS_C_BEARER) ), KErrNone );
       
   145 	CDBLEAVE( ret = GlobalSettingTestL( TPtrC(CONNECTION_ATTEMPTS) ), KErrNone );
       
   146 	CDBLEAVE( ret = GlobalSettingTestL( TPtrC(MODEM_DATA_FAX) ), KErrNone );
       
   147 	CDBLEAVE( ret = GlobalSettingTestL( TPtrC(MODEM_PHONE_SERVICES_SMS) ), KErrNone );
       
   148 	CDBLEAVE( ret = GlobalSettingTestL( TPtrC(LOCATION_DATA_FAX ) ), KErrNone );
       
   149 	CDBLEAVE( ret = GlobalSettingTestL( TPtrC(LOCATION_PHONE_SERVICES_SMS)	 ), KErrNone );
       
   150 	CDBLEAVE( ret = GlobalSettingTestL( TPtrC(MAXMBUF_HEAP) ), KErrNone );
       
   151 	CDBLEAVE( ret = GlobalSettingTestL( TPtrC(DEFAULT_AGENT) ), KErrNone );
       
   152 	CDBLEAVE( ret = GlobalSettingTestL( TPtrC(DEFAULT_NETWORK) ), KErrNone );
       
   153 
       
   154 	return ret;
       
   155 	}
       
   156 
       
   157 
       
   158 
       
   159 TVerdict CCommDbTest017_01::doTestStepL( )
       
   160 	{
       
   161 	Log(_L("Step 017.01 called "));
       
   162 
       
   163 
       
   164 	if ( executeStepL() == KErrNone )
       
   165 		iTestStepResult = EPass;
       
   166 	else
       
   167 		iTestStepResult = EFail;
       
   168 
       
   169 	return iTestStepResult;
       
   170 	}
       
   171 
       
   172 
       
   173 //
       
   174 //	Test step 017.02
       
   175 //
       
   176 
       
   177 // constructor
       
   178 CCommDbTest017_02::CCommDbTest017_02()
       
   179 	{
       
   180 	// store the name of this test case
       
   181 	iTestStepName = _L("step_017_02");
       
   182 	}
       
   183 
       
   184 // destructor
       
   185 CCommDbTest017_02::~CCommDbTest017_02()
       
   186 	{
       
   187 	}
       
   188 
       
   189 
       
   190 TVerdict CCommDbTest017_02::doTestStepPreambleL()
       
   191 	{	
       
   192 	openDbAndViewL(TPtrC(MODEM_BEARER));
       
   193 	return EPass;
       
   194 	}
       
   195 
       
   196 
       
   197 
       
   198 TInt CCommDbTest017_02::executeStepL()
       
   199 	{
       
   200 	TInt ret=KErrNone;
       
   201 	TUint32 id;
       
   202 
       
   203 	//Checks for notifications when deleting global modem settings
       
   204 	CMDBSession* ptrSession = CMDBSession::NewL(KCDVersion1_1);
       
   205 
       
   206 	ptrSession->PublishProperties();
       
   207 	delete ptrSession;
       
   208 	ptrSession = NULL;
       
   209 
       
   210  	RProperty propCdbMdmRecordChange;
       
   211     RProperty propCdbMdmDataFaxChange;
       
   212     RProperty propCdbMdmNameChange;
       
   213     RProperty propCdbPhoneSMSChange;
       
   214  	
       
   215     TRequestStatus rqstatMdmRecordChange;
       
   216     TRequestStatus rqstatMdmDatafaxChange;
       
   217     TRequestStatus rqstatMdmNameChange;
       
   218     TRequestStatus rqstatPhoneSMSChange;
       
   219  	
       
   220     CDBLEAVE(propCdbMdmRecordChange.Attach(KUidSystemCategory,KUidCommDbModemRecordChange.iUid), KErrNone);
       
   221     CleanupClosePushL(propCdbMdmRecordChange);
       
   222  	CDBLEAVE(propCdbMdmDataFaxChange.Attach(KUidSystemCategory,KUidCommDbModemDataAndFaxChange.iUid), KErrNone);	
       
   223     CleanupClosePushL(propCdbMdmDataFaxChange);
       
   224  	CDBLEAVE(propCdbMdmNameChange.Attach(KUidSystemCategory,KUidCommDbModemTsyNameChange.iUid), KErrNone);
       
   225     CleanupClosePushL(propCdbMdmNameChange);
       
   226  	CDBLEAVE(propCdbPhoneSMSChange.Attach(KUidSystemCategory,KUidCommDbModemPhoneServicesAndSMSChange.iUid), KErrNone);
       
   227     CleanupClosePushL(propCdbPhoneSMSChange);
       
   228   
       
   229 
       
   230 	//create two modem table entries
       
   231 	CDBLEAVE( iTheView->InsertRecord( id ), KErrNone );
       
   232 	
       
   233 	_LIT(KModem,"US Robotics Sportster");
       
   234 	_LIT(KTsy,"HAYES");
       
   235 	_LIT8(KModemInitString,"AT&F1");
       
   236 	_LIT8(KModemFaxInitString,"AT&d2");
       
   237 	//Write some sample data into the table
       
   238 	iTheView->WriteTextL(TPtrC(COMMDB_NAME),KModem);
       
   239 	iTheView->WriteTextL(TPtrC(MODEM_TSY_NAME),KTsy);
       
   240 	iTheView->WriteUintL(TPtrC(MODEM_RATE),(TUint32)EBps57600);
       
   241 	iTheView->WriteUintL(TPtrC(MODEM_DATA_BITS),(TUint32)EData8);
       
   242 	iTheView->WriteUintL(TPtrC(MODEM_STOP_BITS),(TUint32)EStop1);
       
   243 	iTheView->WriteUintL(TPtrC(MODEM_PARITY),(TUint32)EParityNone);
       
   244 	iTheView->WriteUintL(TPtrC(MODEM_HANDSHAKING),(TUint32)(KConfigObeyCTS|KConfigObeyDSR|KConfigFailDSR|KConfigObeyDCD|KConfigFailDCD));	//KConfigObeyCTS;
       
   245 	iTheView->WriteUintL(TPtrC(MODEM_SPECIAL_RATE),(TUint32)0);
       
   246 	iTheView->WriteUintL(TPtrC(MODEM_XON_CHAR),(TUint32)0);
       
   247 	iTheView->WriteUintL(TPtrC(MODEM_XOFF_CHAR),(TUint32)0);
       
   248 	iTheView->WriteTextL(TPtrC(MODEM_MODEM_INIT_STRING),KModemInitString);
       
   249 	iTheView->WriteTextL(TPtrC(MODEM_DATA_INIT_STRING),KNullDesC8);
       
   250 	iTheView->WriteTextL(TPtrC(MODEM_FAX_INIT_STRING),KModemFaxInitString);
       
   251 	iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_PREF),(TUint32)EModemSpeakerSettingAfterDialUntilAnswer);
       
   252 	iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_VOL_PREF),(TUint32)EModemSpeakerVolumeQuiet);
       
   253 	CDBLEAVE( iTheView->PutRecordChanges(), KErrNone );
       
   254 
       
   255 	iTheDb->SetGlobalSettingL( TPtrC(MODEM_DATA_FAX), id );
       
   256 
       
   257 	//Open a new view up
       
   258 	delete iTheView;
       
   259 	iTheView =0;
       
   260 	iTheView = iTheDb->OpenTableLC( TPtrC(MODEM_BEARER) );
       
   261 	CleanupStack::Pop();
       
   262 	
       
   263 	
       
   264 	//Request the notifications
       
   265 	
       
   266  	propCdbMdmRecordChange.Subscribe(rqstatMdmRecordChange);
       
   267  	__ASSERT_ALWAYS(rqstatMdmRecordChange == KRequestPending, User::Invariant());
       
   268  	propCdbMdmDataFaxChange.Subscribe(rqstatMdmDatafaxChange);
       
   269  	__ASSERT_ALWAYS(rqstatMdmDatafaxChange == KRequestPending, User::Invariant());
       
   270  	propCdbMdmNameChange.Subscribe(rqstatMdmNameChange);
       
   271  	__ASSERT_ALWAYS(rqstatMdmNameChange == KRequestPending, User::Invariant());
       
   272 
       
   273 	//Delete the modem record and then wait for the notifications
       
   274 	CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone );
       
   275  	CDBLEAVE( iTheView->DeleteRecord(), KErrNone );
       
   276 
       
   277  	User::WaitForRequest(rqstatMdmRecordChange); 
       
   278  	if (rqstatMdmRecordChange != KErrNone) 
       
   279  		{
       
   280  		ret = KErrNotFound;
       
   281  		}
       
   282  	User::WaitForRequest(rqstatMdmDatafaxChange); 
       
   283  	if (rqstatMdmDatafaxChange != KErrNone) 
       
   284  		{
       
   285  		ret = KErrNotFound;
       
   286  		}
       
   287  	User::WaitForRequest(rqstatMdmNameChange); 
       
   288  	if (rqstatMdmNameChange != KErrNone) 
       
   289  		{
       
   290  		ret = KErrNotFound;
       
   291  		}
       
   292 	
       
   293 	//Now try the same thing with the MODEM_PHONE_SERVICES_SMS global setting
       
   294 	CDBLEAVE( iTheView->InsertRecord( id ), KErrNone );
       
   295 
       
   296 	_LIT(KModem2,"Another US Robotics Sportster");
       
   297 	//Write some sample data into the table
       
   298 	iTheView->WriteTextL(TPtrC(COMMDB_NAME),KModem2);
       
   299 	iTheView->WriteTextL(TPtrC(MODEM_TSY_NAME),KTsy);
       
   300 	iTheView->WriteUintL(TPtrC(MODEM_RATE),(TUint32)EBps57600);
       
   301 	iTheView->WriteUintL(TPtrC(MODEM_DATA_BITS),(TUint32)EData8);
       
   302 	iTheView->WriteUintL(TPtrC(MODEM_STOP_BITS),(TUint32)EStop1);
       
   303 	iTheView->WriteUintL(TPtrC(MODEM_PARITY),(TUint32)EParityNone);
       
   304 	iTheView->WriteUintL(TPtrC(MODEM_HANDSHAKING),(TUint32)(KConfigObeyCTS|KConfigObeyDSR|KConfigFailDSR|KConfigObeyDCD|KConfigFailDCD));	//KConfigObeyCTS;
       
   305 	iTheView->WriteUintL(TPtrC(MODEM_SPECIAL_RATE),(TUint32)0);
       
   306 	iTheView->WriteUintL(TPtrC(MODEM_XON_CHAR),(TUint32)0);
       
   307 	iTheView->WriteUintL(TPtrC(MODEM_XOFF_CHAR),(TUint32)0);
       
   308 	iTheView->WriteTextL(TPtrC(MODEM_MODEM_INIT_STRING),KModemInitString);
       
   309 	iTheView->WriteTextL(TPtrC(MODEM_DATA_INIT_STRING),KNullDesC8);
       
   310 	iTheView->WriteTextL(TPtrC(MODEM_FAX_INIT_STRING),KModemFaxInitString);
       
   311 	iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_PREF),(TUint32)EModemSpeakerSettingAfterDialUntilAnswer);
       
   312 	iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_VOL_PREF),(TUint32)EModemSpeakerVolumeQuiet);
       
   313 	CDBLEAVE( iTheView->PutRecordChanges(), KErrNone );
       
   314 	
       
   315 	iTheDb->SetGlobalSettingL(  TPtrC(MODEM_PHONE_SERVICES_SMS), id );
       
   316 
       
   317 
       
   318 	//Open a new view up
       
   319 	delete iTheView;
       
   320 	iTheView =0;
       
   321 	iTheView = iTheDb->OpenTableLC( TPtrC(MODEM_BEARER) );
       
   322 	CleanupStack::Pop();
       
   323 	
       
   324 	//Reset notifications
       
   325  	propCdbMdmRecordChange.Subscribe(rqstatMdmRecordChange);
       
   326  	__ASSERT_ALWAYS(rqstatMdmRecordChange == KRequestPending, User::Invariant());
       
   327  	propCdbMdmNameChange.Subscribe(rqstatMdmNameChange);
       
   328  	__ASSERT_ALWAYS(rqstatMdmNameChange == KRequestPending, User::Invariant());
       
   329  	propCdbPhoneSMSChange.Subscribe(rqstatPhoneSMSChange);
       
   330  	__ASSERT_ALWAYS(rqstatPhoneSMSChange == KRequestPending, User::Invariant());
       
   331 
       
   332 	//Delete the record and wait for the notifications
       
   333 	CDBLEAVE( iTheView->DeleteRecord(), KErrNone );
       
   334 
       
   335  	User::WaitForRequest(rqstatMdmRecordChange); 
       
   336  	if (rqstatMdmRecordChange != KErrNone) 
       
   337  		{
       
   338  		ret = rqstatMdmRecordChange.Int();
       
   339  		}
       
   340  	User::WaitForRequest(rqstatPhoneSMSChange); 
       
   341  	if (rqstatPhoneSMSChange != KErrNone) 
       
   342  		{
       
   343  		ret = rqstatMdmRecordChange.Int();
       
   344  		}
       
   345   	User::WaitForRequest(rqstatMdmNameChange); 
       
   346  	if (rqstatMdmNameChange != KErrNone) 
       
   347  		{
       
   348  		ret = rqstatMdmRecordChange.Int();
       
   349  		}
       
   350  		
       
   351  	CleanupStack::PopAndDestroy(); // propCdbPhoneSMSChange
       
   352  	CleanupStack::PopAndDestroy(); // propCdbMdmNameChange
       
   353  	CleanupStack::PopAndDestroy(); // propCdbMdmDataFaxChange
       
   354  	CleanupStack::PopAndDestroy(); // propCdbMdmRecordChange
       
   355  		
       
   356 	
       
   357 	return ret;
       
   358 	}
       
   359 
       
   360 
       
   361 
       
   362 TVerdict CCommDbTest017_02::doTestStepL( )
       
   363 	{
       
   364 	Log(_L("Step 017.02 called "));
       
   365 
       
   366 	if ( executeStepL() == KErrNone )
       
   367 		iTestStepResult = EPass;
       
   368 	else
       
   369 		iTestStepResult = EFail;
       
   370 
       
   371 	return iTestStepResult;
       
   372 	}
       
   373 
       
   374 
       
   375 //
       
   376 //	Test step 017.03
       
   377 //
       
   378 
       
   379 // constructor
       
   380 CCommDbTest017_03::CCommDbTest017_03()
       
   381 	{
       
   382 	// store the name of this test case
       
   383 	iTestStepName = _L("step_017_03");
       
   384 	}
       
   385 
       
   386 // destructor
       
   387 CCommDbTest017_03::~CCommDbTest017_03()
       
   388 	{
       
   389 	}
       
   390 
       
   391 TVerdict CCommDbTest017_03::doTestStepPreambleL()
       
   392 	{	
       
   393 	openDbAndViewL(TPtrC(MODEM_BEARER));
       
   394 	return EPass;
       
   395 	}
       
   396 
       
   397 
       
   398 TInt CCommDbTest017_03::executeStepL()
       
   399 	{
       
   400 	TInt ret=KErrNone;
       
   401 	TUint32 id;
       
   402 
       
   403 	//Checks for notifications when deleting global modem settings
       
   404 
       
   405  	RProperty propCdbMdmRecordChange;
       
   406     RProperty propCdbMdmDataFaxChange;
       
   407     RProperty propCdbMdmNameChange;
       
   408     RProperty propCdbPhoneSMSChange;
       
   409  	
       
   410     TRequestStatus rqstatMdmRecordChange;
       
   411     TRequestStatus rqstatMdmDatafaxChange;
       
   412     TRequestStatus rqstatMdmNameChange;
       
   413     TRequestStatus rqstatPhoneSMSChange;
       
   414  	
       
   415     CDBLEAVE(propCdbMdmRecordChange.Attach(KUidSystemCategory, KUidCommDbModemRecordChange.iUid), KErrNone);
       
   416     CleanupClosePushL(propCdbMdmRecordChange);
       
   417  	CDBLEAVE(propCdbMdmDataFaxChange.Attach(KUidSystemCategory, KUidCommDbModemDataAndFaxChange.iUid), KErrNone);	//this KUid has been deprecated
       
   418     CleanupClosePushL(propCdbMdmDataFaxChange);
       
   419  	CDBLEAVE(propCdbMdmNameChange.Attach(KUidSystemCategory, KUidCommDbModemTsyNameChange.iUid), KErrNone);
       
   420     CleanupClosePushL(propCdbMdmNameChange);
       
   421  	CDBLEAVE(propCdbPhoneSMSChange.Attach(KUidSystemCategory, KUidCommDbModemPhoneServicesAndSMSChange.iUid), KErrNone);	//this KUid has been deprecated
       
   422     CleanupClosePushL(propCdbPhoneSMSChange);
       
   423  
       
   424 
       
   425 	//create two modem table entries
       
   426 	CDBLEAVE( iTheView->InsertRecord( id ), KErrNone );
       
   427 	
       
   428 	_LIT(KModem,"US Robotics Sportster");
       
   429 	_LIT(KTsy,"HAYES");
       
   430 	_LIT8(KModemInitString,"AT&F1");
       
   431 	_LIT8(KModemFaxInitString,"AT&d2");
       
   432 	//Write some sample data into the table
       
   433 	iTheView->WriteTextL(TPtrC(COMMDB_NAME),KModem);
       
   434 	iTheView->WriteTextL(TPtrC(MODEM_TSY_NAME),KTsy);
       
   435 	iTheView->WriteUintL(TPtrC(MODEM_RATE),(TUint32)EBps57600);
       
   436 	iTheView->WriteUintL(TPtrC(MODEM_DATA_BITS),(TUint32)EData8);
       
   437 	iTheView->WriteUintL(TPtrC(MODEM_STOP_BITS),(TUint32)EStop1);
       
   438 	iTheView->WriteUintL(TPtrC(MODEM_PARITY),(TUint32)EParityNone);
       
   439 	iTheView->WriteUintL(TPtrC(MODEM_HANDSHAKING),(TUint32)(KConfigObeyCTS|KConfigObeyDSR|KConfigFailDSR|KConfigObeyDCD|KConfigFailDCD));	//KConfigObeyCTS;
       
   440 	iTheView->WriteUintL(TPtrC(MODEM_SPECIAL_RATE),(TUint32)0);
       
   441 	iTheView->WriteUintL(TPtrC(MODEM_XON_CHAR),(TUint32)0);
       
   442 	iTheView->WriteUintL(TPtrC(MODEM_XOFF_CHAR),(TUint32)0);
       
   443 	iTheView->WriteTextL(TPtrC(MODEM_MODEM_INIT_STRING),KModemInitString);
       
   444 	iTheView->WriteTextL(TPtrC(MODEM_DATA_INIT_STRING),KNullDesC8);
       
   445 	iTheView->WriteTextL(TPtrC(MODEM_FAX_INIT_STRING),KModemFaxInitString);
       
   446 	iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_PREF),(TUint32)EModemSpeakerSettingAfterDialUntilAnswer);
       
   447 	iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_VOL_PREF),(TUint32)EModemSpeakerVolumeQuiet);
       
   448 	CDBLEAVE( iTheView->PutRecordChanges(), KErrNone );
       
   449 
       
   450 	//Set both modem gloabls to the same record
       
   451 	iTheDb->SetGlobalSettingL( TPtrC(MODEM_DATA_FAX), id );
       
   452 	iTheDb->SetGlobalSettingL(  TPtrC(MODEM_PHONE_SERVICES_SMS), id );
       
   453 
       
   454 	//Open a new view up
       
   455 	delete iTheView;
       
   456 	iTheView =0;
       
   457 	iTheView = iTheDb->OpenTableLC( TPtrC(MODEM_BEARER) );
       
   458 	CleanupStack::Pop();
       
   459 	
       
   460 	
       
   461 	//Request the notifications
       
   462  	propCdbMdmRecordChange.Subscribe(rqstatMdmRecordChange);
       
   463  	__ASSERT_ALWAYS(rqstatMdmRecordChange == KRequestPending, User::Invariant());
       
   464  	propCdbMdmDataFaxChange.Subscribe(rqstatMdmDatafaxChange);
       
   465  	__ASSERT_ALWAYS(rqstatMdmDatafaxChange == KRequestPending, User::Invariant());
       
   466  	propCdbMdmNameChange.Subscribe(rqstatMdmNameChange);
       
   467  	__ASSERT_ALWAYS(rqstatMdmNameChange == KRequestPending, User::Invariant());
       
   468  	propCdbPhoneSMSChange.Subscribe(rqstatPhoneSMSChange);
       
   469  	__ASSERT_ALWAYS(rqstatPhoneSMSChange == KRequestPending, User::Invariant());
       
   470 
       
   471 	//Delete the modem record and then wait for the four notifications
       
   472 	CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone );
       
   473 	CDBLEAVE( iTheView->DeleteRecord(), KErrNone );
       
   474 
       
   475  	User::WaitForRequest(rqstatMdmRecordChange); 
       
   476  	if (rqstatMdmRecordChange != KErrNone)
       
   477  		{
       
   478  		ret = KErrNotFound;
       
   479  		}
       
   480  	User::WaitForRequest(rqstatMdmDatafaxChange); 
       
   481  	if (rqstatMdmDatafaxChange != KErrNone) 
       
   482  		{
       
   483  		ret = KErrNotFound;
       
   484  		}
       
   485  	User::WaitForRequest(rqstatPhoneSMSChange); 
       
   486  	if (rqstatPhoneSMSChange != KErrNone) 
       
   487  		{
       
   488  		ret = KErrNotFound;
       
   489  		}
       
   490  		
       
   491  	User::WaitForRequest(rqstatMdmNameChange); 
       
   492  	if (rqstatMdmNameChange != KErrNone) 
       
   493  		{
       
   494  		ret = KErrNotFound;
       
   495  		}
       
   496  		
       
   497  	CleanupStack::PopAndDestroy(); // propCdbPhoneSMSChange
       
   498  	CleanupStack::PopAndDestroy(); // propCdbMdmNameChange
       
   499  	CleanupStack::PopAndDestroy(); // propCdbMdmDataFaxChange
       
   500  	CleanupStack::PopAndDestroy(); // propCdbMdmRecordChange
       
   501 	
       
   502 	return ret;
       
   503 	}
       
   504 
       
   505 
       
   506 
       
   507 TVerdict CCommDbTest017_03::doTestStepL( )
       
   508 	{
       
   509 	Log(_L("Step 017.03 called "));
       
   510 	
       
   511 	if ( executeStepL() == KErrNone )
       
   512 		iTestStepResult = EPass;
       
   513 	else
       
   514 		iTestStepResult = EFail;
       
   515 
       
   516 
       
   517 	return iTestStepResult;
       
   518 	}
       
   519 
       
   520 
       
   521 
       
   522 //
       
   523 //	Test step 017.04
       
   524 //
       
   525 
       
   526 // constructor
       
   527 CCommDbTest017_04::CCommDbTest017_04()
       
   528 	{
       
   529 	// store the name of this test case
       
   530 	iTestStepName = _L("step_017_04");
       
   531 	}
       
   532 
       
   533 // destructor
       
   534 CCommDbTest017_04::~CCommDbTest017_04()
       
   535 	{
       
   536 	}
       
   537 
       
   538 TVerdict CCommDbTest017_04::doTestStepPreambleL()
       
   539 	{	
       
   540 	openDbL();
       
   541 	return EPass;
       
   542 	}
       
   543 
       
   544 
       
   545 #define INVALID_GLOBAL_NAME	  _L("Invalid")
       
   546 
       
   547 TInt CCommDbTest017_04::executeStepL()
       
   548 	{
       
   549 	TRAPD( r, iTheDb->SetGlobalSettingL( TPtrC(INVALID_GLOBAL_NAME), 0x55 ) );
       
   550 	if ( r!=KErrNotSupported )
       
   551 		return r;
       
   552 
       
   553 	TUint32 dummInt;
       
   554 	TRAP( r, iTheDb->GetGlobalSettingL( TPtrC(INVALID_GLOBAL_NAME), dummInt ) );
       
   555 	return r;
       
   556 	}
       
   557 
       
   558 
       
   559 
       
   560 TVerdict CCommDbTest017_04::doTestStepL( )
       
   561 	{
       
   562 	Log(_L("Step 017.04 called "));
       
   563 
       
   564 	
       
   565 	if ( executeStepL() == KErrNotSupported)
       
   566 		iTestStepResult = EPass;
       
   567 	else
       
   568 		iTestStepResult = EFail;
       
   569 
       
   570 	return iTestStepResult;
       
   571 	}
       
   572 
       
   573 
       
   574 
       
   575 //
       
   576 //	Test step 017.05
       
   577 //
       
   578 
       
   579 // constructor
       
   580 CCommDbTest017_05::CCommDbTest017_05()
       
   581 	{
       
   582 	// store the name of this test case
       
   583 	iTestStepName = _L("step_017_05");
       
   584 	}
       
   585 
       
   586 // destructor
       
   587 CCommDbTest017_05::~CCommDbTest017_05()
       
   588 	{
       
   589 	}
       
   590 
       
   591 TVerdict CCommDbTest017_05::doTestStepL( )
       
   592 	{
       
   593 	Log(_L("Step 017.05 called "));
       
   594 
       
   595 	iTestStepResult = EPass;
       
   596 
       
   597 	// Have backup of Database in c:\default1.dat
       
   598 //	copyDatabaseToDefault (EDatabase_1);
       
   599 	
       
   600 		// Heap test for 017.01
       
   601 		
       
   602 //	copyTestDatabase( EDatabase_1 );
       
   603 	CCommDbTest017_01* step017_01 = new(ELeave) CCommDbTest017_01;
       
   604 	CleanupStack::PushL(step017_01);
       
   605 	step017_01->iSuite = iSuite;
       
   606 	if ( doTestStepWithHeapFailureL( *step017_01, KErrNone) == EFail )
       
   607 		iTestStepResult = EFail;
       
   608 	CleanupStack::PopAndDestroy(step017_01);
       
   609 
       
   610 		// Heap test for 017.02
       
   611 
       
   612 //	copyTestDatabase( EDatabase_1 );
       
   613 	CCommDbTest017_02* step017_02 = new CCommDbTest017_02;
       
   614 	CleanupStack::PushL(step017_02);
       
   615 	step017_02->iSuite = iSuite;
       
   616 	if ( doTestStepWithHeapFailureL( *step017_02, KErrNone) == EFail )
       
   617 		iTestStepResult = EFail;
       
   618 	CleanupStack::PopAndDestroy(step017_02);
       
   619 
       
   620 		// Heap test for 017.03
       
   621 
       
   622 //	copyTestDatabase( EDatabase_1 );
       
   623 	CCommDbTest017_03* step017_03 = new CCommDbTest017_03;
       
   624 	CleanupStack::PushL(step017_03);
       
   625 	step017_03->iSuite = iSuite;
       
   626 	if ( doTestStepWithHeapFailureL( *step017_03, KErrNone) == EFail )
       
   627 		iTestStepResult = EFail;
       
   628 	CleanupStack::PopAndDestroy(step017_03);
       
   629 
       
   630 		// Heap test for 017.04
       
   631 
       
   632 //	copyTestDatabase( EDatabase_1 );
       
   633 	CCommDbTest017_04* step017_04 = new CCommDbTest017_04;
       
   634 	CleanupStack::PushL(step017_04);
       
   635 	step017_04->iSuite = iSuite;
       
   636 	if ( doTestStepWithHeapFailureL( *step017_04, KErrNotSupported) == EFail )
       
   637 		iTestStepResult = EFail;
       
   638 	CleanupStack::PopAndDestroy(step017_04);
       
   639 
       
   640 
       
   641 	return iTestStepResult;	
       
   642 
       
   643 }
       
   644 
       
   645 //
       
   646 //	Test step 017.06
       
   647 //
       
   648 
       
   649 // constructor
       
   650 CCommDbTest017_06::CCommDbTest017_06()
       
   651 	{
       
   652 	// store the name of this test case
       
   653 	iTestStepName = _L("step_017_06");
       
   654 	}
       
   655 
       
   656 // destructor
       
   657 CCommDbTest017_06::~CCommDbTest017_06()
       
   658 	{
       
   659 	}
       
   660 
       
   661 TVerdict CCommDbTest017_06::doTestStepPreambleL()
       
   662 	{	
       
   663 	openDbL();
       
   664 	return EPass;
       
   665 	}
       
   666 
       
   667 
       
   668 #define DEFAULT_TSY	  _L("DEFAULT_TSY")
       
   669 
       
   670 TInt CCommDbTest017_06::executeStepL()
       
   671 	{
       
   672 	TRAPD(r, iTheDb->SetGlobalSettingL(TPtrC(BEARER_AVAILABILITY_CHECK_TSY), TPtrC(DEFAULT_TSY)) );
       
   673 
       
   674 	if (r != KErrNone)
       
   675 		return r;
       
   676 
       
   677 	TBuf<KCommsDbSvrMaxFieldLength> defaultTsy;
       
   678 	TRAP(r, iTheDb->GetGlobalSettingL( TPtrC(BEARER_AVAILABILITY_CHECK_TSY), defaultTsy ) );
       
   679 
       
   680 	if (r != KErrNone)
       
   681 		{
       
   682 		return r;
       
   683 		}
       
   684 
       
   685 	if (defaultTsy.Compare(TPtrC(DEFAULT_TSY)) != 0)
       
   686 		{
       
   687 		return KErrArgument;
       
   688 		}
       
   689 
       
   690 	defaultTsy.Zero();
       
   691 	TRAP(r, iTheDb->GetDefaultTsyL(defaultTsy));
       
   692 
       
   693 	if (r != KErrNone)
       
   694 		{
       
   695 		return r;
       
   696 		}
       
   697 
       
   698 	if (defaultTsy.Compare(TPtrC(DEFAULT_TSY)) != 0)
       
   699 		{
       
   700 		return KErrArgument;
       
   701 		}
       
   702 	return KErrNone;
       
   703 	}
       
   704 
       
   705 
       
   706 TVerdict CCommDbTest017_06::doTestStepL( )
       
   707 	{
       
   708 	Log(_L("Step 017.06 called "));
       
   709 
       
   710 	
       
   711 	if ( executeStepL() == KErrNone)
       
   712 		iTestStepResult = EPass;
       
   713 	else
       
   714 		iTestStepResult = EFail;
       
   715 
       
   716 	return iTestStepResult;
       
   717 	}
       
   718 
       
   719 //
       
   720 //	Test step 017.07
       
   721 //
       
   722 
       
   723 // constructor
       
   724 CCommDbTest017_07::CCommDbTest017_07()
       
   725 	{
       
   726 	// store the name of this test case
       
   727 	iTestStepName = _L("step_017_07");
       
   728 	}
       
   729 
       
   730 // destructor
       
   731 CCommDbTest017_07::~CCommDbTest017_07()
       
   732 	{
       
   733 	}
       
   734 
       
   735 TVerdict CCommDbTest017_07::doTestStepL( )
       
   736 	{
       
   737 	Log(_L("Step 017.07 called "));
       
   738 
       
   739 	iTestStepResult = EPass;
       
   740 
       
   741 		// Heap test for 017.06
       
   742 		
       
   743 //	copyTestDatabase( EDatabase_1 );
       
   744 	CCommDbTest017_06* step017_06 = new(ELeave) CCommDbTest017_06;
       
   745 	CleanupStack::PushL(step017_06);
       
   746 	step017_06->iSuite = iSuite;
       
   747 	if ( doTestStepWithHeapFailureL( *step017_06, KErrNone) == EFail )
       
   748 		iTestStepResult = EFail;
       
   749 	CleanupStack::PopAndDestroy(step017_06);
       
   750 
       
   751 	return iTestStepResult;	
       
   752 
       
   753 }
       
   754