Пример #1
0
void CGroupViewTester::HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent)
	{
	switch (iCurrentTest)
		{
		case ECreateLocalView:
			test(iLocalView==&aView);
			test(aEvent.iEventType==TContactViewEvent::EReady);
				NextTest();
			break;
		case ECreateRemoteNamedView:
			test(iNamedRemoteView==&aView);
			test(aEvent.iEventType==TContactViewEvent::EReady);
				NextTest();
			break;
		case EStartLocalTests:
		case EEndLocalTests:
		case EStartRemoteTests:
		case EEndRemoteTests:
		case ENumTests:
			break;
		default:
			test(EFalse);
			break;
		}

	}
Пример #2
0
bool CCodeBlock::Compile()
{
    CPU_Message("====== Code Block ======");
    CPU_Message("Native entry point: %X", CompiledLocation());
    CPU_Message("Start of Block: %X", VAddrEnter());
    CPU_Message("No of Sections: %d", NoOfSections());
    CPU_Message("====== recompiled code ======");

    m_RecompilerOps->EnterCodeBlock();
    if (g_System->bLinkBlocks())
    {
        while (m_EnterSection->GenerateNativeCode(NextTest()));
    }
    else
    {
        if (!m_EnterSection->GenerateNativeCode(NextTest()))
        {
            return false;
        }
    }
    m_RecompilerOps->CompileExitCode();

    uint32_t PAddr;
    g_TransVaddr->TranslateVaddr(VAddrFirst(), PAddr);
    MD5(g_MMU->Rdram() + PAddr, (VAddrLast() - VAddrFirst()) + 4).get_digest(m_Hash);

#if defined(ANDROID) && (defined(__arm__) || defined(_M_ARM))
    __clear_cache_android((uint8_t *)((uint32_t)m_CompiledLocation & ~1), (uint8_t *)(*g_RecompPos));
#endif
    return true;
}
Пример #3
0
void CAsyncTest::RunL()
	{
	switch (iTestNo)
		{
		case EOpenAndCancelPart1:
			OpenUnnamedDatabaseTestL();
			User::After(100000); // Give other threads a chance to run during concurrent tests
			SetActive();
			++iTestNo;
			break;
		case EOpenAndCancelPart2:// Allow the database to open before cancelling
			CancelDatabaseTestL();
			NextTest();
			++iTestNo;
			break;
		case EOpenAndCancel:
			OpenAndCancelDatabaseTestL();
			SetActive();
			++iTestNo;
			break;
		case EOpenUnnamed:
			OpenUnnamedDatabaseTestL();
			SetActive();
			++iTestNo;
			break;
		case ETestOpenUnnamed:
			User::LeaveIfError(iStatus.Int());
			TestResultL();
			NextTest();
			++iTestNo;			
			break;			
		case EOpenNamed:
			User::LeaveIfError(iStatus.Int());
			OpenNamedDatabaseTestL();
			User::After(1000);
			SetActive();
			++iTestNo;			
			break;
		case ETestOpenNamed:
			{
			TestResultL();
			RThread thread;
			if(thread.RequestCount()!=0)
				User::Leave(KErrBadHandle);
			CActiveScheduler::Stop();
			iTest->Next(_L("Test Completed OK\n"));
			break;
			}
		default:
			ASSERT(EFalse);
			break;
		}
	}
void CGroupViewTester::ConstructL()
	{
	iSortOrder_1.AppendL(KUidContactFieldGivenName);
	iSortOrder_1.AppendL(KUidContactFieldFamilyName);
	iSortOrder_1.AppendL(KUidContactFieldCompanyName);
	NextTest();
	}
Пример #5
0
void CTestConductor::ConstructL()
	{	
	// Create the db files used in the tests
	iDb = CContactDatabase::ReplaceL(KDbDamaged);
    CleanupStack::PushL(iDb);
    iDb->DamageDatabaseL(0x666);
    CleanupStack::PopAndDestroy(iDb);
    
	iDb = CContactDatabase::ReplaceL(KDbFileName);
	delete iDb;
	
	iDb = CContactDatabase::ReplaceL(KDefaultDb);
	delete iDb;
	
    CopyCdbFileL(KDatabaseV4,KDbOldVersionFilePath);	
    
	iDb = NULL;

	iTestError = KErrNone;

	NextTest();
	CActiveScheduler::Start();

	User::LeaveIfError(iTestError);
	}
Пример #6
0
void CPntBufWindow::WinKeyL(const TKeyEvent &aKey,const TTime &)
	{
	switch(aKey.iCode)
		{
		case ' ':
			NextTest();
			break;
		case EKeyEscape:
			iTest->FinishedTests();
			break;
		case '0':
			SetUpState();
			break;
		case '1':
		case '2':
		case '3':
			{
			TInt mode=aKey.iCode-'1';
			if (mode!=iMode)
				{
				iMode=mode;
				SetUpState();
				}
			}
			break;
		}
	}
Пример #7
0
void CCodeBlock::DetermineLoops()
{
    for (SectionMap::iterator itr = m_SectionMap.begin(); itr != m_SectionMap.end(); itr++)
    {
        CCodeSection * Section = itr->second;

        uint32_t Test = NextTest();
        Section->DetermineLoop(Test, Test, Section->m_SectionID);
    }
}
Пример #8
0
void CUnfiledGroupViewTester::HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent)
	{
	TCntProfile profile;
	TInt sizeOfView = 0;

	switch (iCurrentTest)
		{
		case ECreateUnfiledGroupView:
			test(iGroupViewUnfiled==&aView);
			test(aEvent.iEventType==TContactViewEvent::EReady);
			// Stop timer.
			STOP_CLOCK_TIME( profile );
			iLog.LogLine(_L("<< Stop  Clock [%d] \n"), macroTimer);
			iLog.LogLine(_L("=== Time Taken to create view "));
			iTestConductor.PrintTimeTaken(profile.iTime);
			NextTest();
		break;

		case ETestAddUnfiledContacts:
		case ETestRemoveUnfiledContacts:
			TRAPD(err, sizeOfView = iGroupViewUnfiled->CountL() );
			test(err == KErrNone);
			if (sizeOfView == iSizeOfViewToExpect)
				{
				// Stop timer.
				STOP_CLOCK_TIME( profile );
				iLog.LogLine(_L("=== Time Taken handle all Messages "));
				iLog.LogLine(_L("<< Stop  Clock [%d] \n"), macroTimer);
				iTestConductor.PrintTimeTaken(profile.iTime);
				iSizeOfViewToExpect = 0;
				NextTest();
				}
		break;


		case ENumTests:
			break;
		default:
			test(EFalse);
			break;
		}

	}
Пример #9
0
void CGroupViewTester::ConstructL()
	{
	iSortOrder_1.AppendL(KUidContactFieldGivenName);
	iSortOrder_1.AppendL(KUidContactFieldFamilyName);
	iSortOrder_1.AppendL(KUidContactFieldCompanyName);

	iTextDef=CContactTextDef::NewL();
	iTextDef->AppendL(TContactTextDefItem(KUidContactFieldGivenName,KTextDefSeparator));
	iTextDef->AppendL(TContactTextDefItem(KUidContactFieldFamilyName,KTextDefSeparator));
	iTextDef->AppendL(TContactTextDefItem(KUidContactFieldCompanyName,KTextDefSeparator));

	NextTest();
	}
Пример #10
0
bool CCodeBlock::Compile()
{
    CPU_Message("====== Code Block ======");
    CPU_Message("x86 code at: %X",CompiledLocation());
    CPU_Message("Start of Block: %X",VAddrEnter() );
    CPU_Message("No of Sections: %d",NoOfSections() );
    CPU_Message("====== recompiled code ======");

    EnterCodeBlock();

    if (g_SyncSystem)
    {
        //if ((uint32_t)BlockInfo.CompiledLocation == 0x60A7B73B)
        //{
        //	X86BreakPoint(__FILEW__,__LINE__);
        //}
        //MoveConstToVariable((uint32_t)BlockInfo.CompiledLocation,&CurrentBlock,"CurrentBlock");
    }

    if (g_System->bLinkBlocks())
    {
        while (m_EnterSection->GenerateX86Code(NextTest()));
    }
    else
    {
        if (!m_EnterSection->GenerateX86Code(NextTest()))
        {
            return false;
        }
    }
    CompileExitCode();

    uint32_t PAddr;
    g_TransVaddr->TranslateVaddr(VAddrFirst(),PAddr);
    MD5(g_MMU->Rdram() + PAddr,(VAddrLast() - VAddrFirst()) + 4).get_digest(m_Hash);

    return true;
}
Пример #11
0
void CTPointerCapture::doIncSubStateL()
	{
	iSubState++;
	TInt max=0;
	switch(iTest->iState)
		{
		case ECaptureDisabled:
			max=ESubStates1;
			break;
		case ENormalCapture:
			max=ESubStates2;
			break;
		case ECaptureAllGroups:
			max=ESubStates3;
			break;
		case EDragDropCapture:
			max=ESubStates4;
			break;
		case EDragDropCaptureAllGroups:
			max=ESubStates5;
			break;
		case ENormalCaptureWithoutFocus:
			max=ESubStates6;
			break;
		}
	//SubState 4 has been broken by something in the framework
	if (iSubState==max || iSubState==4)
		{
	#if defined(LOGGING)
		_LIT(KLog,"IncState  OldState=%d  SubState=%d");
		LOG_MESSAGE3(KLog,iTest->iState,iSubState);
	#endif
		NextTest();
		}
	StateChanged();
	TheClient->WaitForRedrawsToFinish();
	if (iSubState>0)
		SendEventsL();
	}
Пример #12
0
void CTPointerCapture::TestFailed()
	{
	if (iFailed)
		{
		_LIT(KLog,"Test Failed  State=%d  SubState=%d");
		LOG_MESSAGE3(KLog,iTest->iState,iSubState);
		}
	__ASSERT_DEBUG(iFailed==EFalse,AutoPanic(ETManPanicPcFailed));
	TInt dRet=1;
#if !defined(DISABLE_FAIL_DIALOG)
	Client()->iGroup->GroupWin()->SetOrdinalPosition(0,10);	// Put error dialog on top of test windows
	TRAPD(err,dRet=doTestFailedL());
	Client()->iGroup->GroupWin()->SetOrdinalPosition(0,0);
#endif
	switch(dRet)
		{
		case 0:
			break;
		case 1:
			iFailed=ETrue;
			NextTest();
			break;
		}
	}
Пример #13
0
//--------------------
// Check States
//--------------------
void DLCSystemTests::InitCompleted(DLCStatusCode withStatus)
{
    switch ( state )
    {
        case TEST_1:
            if ( withStatus == DOWNLOAD_SUCCESS )
            {
                if ( DLCSystem::Instance()->GetDLCSource(0)->state != DLCSystem::DLC_NOT_DOWNLOADED )
                {
                    isSucsess = false;
                }
                if ( DLCSystem::Instance()->GetDLCSource(1)->state != DLCSystem::DLC_NOT_DOWNLOADED )
                {
                    isSucsess = false;
                }
                DLCSystem::Instance()->DownloadAllDLC();
            }
            else
            {
                isSucsess = false;
                NextTest();
            }
            break;
        case TEST_2:
            if ( withStatus == DOWNLOAD_SUCCESS )
            {
                if ( DLCSystem::Instance()->GetDLCSource(0)->state != DLCSystem::DLC_FILES_TREE_CORRUPT )
                {
                    isSucsess = false;
                }
                if ( DLCSystem::Instance()->GetDLCSource(1)->state != DLCSystem::DLC_DOWNLOADED )
                {
                    isSucsess = false;
                }
                DLCSystem::Instance()->DownloadAllDLC();
            }
            else
            {
                isSucsess = false;
                NextTest();
            }
            break;
        case TEST_3:
        case TEST_6:
            if ( withStatus == DOWNLOAD_SUCCESS )
            {
                if ( DLCSystem::Instance()->GetDLCSource(0)->state != DLCSystem::DLC_DOWNLOADED )
                {
                    isSucsess = false;
                }
                if ( DLCSystem::Instance()->GetDLCSource(1)->state != DLCSystem::DLC_NOT_DOWNLOADED )
                {
                    isSucsess = false;
                }
                DLCSystem::Instance()->DownloadAllDLC();
            }
            else
            {
                isSucsess = false;
                NextTest();
            }
            break;
        case TEST_4:
            if ( withStatus == DOWNLOAD_SUCCESS )
            {
                if ( DLCSystem::Instance()->GetDLCSource(0)->state != DLCSystem::DLC_DOWNLOADED )
                {
                    isSucsess = false;
                }
                if ( DLCSystem::Instance()->GetDLCSource(1)->state != DLCSystem::DLC_DOWNLOAD_NOT_FINISHED )
                {
                    isSucsess = false;
                }
                DLCSystem::Instance()->DownloadAllDLC();
            }
            else
            {
                isSucsess = false;
                NextTest();
            }
            break;
        case TEST_5:
            if ( withStatus == DOWNLOAD_SUCCESS )
            {
                DLCSystem::Instance()->DownloadAllDLC();
                if ( DLCSystem::Instance()->GetDLCSource(0)->state != DLCSystem::DLC_OLD_VERSION )
                {
                    isSucsess = false;
                    Logger::Debug("  INIT FALSE 1 state = %d", DLCSystem::Instance()->GetDLCSource(0)->state);
                }
                if ( DLCSystem::Instance()->GetDLCSource(1)->state != DLCSystem::DLC_DOWNLOADED )
                {
                    isSucsess = false;
                    Logger::Debug("  INIT FALSE 2 state = %d", DLCSystem::Instance()->GetDLCSource(1)->state);
                }
            }
            else
            {
                Logger::Debug("  INIT FALSE 3");
                isSucsess = false;
                NextTest();
            }
            break;
        case TEST_7:
            if ( withStatus == DOWNLOAD_SUCCESS )
            {
                DLCSystem::Instance()->DownloadAllDLC();
                if ( DLCSystem::Instance()->GetDLCSource(0)->state != DLCSystem::DLC_DOWNLOADED )
                {
                    isSucsess = false;
                }
                if ( DLCSystem::Instance()->GetDLCSource(1)->state != DLCSystem::DLC_OLD_VERSION )
                {
                    isSucsess = false;
                }
            }
            else
            {
                isSucsess = false;
                NextTest();
            }
            break;
        case TEST_8:
            if ( withStatus == DOWNLOAD_SUCCESS )
            {
                DLCSystem::Instance()->DownloadAllDLC();
                if ( DLCSystem::Instance()->GetDLCSource(0)->state != DLCSystem::DLC_DOWNLOADED )
                {
                    isSucsess = false;
                }
                if ( DLCSystem::Instance()->GetDLCSource(1)->state != DLCSystem::DLC_NOT_DOWNLOADED )
                {
                    isSucsess = false;
                }
                if ( DLCSystem::Instance()->GetDLCSource(2)->state != DLCSystem::DLC_DOWNLOADED )
                {
                    isSucsess = false;
                }
            }
            else
            {
                isSucsess = false;
                NextTest();
            }
            break;
        default:
            break;
    }
}
Пример #14
0
void CTestConductor::RunL()
	{
	User::After(1000);
	switch (iCurrentTestNumber)
		{
		// Test One - Async Open of a Named Database
		case EAsyncOpenNamed:
	    	test.Next(_L("=== Async Open of Named Db"));

			SetActive();
			iContactOpenOperation = CContactDatabase::Open(KDbFileName,iStatus);
			++iCurrentTestNumber;
			
			break;
			
		// Check Test One Results
		case EAsyncOpenedNamed:
			test(iStatus.Int() == KErrNone);
			test.Printf(_L("=== Opened Async\n"));
			iDb = iContactOpenOperation->TakeDatabase();
			
			test(iDb != NULL);
			delete iContactOpenOperation;
			delete iDb;
			
			NextTest();
			break;

        // Test Two - Async Open of the Default Database
		case EAsyncOpenDefault:
		    test.Next(_L("=== Async Open Default"));

			SetActive();
			iContactOpenOperation = CContactDatabase::Open(iStatus);
			++iCurrentTestNumber;

			break;
		
		// Check Test Two Results	
		case EAsyncOpenedDefault:
			test(iStatus.Int() == KErrNone);
	     	test.Printf(_L("=== Opened Async Default \n"));
			iDb = iContactOpenOperation->TakeDatabase();
            test(iDb != NULL);
            delete iContactOpenOperation;
            delete iDb;            
			
			NextTest();
			break;			
		
		// Test Three - Attempted Async Open of a Non-Existent File
		case EAsyncOpenNonExistent:		
			test.Next(_L("=== Attempted Open of Non-Existent File"));

			SetActive();
			iContactOpenOperation = CContactDatabase::Open(KDbFileNameNotExist,iStatus);
			++iCurrentTestNumber;
			
			break;
			
		// Check Test Three Results	
		case EAsyncOpenedNonExistent:
		    test.Printf(_L("=== Opened Non Existent Response\n"));		
			test(iStatus.Int() == KErrNotFound);
			
			delete iContactOpenOperation;
			NextTest();
			break;	
			
		// Test Four - Cancel the Async Open
		case EAsyncCancelOpenDefault:
			test.Next(_L("=== Cancel Async Open"));


			SetActive();
			iContactOpenOperation = CContactDatabase::Open(iStatus);
			++iCurrentTestNumber;
			
			// Cancel the request
			delete iContactOpenOperation;
						
			break;	
			
		// Check Test Four Results	
		case EAsyncCanceledOpenedDefault:
			test.Printf(_L("=== Cancelled Async Open\n"));
			test(iStatus.Int() == KErrCancel);
			NextTest();
			break;	
			
		// Test Five - Async Open of a damaged Database
		case EAsyncOpenDamaged:					
			test.Next(_L("Open a damaged database"));

            
            SetActive();
			iContactOpenOperation = CContactDatabase::Open(KDbDamaged,iStatus);
			++iCurrentTestNumber;
			
			break;	
		
		// Check Test Five Results
		case EAsyncOpenedDamaged:	
			test(iStatus.Int() == KErrNone);
	     	test.Printf(_L("=== Opened Damaged Db \n"));
			iDb = iContactOpenOperation->TakeDatabase();
            test(iDb != NULL);
            delete iContactOpenOperation;
            delete iDb;
            
			NextTest();
				
			break;
							
		// Test Six - Async Open of a Previous version of the Database	
		case EAsyncOpenPreviousVersion:					
			test.Next(_L("Open an old version database"));

    
			SetActive();
			iContactOpenOperation = CContactDatabase::Open(KDbOldVersionFileName,iStatus);
			++iCurrentTestNumber;
			
			break;	
		
		// Check Test Six Results
		case EAsyncOpenedPreviousVersion:	
   			test(iStatus.Int() == KErrNone);
	     	test.Printf(_L("=== Opened Previoius Version Db \n"));
	     	
			iDb = iContactOpenOperation->TakeDatabase();
            test(iDb != NULL);
            delete iContactOpenOperation;
            delete iDb;			
            
			NextTest();
			break;
			
		// Test Seven - Async Open of a Previous version of the Database, and an Async
		// call open of the same database in a different thread.	
		case EOpenAsyncAndAsync:
		    test.Next(_L("Open Async Then Sync"));

		    
		    // Copy Version 4 Db
		    CopyCdbFileL(KDatabaseV4,KDbOldVersionFilePath);
		
		    // Open Async
		    SetActive();
			iContactOpenOperation = CContactDatabase::Open(KDbOldVersionFileName,iStatus);
			++iCurrentTestNumber;
		    
		    // Lauch Thread to Open Db Asynchronously
		    CDbOpenLauncher::Create(KThreadOpenAsync, KThreadOpenAsync);		
		    break;
		
		// Check Test Seven Results 
		case EOpenedAsyncAndAsync:
			test(iStatus.Int() == KErrNone);
	     	test.Printf(_L("=== Opened After Async Open Db \n"));
	     	
			iDb = iContactOpenOperation->TakeDatabase();
            test(iDb != NULL);
			delete iContactOpenOperation;
            delete iDb;
             
			NextTest();
			break;	
			
			
		// Iterate through these states (allowing other thread to open asynchronously)
		case EWaitState:
			test.Printf(_L("=== Waiting in first thread \n"));
			iCurrentTestNumber = EWaitedState;
			SetActive();
			iContactOpenOperation = CContactDatabase::Open(KDbOldVersionFileName,iStatus);

		    break;
		    
		case EWaitedState:
		
		    test(iStatus.Int() == KErrNone);
	     	test.Printf(_L("=== Opened After Wait Db \n"));
	     	
			iDb = iContactOpenOperation->TakeDatabase();
            test(iDb != NULL);
			delete iContactOpenOperation;
            delete iDb;
            
            if (iWaitCounter < KNumWaitLoops) 
            	{
            	iCurrentTestNumber = EWaitState - 1;  
            	iWaitCounter++; 	
            	}
            else
            	{
            	// move onto next test
                iCurrentTestNumber = EWaitedState;
            	}
            
			NextTest();
			
			break;	
		
		// Test Eight - Async Open of a Previous version of the Database, and a Sync
		// open of the same database in a different thread.	
		case EOpenAsyncAndSync:		
			test.Next(_L("Open Async Then Sync"));

		    
		    // Copy Version 4 Db
		    CopyCdbFileL(KDatabaseV4,KDbOldVersionFilePath);
		
		    // Open Async
		    SetActive();
			iContactOpenOperation = CContactDatabase::Open(KDbOldVersionFileName,iStatus);
		    ++iCurrentTestNumber;
		    
		    // Lauch Thread to Open Db Synchronously
		    CDbOpenLauncher::Create(KThreadOpenSync, KThreadOpenSync);
	        break;
	
		// Check Test Eight Results
		case EOpenedAsyncAndSync:
		  	test(iStatus.Int() == KErrNone);
	     	test.Printf(_L("=== Opened After Sync Open Db \n"));
	     	
			iDb = iContactOpenOperation->TakeDatabase();
            test(iDb != NULL);
			delete iContactOpenOperation;
            delete iDb;
             
			NextTest();
			break;				

		// End of Tests	
		case ENumTests:
			{
			test.Printf(_L("=== Main Tests Complete\n"));
			RThread thread;
			test(thread.RequestCount()==0);

			// tidy up files
			CContactDatabase::DeleteDatabaseL(KDbDamaged);
			CContactDatabase::DeleteDatabaseL(KDefaultDb);			
			CContactDatabase::DeleteDatabaseL(KDbOldVersionFileName);
			 			

			CContactDatabase::DeleteDatabaseL(KDbFileName);
			
			CActiveScheduler::Stop();
			}
			break;
		
		
		default:
			ASSERT(EFalse);
			break;
		}
	}
Пример #15
0
void CUnfiledGroupViewTester::StartL()
	{
	iClientStatus = KRequestPending;
	NextTest();
	}
Пример #16
0
void CTester::ConstructL()
	{
	NextTest();
	CActiveScheduler::Start();
	}
Пример #17
0
void CGroupViewTester::RunL()
	{
	TCntProfile profile;

	switch (iCurrentTest)
		{
		case ECreateLocalView:
			iLog.LogLine(_L("=== Create local view \n"));
			iLocalView=CContactLocalView::NewL(*this,iDb,iSortOrder_1,EContactAndGroups);
			break;

		case ECreateRemoteNamedView:
			iLog.LogLine(_L("=== Create Remote named view \n"));
			iNamedRemoteView = CContactNamedRemoteView::NewL(*this,KRemoteViewName,iDb,iSortOrder_1,EContactAndGroups);
			break;

		case EStartLocalTests:
			iLog.LogLine(_L("=== Start Local Tests \n"));
			CLEAR_ALL_CLOCKS;
			iLog.LogLine(_L(">> Start Clock [%d] \n"), macroTimer);
			START_CLOCK;
			iTester = CUnfiledGroupViewTester::NewL(iLog, iDb, iTestConductor, *iLocalView, iStatus);
			SetActive();
			iCurrentTest = EEndLocalTests;
			iTester->StartL();
			break;

		case EEndLocalTests:
			STOP_CLOCK_TIME( profile );
			iLog.LogLine(_L("<< Stop  Clock [%d] \n"), macroTimer);
			iLog.LogLine(_L("== End Local Tests Time to complete \n"));
			delete iTester; iTester = NULL;
			iTestConductor.PrintTimeTaken(profile.iTime);
			NextTest();
			break;

		case EStartRemoteTests:
			iLog.LogLine(_L("=== Start Remote Tests \n"));
			CLEAR_ALL_CLOCKS;
			iLog.LogLine(_L(">> Start Clock [%d] \n"), macroTimer);
			START_CLOCK;
			iTester = CUnfiledGroupViewTester::NewL(iLog, iDb, iTestConductor, *iNamedRemoteView, iStatus);
			SetActive();
			iCurrentTest = EEndRemoteTests;
			iTester->StartL();
			break;

		case EEndRemoteTests:
			STOP_CLOCK_TIME( profile );
			iLog.LogLine(_L("<< Stop  Clock [%d] \n"), macroTimer);
			iLog.LogLine(_L("== End Remote Tests Time to complete\n"));
			delete iTester; iTester = NULL;
			iTestConductor.PrintTimeTaken(profile.iTime);
			NextTest();
			break;


		case ENumTests:
			iLog.LogLine(_L("==== No Time to report, tests over ! \n"));
			iLog.LogLine(_L("==== Group View Tests Finished, All Passed...\n"));
			CActiveScheduler::Stop();
			delete this;
			break;
		default:
			ASSERT(EFalse);
			break;
		}
	}
void CGroupViewTester::HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent)
	{
	switch (iCurrentTest)
		{
		case ECreateLocalView:
			iLog.LogLine(_L("==== Handling the local view creation \n"));
			test(iLocalView==&aView);
			test(aEvent.iEventType==TContactViewEvent::EReady);
			break;

		case ECreateGroupOne:
			iLog.LogLine(_L("==== Handling the group creation \n"));
		break;

		case ECreateGroupOneView:
			iLog.LogLine(_L("==== Handling the group view creation \n"));
			test(iGroupViewOne==&aView);
			test(aEvent.iEventType==TContactViewEvent::EReady);
		break;

		case EAddContactToGroupOne:
			iLog.LogLine(_L("==== Handling the addition of a contact to the group \n"));
		break;

		case EAddContact:
			iLog.LogLine(_L("==== Handling the addition of a contact \n"));
		break;

		case EModifyContactInGroupOne:
		iLog.LogLine(_L("==== Handling Contact being modified. \n"));

			switch (aEvent.iEventType)
			{
				case TContactViewEvent::EItemRemoved:
					iLog.LogLine(_L("==== Contact Is removed for modify \n"));
				break;

				case TContactViewEvent::EItemAdded:
					iLog.LogLine(_L("==== Contact Is added for modify \n"));
					{
					TInt numberOfEntries = 0;
					TRAPD(err, numberOfEntries = aView.CountL() );
					test(err == KErrNone && numberOfEntries != 0);
					}
				break;
				default:
					break;
			}
		break;

		case ENumTests:
		default:
			test(EFalse);
			break;
		}
	if (--iNumNotificationExpected<=0)
		{
		NextTest();
		iNumNotificationExpected=0;
		}
	}
Пример #19
0
int main( int argc, char *argv[] )
{
	SDL_Surface* screen;
	int  depth = 0;
	bool speedtest = false;	
	U32  flags = SDL_SWSURFACE;
	int i;
	bool timerOn = true;
	bool useOpenGL = false;
// 	bool saveBMP = false;

	const SDL_version* sdlVersion = SDL_Linked_Version();
	if ( sdlVersion->minor < 2 )
	{
		GLOUTPUT(( "SDL version must be at least 1.2.0" ));
		GLASSERT( 0 );
		exit( 254 );
	}

	/* Initialize the SDL library */
	if ( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_NOPARACHUTE) < 0 ) {
		GLOUTPUT(( "Couldn't initialize SDL: %s\n",SDL_GetError()));
		exit(255);
	}

	SDL_WM_SetCaption( "Kyra Demo", 0 );

	for ( i=1; i<argc; i++ )
	{
		if ( *argv[i] == '-' && *(argv[i]+1) )
		{
			const char* param = argv[i]+2;
			switch( *(argv[i]+1) )
			{
				case 'd':
				{
					depth = atoi( param );
				}
				break;

				case 's':
				{
					speedtest = true;
				}
				break;

				case 'f':
				{
					flags |= SDL_FULLSCREEN;
				}
				break;

				case '1':
				{
					timerOn = false;
				}
				break;

				case 't':
				{
					singleTest = atoi( param );
				}
				break;

				case 'o':
				{
					useOpenGL = true;
				}
			}
		}
	}

	if ( useOpenGL )
	{
		if ( flags & SDL_FULLSCREEN )
			flags = SDL_OPENGL | SDL_FULLSCREEN;
		else
			flags = SDL_OPENGL;
	}

	/* Create a display for the image. If we are forcing the mode,
	   skip this step and potentially use a shadow surface.
	*/
	if ( depth == 0 )
	{
		depth = SDL_VideoModeOK( SCREENX, SCREENY, 32, flags );
		if ( depth < 16 )
			depth = 16;
	}

	if ( useOpenGL )
	{
		// We want *at least* 5 bits per channel.
		//SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
    	//SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
    	//SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );

		SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, depth );
		SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
	}
	screen = SDL_SetVideoMode( SCREENX, SCREENY, depth, flags );

	if ( screen == NULL ) {
		fprintf( stdout, "Can't open display (%dx%d %dbps %s)\n",
				 SCREENX, SCREENY, depth,
				 useOpenGL ? "OpenGL" : "" );		
		fprintf( stdout, "SDL_Error: %s\n", SDL_GetError() );
		exit(3);
	}

	char buf[512];
 	factory.GetHeader( screen, buf );
	printf( buf );
	GLOUTPUT(( "%s\n", buf ));

	SDL_Event event;

	if ( speedtest )
	{
		memset( &event, 0, sizeof( event ) );
		event.type = SDL_TIMER_EVENT;
		SDL_PeepEvents( &event, 1, SDL_ADDEVENT, 0 );
		GLOUTPUT(( "Speedtest mode!\n" ));
	}
	else if ( timerOn )
	{
		SDL_SetTimer( timerInterval, TimerCallback );
		GLOUTPUT(( "Demo play mode!\n" ));
	}
	U32 start = SDL_GetTicks();

	if ( singleTest < 0 )
		currentGame = factory.CreateGame( 0, screen );
	else
		currentGame = factory.CreateGame( singleTest, screen );		
	timerInterval = currentGame->FrameInterval();

	while( currentGame && SDL_WaitEvent(&event) )
	{
		if ( event.type == SDL_QUIT )
			break;

		// Cull extra timer messages:
		if ( !speedtest && timerOn )
		{
			SDL_Event nextEvent;
			if (    SDL_PeepEvents( &nextEvent, 1, SDL_PEEKEVENT, SDL_ALLEVENTS )
			     && nextEvent.type == SDL_TIMER_EVENT )
			{
				// the event is duplicated
				//GLOUTPUT( "Timer event tossed.\n" );
				continue;
			}
		}

		switch(event.type)
		{
			case SDL_KEYDOWN:
			{
				if ( event.key.keysym.sym == SDLK_F10 )
				{
					// save a bitmap.
					static int count = 0;
					char buf[ 256 ];
					sprintf( buf, "krdemo%d.bmp", count++ );

					if ( !(screen->flags & SDL_OPENGL ) )
						SDL_SaveBMP( screen, buf );
				} 
				else if ( !timerOn && event.key.keysym.sym == SDLK_SPACE )
				{
					// Simulate a timer:
					SDL_Event e;
					memset( &e, 0, sizeof( e ) );
					e.type = SDL_TIMER_EVENT;
					SDL_PeepEvents( &e, 1, SDL_ADDEVENT, 0 );
				}
				else if ( event.key.keysym.sym == SDLK_s )
				{
					timerInterval = 500;
				}
				else if ( event.key.keysym.sym == SDLK_a )
				{
					timerInterval = 10000;
				}
				else
				{
					NextTest( screen );
				}
			}
			break;

			case SDL_KEYUP:
			{
				if (    event.key.keysym.sym == SDLK_s
					 || event.key.keysym.sym == SDLK_a )
				{
					if ( currentGame )
						timerInterval = currentGame->FrameInterval();

					SDL_SetTimer( 0, TimerCallback );
					SDL_SetTimer( timerInterval, TimerCallback );
				}
			}
			break;

			case SDL_VIDEOEXPOSE:
			{
				currentGame->VideoExpose();
//				currentGame->UpperDrawFrame();
			}
			break;

			case SDL_TIMER_EVENT:
			{
				if ( currentGame )
				{
					currentGame->UpperDrawFrame();

// 					if (    speedtest 
// 					     && currentGame->Frame() == currentGame->TestFrames() )
					if ( currentGame->Frame() == currentGame->TestFrames() )
					{
						U32 end = SDL_GetTicks();
						factory.SetTime( end - start );
						NextTest( screen );
						start = SDL_GetTicks();
					}
					if ( speedtest )
					{
						SDL_Event e;
						memset( &e, 0, sizeof( e ) );
						e.type = SDL_TIMER_EVENT;
						SDL_PeepEvents( &e, 1, SDL_ADDEVENT, 0 );
					}
				}
			}
			break;
		}

	}

	if ( speedtest )
	{
		factory.PrintTimes( screen );
	}
	else
	{
		printf( "Tested at %dbbp\n", screen->format->BitsPerPixel );
	}

	if ( speedtest )
	{
		FILE* fp = fopen( "perf.txt", "w" );
		if ( fp )
		{
			fprintf( fp, "Performance: \n" );
			
			grinliz::Performance::Dump( fp, "kyra" );
			fclose( fp );
		}
	}
	SDL_Quit();	
	return 0;
}
void CGroupViewTester::HandleContactViewEvent( const CContactViewBase& aView,
    const TContactViewEvent& aEvent )
	{
    // Log events from both underlying view and group view.
    LogEvent( const_cast<TContactViewEvent&>( aEvent ) );

	switch (iCurrentTest)
		{
		case ECreateLocalView:
			test(iLocalView==&aView);
			test(aEvent.iEventType==TContactViewEvent::EReady);
			break;

		case ECreateGroupOneView:
			{
			test(iGroupViewOne == &aView);
			test(aEvent.iEventType == TContactViewEvent::EReady);

			//Reserve the IDs of last three contacts in the group
			TInt index = KNumContactsInGroupOne-1;
            TRAPD(err, iLastContactID = iGroupViewOne->ContactAtL(index).Id() );
			if (err)
				{
				_LIT(KErrMsg, "Contact view error in CGroupViewTester::HandleContactViewEvent() assigning iLastContactID\n");
				test.Printf(KErrMsg);
				User::Invariant();
				}

            --index;
            TRAP(err, iSecondLastContactID = iGroupViewOne->ContactAtL(index).Id() );
			if (err)
				{
				_LIT(KErrMsg, "Contact view error in CGroupViewTester::HandleContactViewEvent() assigning iSecondLastContactID\n");
				test.Printf(KErrMsg);
				User::Invariant();
				}

            --index;
            TRAP(err, iThirdLastContactID = iGroupViewOne->ContactAtL(index).Id() );
			if (err)
				{
				_LIT(KErrMsg, "Contact view error in CGroupViewTester::HandleContactViewEvent() assigning iThirdLastContactID\n");
				test.Printf(KErrMsg);
				User::Invariant();
				}

			}
			break;

        case ECreateGroupTwoView:
			test( iGroupViewTwo == &aView );
			test( aEvent.iEventType == TContactViewEvent::EReady );
            break;

        case EDeleteItemsFromView:
            {
            // Bulk delete complete when the last Ready is received from the 
            // base view. This comes after the group view ready event. Break to 
            // run next test.
            TBool lastEvent = (aEvent.iEventType == TContactViewEvent::EReady) &&
                (&aView == iLocalView);
            if (lastEvent) 
                { 
                break; 
                }

            if (aEvent.iEventType == TContactViewEvent::EItemRemoved)
                {
                // Only proces events from group view.
                if (&aView == iGroupViewOne)
                    {
                    // Ensure that only 1 contact is removed per notification.
                     iNumRemovedEvents++;
                    TInt numItemsExpected = KNumContactsInGroupOne - iNumRemovedEvents;
		            
		            TInt numItems(0);
		            TRAPD(err, numItems = iGroupViewOne->CountL() );
					if (err)
						{
						_LIT(KErrMsg, "Contact view error in CGroupViewTester::HandleContactViewEvent() assigning numItems\n");
						test.Printf(KErrMsg);
						User::Invariant();
						}
		            test(numItems == numItemsExpected );

                    // Verify the contacts were deleted as expected.
                    TBool testVal(EFalse);
                    TInt index = numItemsExpected - 1;
					TRAP(err, testVal = (iGroupViewOne->ContactAtL(index).Id() == iLastContactID) );
					if (err)
						{
						_LIT(KErrMsg, "Contact view error in CGroupViewTester::HandleContactViewEvent() assigning testVal for iLastContactID\n");
						test.Printf(KErrMsg);
						User::Invariant();
						}
					test(testVal);

                    --index;
					TRAP(err, testVal = (iGroupViewOne->ContactAtL(index).Id() == iSecondLastContactID) );
					if (err)
						{
						_LIT(KErrMsg, "Contact view error in CGroupViewTester::HandleContactViewEvent() assigning testVal for iSecondLastContactID\n");
						test.Printf(KErrMsg);
						User::Invariant();
						}
					test(testVal);

                    --index;
					TRAP(err, testVal = (iGroupViewOne->ContactAtL(index).Id() == iThirdLastContactID) );
					if (err)
						{
						_LIT(KErrMsg, "Contact view error in CGroupViewTester::HandleContactViewEvent() assigning testVal for iThirdLastContactID\n");
						test.Printf(KErrMsg);
						User::Invariant();
						}
					test(testVal);
                    }

                // More events expected, don't run next test.
                return;
                }
            else
                {
                // Ignore all other events.
                return;
                }
            }

        case EAddItemToGroup:
            {
            // Break to run next test if this is the last expected event. The last
            // event is the group being added from the base view. The local view
            // removes and then adds the group id whenever the group changes. These
            // events are meaningless.
            TBool lastEvent = (&aView == iLocalView) && 
                (aEvent.iEventType == TContactViewEvent::EItemAdded) &&
                (aEvent.iContactId == iGroupOneId);
            if (lastEvent)
                {
                break; // Run next test.
                }

            // Verify contact has been added.
            if (aEvent.iEventType == TContactViewEvent::EItemAdded && 
                &aView == iGroupViewOne)
                {
                // Check if contact was added.
                test( aEvent.iContactId == iIdAdded );

                TInt index = iGroupViewOne->FindL( iIdAdded );
                test (index != KErrNotFound);

                // More events expected, don't run next test.
                return;
                }
            else
                {
                // Ignore all other events.
                return;
                }
            }

		default:
			test( EFalse );
			break;
		}

    // Run the next test.
	if (--iNumNotificationExpected <= 0)
		{
		NextTest();
		iNumNotificationExpected = 0;
		}
	}
Пример #21
0
/**
@SYMTestCaseID SYSLIB-CENTRALREPOSITORY-CT-1419
@SYMTestCaseDesc Test Coarse-Grained Caching functionality.
@SYMTestPriority High
@SYMTestActions  Check correct initialization of the cache manager, expected caching behaviour after
 repository open/close, correct setting of cache size, correct functioning of the cache flush
 functionality, OOM recovery by cache flushing feature and cache Disable/Enable functionality
@SYMTestExpectedResults The test must not fail.
@SYMPREQ PREQ1192
@SYMTestStatus Defined
@SYMDevelopedForRelease Symbian OS v9.3
@SYMAuthor Aleks Pamir
*/
void TRepositoryCacheManagerTester::FuncTestsL()
	{
	NextTest(_L( " @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-1419 Initialize Cache Manager " ));

	iTestStepStage = 0;
	TEST( TServerResources::iCacheManager != 0 );
	TEST( TServerResources::iCacheManager->iIdleRepositories.Count() == 0 );
	TServerResources::iCacheManager->EnableCache();

	NextTest( _L( "Cache Repository (Open/Close)" ) );

	CacheRepositoryL(KUidCacheTestRepositorySm);

	if ((iStage == ESizeMin)||(iStage == EReallyWorstCase))
		{
		TEST( TServerResources::iCacheManager->iIdleRepositories.Count() == 0 );
		}
	else
		{
		TEST( TServerResources::iCacheManager->iIdleRepositories.Count() == 1 );
		}

	NextTest( _L( "Check Cache Size" ) );

	if ((iStage == ESizeMin)||(iStage == EReallyWorstCase))
		{
		TEST( TServerResources::iCacheManager->iTotalCacheUsage == 0 );
		}
	else
		{
		TEST( TServerResources::iCacheManager->iTotalCacheUsage > 0 );
		}

	NextTest( _L( "Flush Cache" ) );

	TServerResources::iCacheManager->FlushCache();

	TEST( TServerResources::iCacheManager->iIdleRepositories.Count() == 0 );
	TEST( TServerResources::iCacheManager->iTotalCacheUsage == 0 );


	if (!iOOMTest)
		{
		// This test is excluded from generic OOM testing because
		// 1. It is trying to simulate OOM condition in a different way (fillingup the memory with
		// allocs) which makes it very tricky to work under normal OOM testing method
		// 2. Loading Lrg repository within OOM takes forever because there're many allocations, and
		// loading other repositories are already tested in other tests

		NextTest( _L( "Cache OOM Handling" ) );

		// Fill cache with reps
		TInt totalsize;
		TInt cachedRepositoryCount = 0;

		totalsize = CacheRepositoryL(KUidCacheTestRepositorySm);
		if (TServerResources::iCacheManager->iCacheSize >= totalsize)
			{
			cachedRepositoryCount++;
			}
		totalsize += CacheRepositoryL(KUidCacheTestRepositorySm2);
		if (TServerResources::iCacheManager->iCacheSize >= totalsize)
			{
			cachedRepositoryCount++;
			}
		totalsize += CacheRepositoryL(KUidCacheTestRepositoryLrg);
		if (TServerResources::iCacheManager->iCacheSize >= totalsize)
			{
			cachedRepositoryCount++;
			}
		totalsize += CacheRepositoryL(KUidCacheTestRepositoryMed2);
		if (TServerResources::iCacheManager->iCacheSize >= totalsize)
			{
			cachedRepositoryCount++;
			}

		TInt res = KErrNone;
		//	Fill Memory
		TInt popCount=0;
		RHeap& myHeap = User::Heap();
		TInt firstSize = myHeap.Size();
		TInt biggestBlock;
		TInt firstAvail = myHeap.Available(biggestBlock);

		while(ETrue)
			{
			// We need to really fill up the memory, because we want it to be really freed when we explictly
			// free it, so that when we alloc again there will be some free memory. Using debug allocfail
			// tools would have been too artifical for such a test
			TAny* dummy = User::Alloc(KMemoryFiller);
			if (dummy)
				{
				popCount++;
				TRAP( res, CleanupStack::PushL(dummy); CleanupStack::Pop(dummy););
				if (res == KErrNoMemory)
					{
					// If we cannot allocate enough memory for the cleanupstack frame, we also deallocate
					// the last memory block. This is mandatory for the correct functioning of the
					// following test cases
					// Note when an object that is attempted to be PushL to the cleanupstack and it fails
 					// the object will be freed automatically.
					popCount--;
					break;
					}
				else
					{
					CleanupStack::PushL(dummy);
					}
				}
			else
				{
Пример #22
0
void CGroupViewTester::RunL()
	{
	switch (iCurrentTest)
		{
		case ECreateLocalView:
			iLog.LogLine(_L("=== Create local view"));
			iLocalView=CContactLocalView::NewL(*this,iDb,iSortOrder_1,EContactAndGroups/*EContactsOnly*/);
			break;
		case EExerciseLocalView:
			iLog.LogLine(_L("=== Exercise local view"));			
			ExceriseViewL(*iLocalView);
			NextTest();
			break;
		case ECreateGroupOneView:
			{
			iLog.LogLine(_L("=== GroupOneView"));
			iGroupViewOne=CContactGroupView::NewL(iDb,*iLocalView,*this,iGroupOne->Id(),CContactGroupView::EShowContactsInGroup);
			}
			break;
		case ETestGroupOneView:
			{
			iLog.LogLine(_L("==== Exercise ETestGroupOneView"));
			TInt groupCount = iGroupOne->ItemsContained()->Count();
			test(iGroupViewOne->CountL()==groupCount);
			const CContactIdArray* array= iGroupOne->ItemsContained();
			for (TInt ii=0;ii<groupCount;ii++)
				{
				test(iGroupViewOne->FindL((*array)[ii])!=KErrNotFound);
				}
			TestGroupViewSortOrderL(*iGroupViewOne);
			NextTest();
			}
			break;
		case ECreateGroupOneViewByName:
			{
			iLog.LogLine(_L("=== Create GroupOneView By Name"));
			iGroupViewOneByName=CContactGroupView::NewL(iDb,*iLocalView,*this,KGroupOneName,CContactGroupView::EShowContactsInGroup);
			}
			break;
		case ETestGroupOneViewByName:
			{
			iLog.LogLine(_L("==== Exercise ETestGroupOneView By Name"));
			TInt groupCount = iGroupOne->ItemsContained()->Count();
			test(iGroupViewOneByName->CountL()==groupCount);
			const CContactIdArray* array= iGroupOne->ItemsContained();
			for (TInt ii=0;ii<groupCount;ii++)
				{
				test(iGroupViewOneByName->FindL((*array)[ii])!=KErrNotFound);
				}
			TestGroupViewSortOrderL(*iGroupViewOneByName);
			NextTest();
			break;
			}
		case ECreateGroupOneViewNotInGroup:
			{
			iLog.LogLine(_L("=== Create GroupOneViewNotInGroup By Name"));
			iGroupViewOneNotInGroup=CContactGroupView::NewL(iDb,*iLocalView,*this,KGroupOneName,CContactGroupView::EShowContactsNotInGroup);
			}
			break;
		case ETestGroupOneViewNotInGroup:
			{
			iLog.LogLine(_L("==== Exercise GroupOneViewNotInGroup By Name"));
			TInt totalContacts = iLocalView->CountL();
			TInt totalNotInGroup =  totalContacts - KNumContactsInGroupOne;
			test(iGroupViewOneNotInGroup->CountL()==totalNotInGroup);
			const CContactIdArray* array= iGroupOne->ItemsContained();
			TInt groupCount = array->Count();
			for (TInt ii=0;ii<groupCount;ii++)
				{
				test(iGroupViewOneNotInGroup->FindL((*array)[ii])==KErrNotFound);
				}
			TestGroupViewSortOrderL(*iGroupViewOneNotInGroup);
			NextTest();
			break;
			}
		case EAllViewsOutOfBoundsAccess:
			{
			//Views depend on their underlying views being in a good state, however
			//as some base views are potentially in other processes they must be resistant
			//to out of date views accessesing out of bound members, views, should not
			//panic but should leave with KErrNotFound;
			//local view
			TInt err=0;
			iLog.LogLine(_L("=== Test views for out of bounds access"));
			TInt outCount = iGroupViewOneByName->CountL();
			TRAP(err,iGroupViewOneByName->AtL(outCount));
			test(err==KErrNotFound);
			TRAP(err,iGroupViewOneByName->ContactAtL(outCount));
			test(err==KErrNotFound);
			NextTest();
			}
			break;
		case ECreateUnfiledGroupView:
			{
			iLog.LogLine(_L("=== Create Unfiled group view"));
			iGroupViewUnfiled=CContactGroupView::NewL(iDb,*iLocalView,*this,KNullContactId,CContactGroupView::EShowContactsNotInAnyGroup);
			}
			break;
		case ETestUnfiledGroupView:
			{
			iLog.LogLine(_L("==== Exercise Unfiled group"));
			const TInt totalContacts = iLocalView->CountL();
			const TInt totalUnfiled =  totalContacts - KNumContactsInGroupOne - KNumGroups;
			test(iGroupViewUnfiled->CountL()==totalUnfiled);			
			test(iGroupViewUnfiled->FindL(iGroupOneId));
			TestGroupViewSortOrderL(*iGroupViewUnfiled);

			CRandomContactGenerator* generator = CRandomContactGenerator::NewL();
			CleanupStack::PushL(generator);
			generator->SetDbL(iDb);
			generator->AddTypicalRandomContactL();
			CleanupStack::PopAndDestroy(generator);
			iNumNotificationExpected=5;
			}
			break;
		case ETestUnfiledGroupAddition:
			{
			iLog.LogLine(_L("==== Exercise Unfiled group addition"));
			TInt revisedCount = iGroupViewUnfiled->CountL();
			CContactIdArray* unfiled = iDb.UnfiledContactsL();
			test(revisedCount == unfiled->Count());
			delete unfiled;
			ExceriseViewL(*iGroupViewUnfiled);
			// Test that adding contact which currently forms part of
			// iGroupViewUnfiled to iGroupOne causes update of
			// iGroupViewUnfiled such that the contact no longer forms
			// part of iGroupViewUnfiled (i.e. by adding the contact to the
			// group it is no longer unfiled and should not appear in the
			// unfiled view).  The update to iGroupViewUnfiled will not take
			// place until the view receives the change event so wait until the
			// view observer method HandleContactViewEvent() is called before
			// testing that the expected change to iGroupViewUnfiled has taken
			// place.
			iDb.AddContactToGroupL(KNumContacts,iGroupOne->Id());
			// Expect (ESortOrderChanged x 4) + EGroupChanged + (EItemRemoved x
			// 4) + (EItemAdded x 4).
			iNumNotificationExpected=13;
			}
			break;
		case ENumTests:
			iLog.LogLine(_L("==== Group View Tests Finished, All Passed...\n"));
			CActiveScheduler::Stop();
			delete this;
			break;
		default:
			ASSERT(EFalse);
			break;
		}   
	}       
Пример #23
0
void CGroupViewTester::HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent)
	{
	//LOGGING///////////////////////////////////////////////////////////////////////////////////
				if(&aView == iLocalView)
					test.Printf(_L("LocalView "));
				else if(&aView == iGroupViewOne)
					test.Printf(_L("GroupViewOne "));
				else if(&aView == iGroupViewOneByName)
					test.Printf(_L("GroupViewOneByName "));
				else if(&aView == iGroupViewOneNotInGroup)
					test.Printf(_L("GroupViewOneNotInGroup "));
				else if(&aView == iGroupViewUnfiled)
					test.Printf(_L("GroupViewUnfiled "));
				else
					test.Printf(_L("Er, none of the known views... "));

				switch (aEvent.iEventType)
					{
					case TContactViewEvent::EUnavailable:
						test.Printf(_L("EUnavailable\n"));
						break;
					case TContactViewEvent::EReady:
						test.Printf(_L("EReady\n"));
						break;
					case TContactViewEvent::ESortOrderChanged:
						test.Printf(_L("ESortOrderChanged\n"));
						break;
					case TContactViewEvent::ESortError:
						test.Printf(_L("ESortError\n"));
						break;
					case TContactViewEvent::EServerError:
						test.Printf(_L("EServerError\n"));
						break;
					case TContactViewEvent::EIndexingError:
						test.Printf(_L("EIndexingError\n"));
						break;
					case TContactViewEvent::EItemAdded:
						test.Printf(_L("EItemAdded\n"));
						break;
					case TContactViewEvent::EItemRemoved:
						test.Printf(_L("EItemRemoved\n"));
						break;
					case TContactViewEvent::EGroupChanged:
						test.Printf(_L("EGroupChanged\n"));
						break;
					default:
						test.Printf(_L("Er, none of the known event types... "));
						break;
					}
	////////////////////////////////////////////////////////////////////////////////////////////
	
	switch (iCurrentTest)
		{
		case ECreateLocalView:
			test(iLocalView==&aView);
			test(aEvent.iEventType==TContactViewEvent::EReady);
			break;
		case EExerciseLocalView:
			test(ETrue);
			break;
		case ECreateGroupOneView:
			test(iGroupViewOne==&aView);
			test(aEvent.iEventType==TContactViewEvent::EReady);
			break;
		case ETestGroupOneView:
			test(EFalse);
			break;
		case ECreateGroupOneViewByName:
			test(iGroupViewOneByName==&aView);
			test(aEvent.iEventType==TContactViewEvent::EReady);
			break;
		case ETestGroupOneViewByName:
			test(EFalse);
			break;
		case ECreateGroupOneViewNotInGroup:
			test(iGroupViewOneNotInGroup==&aView);
			test(aEvent.iEventType==TContactViewEvent::EReady);
			break;
		case ETestGroupOneViewNotInGroup:
			test(EFalse);
			break;
		case EAllViewsOutOfBoundsAccess:
			test(EFalse);
			break;
		case ECreateUnfiledGroupView:
			test(iGroupViewUnfiled==&aView);
			test(aEvent.iEventType==TContactViewEvent::EReady);
			break;
		case ETestUnfiledGroupView:
			break;
		case ETestUnfiledGroupAddition:
			{
			// No point testing for each and every notification: the test will
			// pass for all notifications.
			if (iNumNotificationExpected > 1)
				{
				break;
				}
			// Test that adding contact which formed part of iGroupViewUnfiled
			// to iGroupOne caused update of iGroupViewUnfiled such that the
			// contact no longer forms part of iGroupViewUnfiled (i.e. by adding
			// the contact to the group it is no longer unfiled is not a member
			// of the unfiled view).
			TInt ret(KErrNone);
			TRAPD(err1, ret = iGroupViewUnfiled->FindL(KNumContacts) );
			test(err1 == KErrNone && ret == KErrNotFound);
			// Double check - make sure the number of items in the unfiled
			// group view agrees with the number of unfiled items reported by
			// the database.
			TInt groupViewUnfiledCount(0);
			TRAPD(err2, groupViewUnfiledCount = iGroupViewUnfiled->CountL() );
			CContactIdArray* dbUnfiled = NULL;
			TRAPD(err3, dbUnfiled = iDb.UnfiledContactsL() );
			test(err2 == KErrNone && err3 == KErrNone && groupViewUnfiledCount==dbUnfiled->Count() );
			delete dbUnfiled;
			}
			break;
		case ENumTests:
		default:
			test(EFalse);
			break;
		}
	if (--iNumNotificationExpected <= 0)
		{
		iNumNotificationExpected=0;
		NextTest();
		}
	}
Пример #24
0
//--------------------
// Result & clean
//--------------------
void DLCSystemTests::AllDLCCompleted()
{
    NextTest();
}