/**
either release resource after countdown has reached the necessary value
or timeout test if countdown is not started after the timeout period has passed
*/
void CConcurrentTimeOutNotifierStep::ProcessWaitL(const TBool aTransaction)
	{
	StartCountdownL();
	iEnd.UniversalTime();
	const TInt64 KLockTime = iEnd.MicroSecondsFrom( iStart ).Int64();
	const TInt64 KTestTime = iEnd.MicroSecondsFrom( iTestStart ).Int64();
	if( iCountdown && ( KLockTime >= ((iSeconds - KTimeDiff) * KOneSecond) ) )
		{
		iWaiting = EFalse;
		iCountdown = EFalse;
		if(aTransaction)
			{
			iContactsDatabase->DatabaseCommitL( EFalse );//unlock database
			}
		else
			{
			CloseL( ETrue );//unlock contact
			}
		++iNextTest;
		SetSharedTextL(KSharedNextTest, KDoubleChar, EFalse);
		}
	else if( KTestTime > KTimeout ) //test has timed out
		{
		_LIT(KTimedOut,"Notifier test %d has timed out");
		ERR_PRINTF2(KTimedOut, ++iNextTest);
		iWaiting = EFalse;
		iCountdown = EFalse;
		TESTPRINT( EFalse );
		SetSharedTextL(KSharedNextTest, KDoubleChar, EFalse);
		iNextTest = iTests->Count();
		}
	//else test is not complete and has not timed out... continue waiting
	}
Exemplo n.º 2
0
/**
Sets the value of all shared memmories to Null
used at beginning/end of test case
*/
void CConcurrentNotifierStep::ClearSharedL()
	{
	SetSharedTextL(KSharedEvents, KNullDesC, EFalse);
	SetSharedTextL(KSharedContact, KNullDesC, EFalse);
	SetSharedTextL(KSharedClients, KNullDesC, EFalse);
	SetSharedTextL(KSharedMessageCount, KNullDesC, EFalse);
	}
Exemplo n.º 3
0
void CConcurrentNotifierStep::SpeedDialTestL()
	{
	INFO_PRINTF1(KTest8);
	SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue);
	iWaiting = ETrue;
	iMyActive->Activate();
	TContactItemId cid = iIterate->PreviousL();//start at last contact, so that other tests are not corrupted
	OpenL( cid );
	TInt fieldId=iFields->Find(KUidContactFieldPhoneNumber);
	iSpeedPosition = 1;
	iContactsDatabase->SetFieldAsSpeedDialL(*iContactItem, fieldId, iSpeedPosition);
	CloseL( EFalse );
	OpenL( cid );
	iSpeedPosition2 = 2;
	iContactsDatabase->SetFieldAsSpeedDialL(*iContactItem, fieldId, iSpeedPosition2);
	CloseL( EFalse );
	AddEventL( EContactDbObserverEventSpeedDialsChanged );
	AddContactL( cid );
	AddEventL( EContactDbObserverEventSpeedDialsChanged );
	AddContactL( cid );
	AddEventL( EContactDbObserverEventSpeedDialsChanged );
	AddContactL( cid );
	SetMessageCountL();
	iStart.UniversalTime();
	}
Exemplo n.º 4
0
TVerdict CConcurrentNotifierStep::doTestStepPostambleL()
	{
	_LIT(KPostamblePrint,"I am in CConcurrentNotifierStep doTestStepPostambleL()");
	INFO_PRINTF1(KPostamblePrint);
	ClearSharedL();
	SetSharedTextL(KSharedNextTest, KNullDesC, EFalse);
	return CPerformanceFunctionalityBase::doTestStepPostambleL();
	}
Exemplo n.º 5
0
void CConcurrentNotifierStep::DeleteTestL()
	{
	INFO_PRINTF1(KTest4);
	SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue);
	iWaiting = ETrue;
	TContactItemId cid = iIterate->NextL();
	DeleteContactL( cid, EFalse );
	AddEventL(EContactDbObserverEventContactDeleted);
	AddContactL( cid );
	SetMessageCountL();
	iStart.UniversalTime();
	}
Exemplo n.º 6
0
void CConcurrentNotifierStep::CloseTablesTestL()
	{
	INFO_PRINTF1(KTest6);
	SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue);
	iWaiting = ETrue;
	iMyActive->Activate();
	iContactsDatabase->CloseTables();
	AddEventL( EContactDbObserverEventTablesClosed );
	AddContactL( 0 );
	SetMessageCountL();
	iStart.UniversalTime();
	}
/**
wait for message from listener specifying that countdown to release of resource should commence
*/
void CConcurrentTimeOutNotifierStep::StartCountdownL()
	{
	if ( iCountdown )
		{
		return;
		}
	iCountdown = SharedCountL(KSharedClients) > 0;
	if (iCountdown)
		{
		iStart.UniversalTime();
		SetSharedTextL(KSharedClients, KNullDesC, EFalse);
		}
	}
Exemplo n.º 8
0
void CConcurrentNotifierStep::AddTestL()
	{
	INFO_PRINTF1(KTest3);
	SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue);
	iWaiting = ETrue;
	CContactCard* contact = CContactCard::NewLC(iTemplate);
	TContactItemId cid = iContactsDatabase->AddNewContactL(*contact);
	iIterate->AddL( cid );
	CleanupStack::PopAndDestroy(contact);
	AddEventL(EContactDbObserverEventContactAdded);
	AddContactL( cid );
	SetMessageCountL();
	iStart.UniversalTime();
	}
Exemplo n.º 9
0
void CConcurrentNotifierStep::OwnCardDeleteTestL()
	{
	INFO_PRINTF1(KTest9);
	SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue);
	iWaiting = ETrue;
	iMyActive->Activate();
	TContactItemId cid = iContactsDatabase->OwnCardId();
	ReadL( cid );
	CloseL( EFalse );
	DeleteContactL( cid, EFalse );
	AddEventL( EContactDbObserverEventOwnCardDeleted );
	AddContactL( cid);
	SetMessageCountL();
	iStart.UniversalTime();
	}
Exemplo n.º 10
0
void CConcurrentNotifierStep::ChangeOwnCardTestL()
	{
	INFO_PRINTF1(KTest14);
	SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue);
	iWaiting = ETrue;
	iMyActive->Activate();
	TContactItemId cid = iIterate->NextL();
	OpenL( cid );
	iContactsDatabase->SetOwnCardL(*iContactItem);
	CloseL( ETrue );
	AddEventL( EContactDbObserverEventOwnCardChanged );
	AddContactL( cid );
	SetMessageCountL();
	iStart.UniversalTime();
	}
Exemplo n.º 11
0
void CConcurrentNotifierStep::UpdateTestL()
	{
	INFO_PRINTF1(KTest1);
	SetSharedTextL(KSharedNextTest,KSingleCharacter , ETrue);
	iWaiting = ETrue;
	TContactItemId cid = iIterate->NextL();
	ReadL( cid );
	iContactsDatabase->UpdateContactLC( cid, iContactItem);
	CleanupStack::PopAndDestroy();
	CloseL( ETrue );
	AddEventL(EContactDbObserverEventContactChanged);
	AddContactL( cid );
	SetMessageCountL();
	iStart.UniversalTime();
	}
Exemplo n.º 12
0
void CConcurrentNotifierStep::RemoveSpeedDialTestL()
	{
	INFO_PRINTF1(KTest16);
	SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue);
	iWaiting = ETrue;
	iMyActive->Activate();
	TBuf<200> ptr;
	TContactItemId cid = iContactsDatabase->GetSpeedDialFieldL(iSpeedPosition2, ptr);
	iContactsDatabase->RemoveSpeedDialFieldL(cid, iSpeedPosition2);

	AddEventL( EContactDbObserverEventSpeedDialsChanged );
	AddContactL( cid );
	SetMessageCountL();
	iStart.UniversalTime();
	}
Exemplo n.º 13
0
void CConcurrentNotifierStep::MultipleChangeTransactionTestL()
	{
	if( iRevert )
		{
		INFO_PRINTF1(KTest112);
		}
	else
		{
		INFO_PRINTF1(KTest11);
		}
	SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue);
	iWaiting = ETrue;
	TContactItemId cid = iIterate->NextL();

	iContactsDatabase->DatabaseBeginLC(EFalse);
	OpenL( cid );
	CommitL( ETrue );
	AddEventL(EContactDbObserverEventContactChanged);
	AddContactL( cid );

	cid = iIterate->NextL();
	ReadL( cid );
	iContactsDatabase->UpdateContactLC( cid, iContactItem);
	CleanupStack::PopAndDestroy();
	CloseL( ETrue );
	AddEventL(EContactDbObserverEventContactChanged);
	AddContactL( cid );

	CContactCard* contact = CContactCard::NewLC(iTemplate);
	cid = iContactsDatabase->doAddNewContactL(*contact, EFalse, ETrue);
	if(!iRevert)
		{
		iIterate->AddL( cid );
		}
	CleanupStack::PopAndDestroy(contact);
	AddEventL(EContactDbObserverEventContactAdded);
	AddContactL( cid );

	cid = iIterate->NextL();
	DeleteContactL( cid, ETrue );
	AddEventL(EContactDbObserverEventContactDeleted);
	AddContactL( cid );

	EndTransactionL();
	SetMessageCountL();

	iStart.UniversalTime();
	}
Exemplo n.º 14
0
void CConcurrentNotifierStep::OwnCardTestL()
	{
	INFO_PRINTF1(KTest7);
	SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue);
	iWaiting = ETrue;
	iMyActive->Activate();
	CContactItem *item = iContactsDatabase->CreateOwnCardLC();
	iIterate->AddL( item->Id() );
	AddEventL( EContactDbObserverEventContactAdded );
	AddContactL( item->Id() );
	AddEventL( EContactDbObserverEventOwnCardChanged );
	AddContactL( item->Id() );
	CleanupStack::PopAndDestroy( item );
	SetMessageCountL();
	iStart.UniversalTime();
	}
Exemplo n.º 15
0
TVerdict CConcurrentNotifierStep::doTestStepL()
	{
	__UHEAP_MARK;
	InitializeL();
	_LIT(KDoStepPrint,"CTransactionsStep::doTestStepL()");
	INFO_PRINTF1(KDoStepPrint);  //Block start
	iIterate->Reset();

	SetSharedTextL(KSharedEvents,KNullDesC, EFalse);
	CActiveScheduler::Add(iMyActive);
	iMyActive->Activate();
	CActiveScheduler::Start();

	Cleanup();
	__UHEAP_MARKEND;

	return TestStepResult();
	}
TVerdict CConcurrentTimeOutNotifierStep::doTestStepL()
	{
	__UHEAP_MARK;
	InitializeL();
	_LIT(KDoStepPrint,"CConcurrentTimeOutNotifierStep::doTestStepL()");
	INFO_PRINTF1(KDoStepPrint);  //Block start 
	iIterate->Reset();
	SetTimerL(-1);
	SetContactL( -1 );
	SetSharedTextL(KSharedNextTest, KDoubleChar, EFalse);
	CActiveScheduler::Add(iMyActive);
	iMyActive->Activate();
	CActiveScheduler::Start();
	
	Cleanup();
	__UHEAP_MARKEND;

	return TestStepResult();
	}
Exemplo n.º 17
0
void CConcurrentNotifierStep::UnkownChangeTestL()
	{
	INFO_PRINTF1(KTest13);
	SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue);
	iWaiting = ETrue;
	iMyActive->Activate();
	TContactItemId cid = iIterate->NextL();
	TInt i = 0;
	iContactsDatabase->DatabaseBeginLC(EFalse);
	for( ; i < KMaxNumberOfEventsInEventQueue + 1; ++i )
		{
		OpenL( cid );
		CommitL( EFalse );
		}
	AddEventL( EContactDbObserverEventUnknownChanges );
	AddContactL( -1 );
	EndTransactionL();
	SetMessageCountL();
	iStart.UniversalTime();
	}
Exemplo n.º 18
0
void CConcurrentNotifierStep::EmptyTransactionTestL()
	{
	if( iRevert )
		{
		INFO_PRINTF1(KTest122);
		}
	else
		{
		INFO_PRINTF1(KTest12);
		}
	SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue);
	iWaiting = ETrue;
	iContactsDatabase->DatabaseBeginLC(EFalse);
	AddEventL(KNullEvent);
	AddContactL( KNullEvent );
	EndTransactionL();
	SetMessageCountL();

	iStart.UniversalTime();
	}
Exemplo n.º 19
0
void CConcurrentNotifierStep::SingleCommitTransactionTestL()
	{
	if( iRevert )
		{
		INFO_PRINTF1(KTest102);
		}
	else
		{
		INFO_PRINTF1(KTest10);
		}
	SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue);
	iWaiting = ETrue;
	TContactItemId cid = iIterate->NextL();

	iContactsDatabase->DatabaseBeginLC(EFalse);
	OpenL( cid );
	CommitL( ETrue );
	AddEventL(EContactDbObserverEventContactChanged);
	AddContactL( cid );
	EndTransactionL();
	SetMessageCountL();

	iStart.UniversalTime();
	}
Exemplo n.º 20
0
void CConcurrentNotifierStep::PreTestL()
	{
	_LIT(KPretestPrint,"I am in CConcurrentNotifierStep PreTestL()");
	INFO_PRINTF1(KPretestPrint);
	GetIntFromConfig( KNotifier, KClients, iManyListeners );
	iMyActive = new (ELeave) CConcurrentNotifierStep::CConcurrentNotifierActive( this );
	iTests = new(ELeave) RArray< void (CConcurrentNotifierStep::*)() >();

	ClearSharedL();
	SetSharedTextL(KSharedNextTest, KNullDesC, EFalse);

	const TDesC &run = ConfigSection();

	if( run == KRun1 )
		{
		iTests->AppendL( &CConcurrentNotifierStep::UpdateTestL );
		}
	else if( run == KRun2 )
		{
		iTests->AppendL( &CConcurrentNotifierStep::CommitTestL );
		}
	else if( run == KRun3 )
		{
		iTests->AppendL( &CConcurrentNotifierStep::AddTestL );
		}
	else if( run == KRun4 )
		{
		iTests->AppendL( &CConcurrentNotifierStep::DeleteTestL );
		}
	else if( run == KRun5 )
		{
		iTests->AppendL( &CConcurrentNotifierStep::CloseTablesTestL );
		iTests->AppendL( &CConcurrentNotifierStep::OpenTablesTestL );
		}
	else if( run == KRun7 )
		{
		iTests->AppendL( &CConcurrentNotifierStep::OwnCardTestL );
		iTests->AppendL( &CConcurrentNotifierStep::ChangeOwnCardTestL );
		iTests->AppendL( &CConcurrentNotifierStep::OwnCardDeleteTestL );
		}
	else if( run == KRun9 )
		{
		iTests->AppendL( &CConcurrentNotifierStep::SpeedDialTestL );
		iTests->AppendL( &CConcurrentNotifierStep::RemoveSpeedDialTestL );
		iTests->AppendL( &CConcurrentNotifierStep::DeleteSpeedDialTestL );
		}
	else if( run == KRun10 )
		{
		iTests->AppendL( &CConcurrentNotifierStep::SingleCommitTransactionTestL );
		}
	else if( run == KRun11 )
		{
		iRevert = ETrue;
		iTests->AppendL( &CConcurrentNotifierStep::SingleCommitTransactionTestL );
		}
	else if( run == KRun12 )
		{
		iTests->AppendL( &CConcurrentNotifierStep::MultipleChangeTransactionTestL );
		}
	else if( run == KRun13 )
		{
		RProcess().SetPriority(EPriorityBackground);
		iRevert = ETrue;
		iTests->AppendL( &CConcurrentNotifierStep::MultipleChangeTransactionTestL );
		RProcess().SetPriority(EPriorityForeground);
		}
	else if( run == KRun14 )
		{
		iTests->AppendL( &CConcurrentNotifierStep::EmptyTransactionTestL );
		}
	else if( run == KRun15 )
		{
		RProcess().SetPriority(EPriorityBackground);
		iRevert = ETrue;
		iTests->AppendL( &CConcurrentNotifierStep::EmptyTransactionTestL );
		RProcess().SetPriority(EPriorityForeground);
		}
	else if( run == KRun16 )
		{
		iTests->AppendL( &CConcurrentNotifierStep::UnkownChangeTestL );
		}
	else
		{
		MissingTestPanic();
		}

	}