telephonyutils/telephonywatchers/Test/TE_TelWatchers/TE_TelWatchersUnitTest.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     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 // Telephony Watchers Unit Test main test code.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20 */
       
    21 
       
    22 #include <e32uid.h>
       
    23 #include <f32file.h>
       
    24 #include <bafindf.h>
       
    25 #include <cdbcols.h>
       
    26 
       
    27 #include "indicatorwatcher.h"
       
    28 #include "signalstrengthwatcher.h"
       
    29 
       
    30 #include "TE_TelWatchersUnitBase.h"
       
    31 #include "TE_TelWatchersUnitTest.h"
       
    32 
       
    33 //
       
    34 // Constants...
       
    35 //
       
    36 const TInt  KExpectedCallStateChanges(4);
       
    37 const TInt  KExpectedBatteryChargerStateChanges(4);
       
    38 const TInt  KExpectedNetworkAvailabilityStateChanges(4);
       
    39 const TInt  KSimulatedCommDBChanges(10);
       
    40 
       
    41 /**
       
    42  *  Each test step initialises it's own name
       
    43  */
       
    44 CTelWatchersUnitTestCallStateChangesWithPublishSubscribe::CTelWatchersUnitTestCallStateChangesWithPublishSubscribe()
       
    45 	{
       
    46 	//
       
    47 	// Store the name of this test case.  This is the name that is used by
       
    48 	// the script file.
       
    49 	//
       
    50 	SetTestStepName(_L("TestCallStateChangesWithPublishSubscribe"));
       
    51 	} // CTelWatchersUnitTestCallStateChangesWithPublishSubscribe::CTelWatchersUnitTestCallStateChangesWithPublishSubscribe
       
    52 
       
    53 
       
    54 /**
       
    55  *  Simple destructor.
       
    56  */
       
    57 CTelWatchersUnitTestCallStateChangesWithPublishSubscribe::~CTelWatchersUnitTestCallStateChangesWithPublishSubscribe()
       
    58 	{
       
    59 	// NOP
       
    60 	} // CTelWatchersUnitTestCallStateChangesWithPublishSubscribe::~CTelWatchersUnitTestCallStateChangesWithPublishSubscribe
       
    61 
       
    62 
       
    63 /**
       
    64  *  This test monitors the call state notifications and checks they
       
    65  *  are as expected and valid.
       
    66  */	
       
    67 enum TVerdict CTelWatchersUnitTestCallStateChangesWithPublishSubscribe::doTestStepL()
       
    68 	{
       
    69 	SetSimTsyTestNumberL(0);
       
    70 
       
    71 	RProperty propCurrCallState; //- property that reflects current call state	
       
    72 	TInt propVal = KErrUnknown;  //- value of the property
       
    73 
       
    74 	INFO_PRINTF2(_L("Wait for %d call state changes with publish and subscribe"),
       
    75 		         KExpectedCallStateChanges);
       
    76 
       
    77 	//-- attach to KUidCurrentCall property
       
    78 	TESTL(propCurrCallState.Attach(KUidSystemCategory,KUidCurrentCall.iUid) == KErrNone);
       
    79 
       
    80 	//
       
    81 	// Install the Indicator and Signal Strength watcher...
       
    82 	//
       
    83 	TInt dummyWatcherParams;
       
    84 	CIndicatorWatcher*  indicatorWatcher = CIndicatorWatcher::NewL((TAny*)&dummyWatcherParams);
       
    85 
       
    86 	CleanupStack::PushL(indicatorWatcher);
       
    87 
       
    88 	CSignalStrengthWatcher*  signalStrengthWatcher = CSignalStrengthWatcher::NewL((TAny*)&dummyWatcherParams);
       
    89 	CleanupStack::PushL(signalStrengthWatcher);
       
    90 
       
    91 	//
       
    92 	// Prepare indicator watcher to return random call state
       
    93 	// values...
       
    94 	//
       
    95   	TESTL(RProperty::Set(KUidSystemCategory, KUidTestProp_CallStateChange.iUid, 0) == KErrNone);
       
    96   	
       
    97 	//
       
    98 	// Wait for the change events...
       
    99 	//
       
   100 	CWatcherObserverPS* watcher = new(ELeave) CWatcherObserverPS;
       
   101 	CleanupStack::PushL(watcher);
       
   102 	
       
   103 	watcher->BindProperty(&propCurrCallState);
       
   104 
       
   105 	TInt  counter;
       
   106 
       
   107 	for (counter = 0;  counter < KExpectedCallStateChanges;  counter++)
       
   108 		{
       
   109 		//
       
   110 		// Prepares a notify request and starts the scheduler. Stops the
       
   111 		// scheduler when notify is detected.
       
   112 		//
       
   113         watcher->WaitForPropertyChangeL();
       
   114 
       
   115         //-- get property value after it has been updated
       
   116        TESTL(watcher->GetPropertyValue(propVal) == KErrNone);
       
   117 
       
   118 		//
       
   119 		// Print the state...
       
   120 		//
       
   121 		switch (propVal)
       
   122 			{
       
   123 			case ESACallNone:
       
   124 				{
       
   125 				INFO_PRINTF1(_L("  Call None."));
       
   126 				}
       
   127 				break;
       
   128 
       
   129 			case ESACallVoice:
       
   130 				{
       
   131 				INFO_PRINTF1(_L("  Call Voice."));
       
   132 				}
       
   133 				break;
       
   134 
       
   135 			case ESACallFax:
       
   136 				{
       
   137 				INFO_PRINTF1(_L("  Call Fax."));
       
   138 				}
       
   139 				break;
       
   140 
       
   141 			case ESACallData:
       
   142 				{
       
   143 				INFO_PRINTF1(_L("  Call Data."));
       
   144 				}
       
   145 				break;
       
   146 
       
   147 			case ESACallAlerting:
       
   148 				{
       
   149 				INFO_PRINTF1(_L("  Call Alerting."));
       
   150 				}
       
   151 				break;
       
   152 
       
   153 			case ESACallRinging:
       
   154 				{
       
   155 				INFO_PRINTF1(_L("  Call Ringing."));
       
   156 				}
       
   157 				break;
       
   158 
       
   159 			case ESACallAlternating:
       
   160 				{
       
   161 				INFO_PRINTF1(_L("  Call Alternating."));
       
   162 				}
       
   163 				break;
       
   164 
       
   165 			default:
       
   166 				{
       
   167 				INFO_PRINTF2(_L("Failed: Unknown state returned (%d)!"), propVal);
       
   168 		        SetTestStepResult(EFail);
       
   169 				}
       
   170 				break;
       
   171 			}
       
   172 		}
       
   173 
       
   174 	CleanupStack::PopAndDestroy(watcher);
       
   175 	CleanupStack::PopAndDestroy(signalStrengthWatcher);
       
   176 	CleanupStack::PopAndDestroy(indicatorWatcher);
       
   177 
       
   178 	return TestStepResult();
       
   179 	} // CTelWatchersUnitTestCallStateChangesWithPublishSubscribe::doTestStepL
       
   180 
       
   181 /**
       
   182  *  Each test step initialises it's own name
       
   183  */
       
   184 CTelWatchersUnitTestBatteryChargerChangesWithPublishSubscribe::CTelWatchersUnitTestBatteryChargerChangesWithPublishSubscribe()
       
   185 	{
       
   186 	//
       
   187 	// Store the name of this test case.  This is the name that is used by
       
   188 	// the script file.
       
   189 	//
       
   190 	SetTestStepName(_L("TestBatteryChargerChangesWithPublishSubscribe"));
       
   191 	} // CTelWatchersUnitTestBatteryChargerChangesWithPublishSubscribe::CTelWatchersUnitTestBatteryChargerChangesWithPublishSubscribe
       
   192 
       
   193 
       
   194 /**
       
   195  *  Simple destructor.
       
   196  */
       
   197 CTelWatchersUnitTestBatteryChargerChangesWithPublishSubscribe::~CTelWatchersUnitTestBatteryChargerChangesWithPublishSubscribe()
       
   198 	{
       
   199 	// NOP
       
   200 	} // CTelWatchersUnitTestBatteryChargerChangesWithPublishSubscribe::~CTelWatchersUnitTestBatteryChargerChangesWithPublishSubscribe
       
   201 
       
   202 
       
   203 /**
       
   204  *  This test monitors the battery charger notifications and checks they
       
   205  *  are as expected and valid.
       
   206  */	
       
   207 enum TVerdict CTelWatchersUnitTestBatteryChargerChangesWithPublishSubscribe::doTestStepL()
       
   208 	{
       
   209 	SetSimTsyTestNumberL(0);
       
   210 
       
   211 	RProperty propChargerState;  //- property that reflects phone charger state
       
   212 	TInt propVal = KErrUnknown;  //- value of the property
       
   213 
       
   214 	INFO_PRINTF2(_L("Wait for %d battery charger changes with publish and subscribe"),
       
   215 		         KExpectedBatteryChargerStateChanges);
       
   216 
       
   217 	//-- attach to KUidChargerStatus property
       
   218 	TESTL(propChargerState.Attach(KUidSystemCategory,KUidChargerStatus.iUid) == KErrNone);
       
   219 
       
   220 	//
       
   221 	// Install the Indicator and Signal Strength watcher...
       
   222 	//
       
   223     TInt dummyWatcherParams;
       
   224 	CIndicatorWatcher*  indicatorWatcher = CIndicatorWatcher::NewL((TAny*)&dummyWatcherParams);
       
   225 
       
   226 	CleanupStack::PushL(indicatorWatcher);
       
   227 
       
   228 	CSignalStrengthWatcher*  signalStrengthWatcher = CSignalStrengthWatcher::NewL((TAny*)&dummyWatcherParams);
       
   229 	CleanupStack::PushL(signalStrengthWatcher);
       
   230 
       
   231 	//
       
   232 	// Prepare indicator watcher to return random battery values...
       
   233 	//
       
   234 	//
       
   235 	TESTL(RProperty::Set(KUidSystemCategory, KUidTestProp_CallStateChange.iUid, 1) == KErrNone);
       
   236 
       
   237 	//
       
   238 	// Wait for the change events...
       
   239 	//	
       
   240 	CWatcherObserverPS* watcher = new(ELeave) CWatcherObserverPS;
       
   241 	CleanupStack::PushL(watcher);
       
   242 	watcher->BindProperty( &propChargerState );
       
   243 	TInt counter;
       
   244 	
       
   245 	for (counter = 0;  counter < KExpectedBatteryChargerStateChanges;  counter++)
       
   246 		{
       
   247 		//
       
   248 		// Prepares a notify request and starts the scheduler. Stops the scheduler
       
   249 		// when notify is detected.
       
   250 		//
       
   251 		watcher->WaitForPropertyChangeL();
       
   252 
       
   253         //-- get property value after it has been updated
       
   254         TESTL(watcher->GetPropertyValue(propVal) == KErrNone);
       
   255 
       
   256 		//
       
   257 		// Print state...
       
   258 		//
       
   259 		switch (propVal)
       
   260 			{
       
   261 			case ESAChargerConnected:
       
   262 				{
       
   263 				INFO_PRINTF1(_L("  Charger connected."));
       
   264 				}
       
   265 				break;
       
   266 
       
   267 			case ESAChargerDisconnected:
       
   268 				{
       
   269 				INFO_PRINTF1(_L("  Charger disconnected."));
       
   270 				}
       
   271 				break;
       
   272 
       
   273 			case ESAChargerNotCharging:
       
   274 				{
       
   275 				INFO_PRINTF1(_L("  Not charging."));
       
   276 				}
       
   277 				break;
       
   278 
       
   279 			default:
       
   280 				{
       
   281 				INFO_PRINTF2(_L("Failed: Unknown state returned (%d)!"), propVal);
       
   282 		        SetTestStepResult(EFail);
       
   283 				}
       
   284 				break;
       
   285 			}
       
   286 		}
       
   287 
       
   288 	CleanupStack::PopAndDestroy(watcher);
       
   289 	CleanupStack::PopAndDestroy(signalStrengthWatcher);
       
   290 	CleanupStack::PopAndDestroy(indicatorWatcher);
       
   291 
       
   292 	return TestStepResult();
       
   293 	} // CTelWatchersUnitTestBatteryChargerChangesWithPublishSubscribe::doTestStepL
       
   294 
       
   295 /**
       
   296  *  Each test step initialises it's own name
       
   297  */
       
   298 CTelWatchersUnitTestNetworkAvailabilityChangesWithPublishSubscribe::CTelWatchersUnitTestNetworkAvailabilityChangesWithPublishSubscribe()
       
   299 	{
       
   300 	//
       
   301 	// Store the name of this test case.  This is the name that is used by
       
   302 	// the script file.
       
   303 	//
       
   304 	SetTestStepName(_L("TestNetworkAvailabilityChangesWithPublishSubscribe"));
       
   305 	} // CTelWatchersUnitTestNetworkAvailabilityChangesWithPublishSubscribe::CTelWatchersUnitTestNetworkAvailabilityChangesWithPublishSubscribe
       
   306 
       
   307 
       
   308 /**
       
   309  *  Simple destructor.
       
   310  */
       
   311 CTelWatchersUnitTestNetworkAvailabilityChangesWithPublishSubscribe::~CTelWatchersUnitTestNetworkAvailabilityChangesWithPublishSubscribe()
       
   312 	{
       
   313 	// NOP
       
   314 	} // CTelWatchersUnitTestNetworkAvailabilityChangesWithPublishSubscribe::~CTelWatchersUnitTestNetworkAvailabilityChangesWithPublishSubscribe
       
   315 
       
   316 
       
   317 /**
       
   318  *  This test monitors the network availablity notifications and checks they
       
   319  *  are as expected and valid.
       
   320  */	
       
   321 enum TVerdict CTelWatchersUnitTestNetworkAvailabilityChangesWithPublishSubscribe::doTestStepL()
       
   322 	{
       
   323 	SetSimTsyTestNumberL(0);
       
   324 
       
   325 	RProperty propNetworkState;  //- property that reflects phone charger state
       
   326 	TInt propVal = KErrUnknown;  //- value of the property
       
   327 	
       
   328 	INFO_PRINTF2(_L("Wait for %d network availability changes with publish and subscribe"),
       
   329 		         KExpectedNetworkAvailabilityStateChanges);
       
   330 
       
   331 	//-- attach to KUidCurrentCall property
       
   332 	TESTL(propNetworkState.Attach(KUidSystemCategory,KUidNetworkStatus.iUid) == KErrNone);
       
   333 
       
   334 	//
       
   335 	// Install the Indicator and Signal Strength watcher...
       
   336 	//
       
   337     TInt dummyWatcherParams;
       
   338 	CIndicatorWatcher*  indicatorWatcher = CIndicatorWatcher::NewL((TAny*)&dummyWatcherParams);
       
   339 
       
   340 	CleanupStack::PushL(indicatorWatcher);
       
   341 
       
   342 	CSignalStrengthWatcher*  signalStrengthWatcher = CSignalStrengthWatcher::NewL((TAny*)&dummyWatcherParams);
       
   343 	CleanupStack::PushL(signalStrengthWatcher);
       
   344 
       
   345 	//
       
   346 	// Prepare indicator watcher to return random network state
       
   347 	// values...
       
   348 	//
       
   349 	TESTL(RProperty::Set(KUidSystemCategory, KUidTestProp_CallStateChange.iUid, 2) == KErrNone);
       
   350 
       
   351 	//
       
   352 	// Wait for the change events...
       
   353 	//
       
   354 	CWatcherObserverPS* watcher = new(ELeave) CWatcherObserverPS;
       
   355 	CleanupStack::PushL(watcher);
       
   356 	watcher->BindProperty( &propNetworkState );
       
   357 	TInt counter;
       
   358 
       
   359 	for (counter = 0;  counter < KExpectedNetworkAvailabilityStateChanges;  counter++)
       
   360 		{
       
   361 		//
       
   362 		// Prepares a notify request and starts the scheduler. Stops the
       
   363 		// scheduler when notify is detected.
       
   364 		//
       
   365 		watcher->WaitForPropertyChangeL();
       
   366 
       
   367         //-- get property value after it has been updated
       
   368         TESTL(watcher->GetPropertyValue(propVal) == KErrNone);
       
   369 
       
   370 		//
       
   371 		// Print state...
       
   372 		//
       
   373 		switch(propVal)
       
   374 			{
       
   375 			case ESANetworkAvailable:
       
   376 				{
       
   377 				INFO_PRINTF1(_L("  Network available."));
       
   378 				}
       
   379 				break;
       
   380 
       
   381 			case ESANetworkUnAvailable:
       
   382 				{
       
   383 				INFO_PRINTF1(_L("  Network unavailable."));
       
   384 				}
       
   385 				break;
       
   386 				
       
   387 			default:
       
   388 				{
       
   389 				INFO_PRINTF2(_L("Failed: Unknown state returned (%d)!"), propVal);
       
   390 		        SetTestStepResult(EFail);
       
   391 				}
       
   392 				break;
       
   393 			}
       
   394 		}
       
   395 	
       
   396 	CleanupStack::PopAndDestroy(watcher);
       
   397 	CleanupStack::PopAndDestroy(signalStrengthWatcher);
       
   398 	CleanupStack::PopAndDestroy(indicatorWatcher);
       
   399 
       
   400 	return TestStepResult();
       
   401 	} // CTelWatchersUnitTestNetworkAvailabilityChangesWithPublishSubscribe::doTestStepL
       
   402 
       
   403 /**
       
   404  *  Each test step initialises it's own name
       
   405  */
       
   406 CTelWatchersUnitTestSimulteCommDBModemChangeWithPublishSubscribe::CTelWatchersUnitTestSimulteCommDBModemChangeWithPublishSubscribe()
       
   407 	{
       
   408 	//
       
   409 	// Store the name of this test case.  This is the name that is used by
       
   410 	// the script file.
       
   411 	//
       
   412 	SetTestStepName(_L("TestSimulteCommDBModemChangeWithPublishSubscribe"));
       
   413 	} //CTelWatchersUnitTestSimulteCommDBModemChangeWithPublishSubscribe::CTelWatchersUnitTestSimulteCommDBModemChangeWithPublishSubscribe
       
   414 
       
   415 
       
   416 /**
       
   417  *  Simple destructor.
       
   418  */
       
   419 CTelWatchersUnitTestSimulteCommDBModemChangeWithPublishSubscribe::~CTelWatchersUnitTestSimulteCommDBModemChangeWithPublishSubscribe()
       
   420 	{
       
   421 	// NOP
       
   422 	} // CTelWatchersUnitTestSimulteCommDBModemChangeWithPublishSubscribe::~CTelWatchersUnitTestSimulteCommDBModemChangeWithPublishSubscribe
       
   423 
       
   424 
       
   425 /**
       
   426  *  This test issues a number of CommDB table update requests to the Watcher and
       
   427  *  checks that the CommDB table is re-read.
       
   428  */	
       
   429 enum TVerdict CTelWatchersUnitTestSimulteCommDBModemChangeWithPublishSubscribe::doTestStepL()
       
   430 	{	
       
   431 	SetSimTsyTestNumberL(0);
       
   432 
       
   433 	INFO_PRINTF2(_L("Simulate %d CommDB default modem changes with publish and subscribe"),
       
   434 		         KSimulatedCommDBChanges);
       
   435 	
       
   436 	RProperty propMdmRecordChanged;   //-- modem record change property (debug only)
       
   437 	RProperty propMdmTableRefreshed;  //-- modem table re-read property (debug only)
       
   438 
       
   439 	TESTL(propMdmRecordChanged.Attach(KUidSystemCategory, KUidTestProp_ModemRecordChanged.iUid) == KErrNone);
       
   440 	TESTL(propMdmTableRefreshed.Attach(KUidSystemCategory, KUidTestProp_ModemTableRefreshed.iUid) == KErrNone);
       
   441 
       
   442 	//
       
   443 	// Install the Indicator and Signal Strength watcher...
       
   444 	//
       
   445     TInt dummyWatcherParams;
       
   446 	CIndicatorWatcher*  indicatorWatcher = CIndicatorWatcher::NewL((TAny*)&dummyWatcherParams);
       
   447 	CleanupStack::PushL(indicatorWatcher);
       
   448 
       
   449 	CSignalStrengthWatcher*  signalStrengthWatcher = CSignalStrengthWatcher::NewL((TAny*)&dummyWatcherParams);
       
   450 	CleanupStack::PushL(signalStrengthWatcher);
       
   451 
       
   452 	//
       
   453 	// Allow a few seconds for the Active Objects to start...
       
   454 	//
       
   455 	PauseToRunActiveSchedulerL(10);
       
   456 
       
   457 	//
       
   458 	// Wait for the change events...
       
   459 	//
       
   460 	CWatcherObserverPS* watcher = new(ELeave) CWatcherObserverPS;
       
   461 	CleanupStack::PushL(watcher);
       
   462 	TInt  counter;
       
   463 
       
   464 	for (counter = 0;  counter < KSimulatedCommDBChanges;  counter++)
       
   465 		{
       
   466 		//
       
   467 		// Send some comm db modem record change events
       
   468 		//
       
   469 		TTime  time;
       
   470 		time.UniversalTime();
       
   471 
       
   472         TESTL(RProperty::Set(KUidSystemCategory, KUidCommDbModemPhoneServicesAndSMSChange.iUid, I64LOW(time.Int64())) == KErrNone );
       
   473 
       
   474 		//
       
   475 		// Now wait for an ack that the change was spotted...
       
   476 		//
       
   477         watcher->BindProperty(&propMdmRecordChanged);
       
   478         watcher->WaitForPropertyChangeL();
       
   479 
       
   480 		INFO_PRINTF1(_L("  CommDB change has been spotted."));
       
   481 
       
   482 		//
       
   483 		// Now wait for an ack that the modem table has been re-read ok
       
   484 		//
       
   485         watcher->BindProperty(&propMdmTableRefreshed);
       
   486         watcher->WaitForPropertyChangeL();
       
   487         
       
   488 		INFO_PRINTF1(_L("  Modem table has been re-read."));
       
   489 
       
   490 		//
       
   491 		// Now wait a few seconds before trying again
       
   492 		//
       
   493 		PauseToRunActiveSchedulerL(10);
       
   494 		}
       
   495 
       
   496 	CleanupStack::PopAndDestroy(watcher);
       
   497 	CleanupStack::PopAndDestroy(signalStrengthWatcher);
       
   498 	CleanupStack::PopAndDestroy(indicatorWatcher);
       
   499 
       
   500 	return TestStepResult();
       
   501 	} // CTelWatchersUnitTestSimulteCommDBModemChangeWithPublishSubscribe::doTestStepL
       
   502 
       
   503 
       
   504 /**
       
   505  *  Each test step initialises it's own name
       
   506  */
       
   507 CTelWatchersUnitTestCommDBChangeWhenWatcherDisabledWithPublishSubscribe::CTelWatchersUnitTestCommDBChangeWhenWatcherDisabledWithPublishSubscribe()
       
   508 	{
       
   509 	//
       
   510 	// Store the name of this test case.  This is the name that is used by
       
   511 	// the script file.
       
   512 	//
       
   513 	SetTestStepName(_L("TestCommDBChangeWhenWatcherDisabledWithPublishSubscribe"));
       
   514 	} // CTelWatchersUnitTestCommDBChangeWhenWatcherDisabledWithPublishSubscribe::CTelWatchersUnitTestCommDBChangeWhenWatcherDisabledWithPublishSubscribe
       
   515 
       
   516 
       
   517 /**
       
   518  *  Simple destructor.
       
   519  */
       
   520 CTelWatchersUnitTestCommDBChangeWhenWatcherDisabledWithPublishSubscribe::~CTelWatchersUnitTestCommDBChangeWhenWatcherDisabledWithPublishSubscribe()
       
   521 	{
       
   522 	// NOP
       
   523 	} // CTelWatchersUnitTestCommDBChangeWhenWatcherDisabledWithPublishSubscribe::~CTelWatchersUnitTestCommDBChangeWhenWatcherDisabledWithPublishSubscribe
       
   524 
       
   525 
       
   526 /**
       
   527  *  This test checks that the Watcher notices a CommDB change whilst the Watcher
       
   528  *  are disabled.
       
   529  */	
       
   530 enum TVerdict CTelWatchersUnitTestCommDBChangeWhenWatcherDisabledWithPublishSubscribe::doTestStepL()
       
   531 	{
       
   532 	SetSimTsyTestNumberL(0);
       
   533 
       
   534 	INFO_PRINTF1(_L("Test sending a CommDB change when the watcher is disabled with publish and subscribe"));
       
   535 
       
   536 	RProperty propPhoneWatcherDisable;//-- Phone watchers disabling/reset (debug only)
       
   537 	RProperty propMdmRecordChanged;   //-- modem record change property   (debug only)
       
   538 	RProperty propMdmTableRefreshed;  //-- modem table re-read property (debug only)
       
   539 
       
   540 	TESTL(propPhoneWatcherDisable.Attach(KUidSystemCategory, KUidTestProp_WatchersDisable.iUid) == KErrNone);
       
   541 	TESTL(propMdmRecordChanged.Attach(KUidSystemCategory, KUidTestProp_ModemRecordChanged.iUid) == KErrNone);
       
   542 	TESTL(propMdmTableRefreshed.Attach(KUidSystemCategory, KUidTestProp_ModemTableRefreshed.iUid) == KErrNone);
       
   543 
       
   544 	//
       
   545 	// Install the Indicator and Signal Strength watcher...
       
   546 	//
       
   547     TInt dummyWatcherParams;
       
   548 	CIndicatorWatcher*  indicatorWatcher = CIndicatorWatcher::NewL((TAny*)&dummyWatcherParams);
       
   549 	CleanupStack::PushL(indicatorWatcher);
       
   550 
       
   551 	CSignalStrengthWatcher*  signalStrengthWatcher = CSignalStrengthWatcher::NewL((TAny*)&dummyWatcherParams);
       
   552 	CleanupStack::PushL(signalStrengthWatcher);
       
   553 
       
   554 	//
       
   555 	// Allow a few seconds for the Active Objects to start...
       
   556 	//
       
   557 	PauseToRunActiveSchedulerL(10);
       
   558 
       
   559 
       
   560 	//
       
   561 	// To wait for the change events...
       
   562 	//
       
   563 	CWatcherObserverPS* watcher = new(ELeave) CWatcherObserverPS();
       
   564 	CleanupStack::PushL(watcher);
       
   565 
       
   566 	//
       
   567 	// Disable the watcher by setting the property...
       
   568 	//
       
   569 	TESTL(propPhoneWatcherDisable.Set(ETrue) == KErrNone );
       
   570     
       
   571 	INFO_PRINTF1(_L("  Watcher has been disabled."));
       
   572 
       
   573 	//
       
   574 	// Send some Comm DB modem record change events...
       
   575 	//
       
   576 	TTime  time;
       
   577 	time.UniversalTime();
       
   578 
       
   579 	TESTL(RProperty::Set(KUidSystemCategory, KUidCommDbModemPhoneServicesAndSMSChange.iUid, I64LOW(time.Int64())) == KErrNone );
       
   580     
       
   581 	//
       
   582 	// Now wait for an ack that the change was spotted...
       
   583 	//
       
   584 	watcher->BindProperty(&propMdmRecordChanged);
       
   585 	watcher->WaitForPropertyChangeL();
       
   586 	INFO_PRINTF1(_L("  CommDB change has been spotted."));
       
   587 
       
   588 	//
       
   589 	// Now wait for an ack that the modem table has been re-read ok
       
   590 	//
       
   591 	watcher->BindProperty(&propMdmTableRefreshed);
       
   592 	watcher->WaitForPropertyChangeL();
       
   593 	INFO_PRINTF1(_L("  Modem table has been re-read."));
       
   594 
       
   595 	//
       
   596 	// Now wait a few seconds before trying again...
       
   597 	//
       
   598 	PauseToRunActiveSchedulerL(10);
       
   599 
       
   600 	CleanupStack::PopAndDestroy(watcher);
       
   601 	CleanupStack::PopAndDestroy(signalStrengthWatcher);
       
   602 	CleanupStack::PopAndDestroy(indicatorWatcher);
       
   603 
       
   604 	return TestStepResult();
       
   605 	} // CTelWatchersUnitTestCommDBChangeWhenWatcherDisabledWithPublishSubscribe::doTestStepL