loggingservices/eventlogger/test/src/t_logfile.cpp
branchRCL_3
changeset 24 cc28652e0254
parent 23 26645d81f48d
equal deleted inserted replaced
23:26645d81f48d 24:cc28652e0254
   196 	TBool finished = EFalse;
   196 	TBool finished = EFalse;
   197 	TInt error;
   197 	TInt error;
   198 
   198 
   199 	while(!finished)
   199 	while(!finished)
   200 		{
   200 		{
   201 		TheTest.Printf(_L("%d\r\n"), failCount);
   201         if(failCount == 4)
   202 
       
   203         if(failCount > 8)
       
   204             {
   202             {
   205             TRAP(error, client = CLogClient::NewL(theFs));
   203             TRAP(error, client = CLogClient::NewL(theFs));
   206             TEST2(error, KErrNone);
   204             TEST2(error, KErrNone);
   207             TestBasicL(*client);
   205             TestBasicL(*client);
   208             finished = ETrue;
   206             finished = ETrue;
   209             continue;
   207             continue;
   210             }
   208             }
   211 		
   209 
   212 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
   210 		__FILE_FAILNEXT(++failCount);
   213 
   211 
   214 		TRAP(error, client = CLogClient::NewL(theFs));
   212 		TRAP(error, client = CLogClient::NewL(theFs));
   215 
   213 
   216 		__FILE_RESET;
   214 		__FILE_RESET;
   217 
   215 
   220 			finished = ETrue;
   218 			finished = ETrue;
   221 			TestBasicL(*client);
   219 			TestBasicL(*client);
   222 			}
   220 			}
   223 		else
   221 		else
   224 			{
   222 			{
   225 			TEST2(error, KErrNoMemory);
   223 			TEST2(error, KErrGeneral);
   226 			TestUtils::DeleteDatabaseL();
   224 			TestUtils::DeleteDatabaseL();
   227 			}
   225 			}
   228 		}
   226 		}
   229 
   227 
   230 	delete client;
   228 	delete client;
   231 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
   229 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
   232 	}
   230 	}
   233 
   231 
   234 /**
   232 /**
   235 @SYMTestCaseID          SYSLIB-LOGENG-CT-0912
   233 @SYMTestCaseID          SYSLIB-LOGENG-CT-0912
   236 @SYMTestCaseDesc	    Adding an event type test,
   234 @SYMTestCaseDesc	    Adding an event type test,
   258 	TInt error;
   256 	TInt error;
   259 
   257 
   260 	while(!finished)
   258 	while(!finished)
   261 		{
   259 		{
   262 		error = KErrNone;
   260 		error = KErrNone;
   263         if(failCount == 8)
   261 
       
   262         if(failCount == 4)
   264             {
   263             {
   265             aClient.AddEventType(*type, active->iStatus);
   264             aClient.AddEventType(*type, active->iStatus);
   266             active->StartL();
   265             active->StartL();
   267             CActiveScheduler::Start();
   266             CActiveScheduler::Start();
   268             TEST2(active->iStatus.Int(), KErrNone);
   267             TEST2(active->iStatus.Int(), KErrNone);
   269             finished = ETrue;
   268             finished = ETrue;
   270             continue;
   269             continue;
   271             }
   270             }
   272 
       
   273 		TheTest.Printf(_L("%d  \r"), failCount);
       
   274         
       
   275 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
       
   276 		
   271 		
       
   272 		__FILE_FAILNEXT(++failCount);
       
   273 
   277 		aClient.AddEventType(*type, active->iStatus);
   274 		aClient.AddEventType(*type, active->iStatus);
   278 	
   275 	
   279 		active->StartL();
   276 		active->StartL();
   280 		CActiveScheduler::Start();
   277 		CActiveScheduler::Start();
   281 		
   278 		
   284 		else
   281 		else
   285 			error = active->iStatus.Int();
   282 			error = active->iStatus.Int();
   286 
   283 
   287 		__FILE_RESET;
   284 		__FILE_RESET;
   288 
   285 
   289 		if (error == KErrNoMemory)
   286 		if (error == KErrGeneral)
   290 			{
   287 			{
   291 			active->StartL();
   288 			active->StartL();
   292 			aClient.GetEventType(*type, active->iStatus);
   289 			aClient.GetEventType(*type, active->iStatus);
   293 			CActiveScheduler::Start();
   290 			CActiveScheduler::Start();
   294 			TEST2(active->iStatus.Int(), KErrNotFound);
   291 			TEST2(active->iStatus.Int(), KErrNotFound);
   302 	aClient.AddEventType(*type, active->iStatus);
   299 	aClient.AddEventType(*type, active->iStatus);
   303 	CActiveScheduler::Start();
   300 	CActiveScheduler::Start();
   304 	TEST2(active->iStatus.Int(), KErrAlreadyExists);
   301 	TEST2(active->iStatus.Int(), KErrAlreadyExists);
   305 
   302 
   306 	CleanupStack::PopAndDestroy(2); // active, type
   303 	CleanupStack::PopAndDestroy(2); // active, type
   307 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
   304 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
   308 	}
   305 	}
   309 
   306 
   310 /**
   307 /**
   311 @SYMTestCaseID          SYSLIB-LOGENG-CT-0913
   308 @SYMTestCaseID          SYSLIB-LOGENG-CT-0913
   312 @SYMTestCaseDesc	    Getting an event type test.
   309 @SYMTestCaseDesc	    Getting an event type test.
   330 	TInt failCount = 0;
   327 	TInt failCount = 0;
   331 	TBool finished = EFalse;
   328 	TBool finished = EFalse;
   332 
   329 
   333 	while(!finished)
   330 	while(!finished)
   334 		{
   331 		{
   335 		TheTest.Printf(_L("%d  \r"), failCount);
   332 		__FILE_FAILNEXT(++failCount);
   336 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
       
   337 
   333 
   338 		aClient.GetEventType(*type, active->iStatus);
   334 		aClient.GetEventType(*type, active->iStatus);
   339 
   335 
   340 		active->StartL();
   336 		active->StartL();
   341 		CActiveScheduler::Start();
   337 		CActiveScheduler::Start();
   342 		
   338 		
   343 		if (active->iStatus == KErrNone)
   339 		if (active->iStatus == KErrNone)
   344 			finished = ETrue;
   340 			finished = ETrue;
   345 		else
   341 		else
   346 			{
   342 			{
   347 			TEST2(active->iStatus.Int(), KErrNoMemory);
   343 			TEST2(active->iStatus.Int(), KErrGeneral);
   348 			TEST(type->Description() == KNullDesC);
   344 			TEST(type->Description() == KNullDesC);
   349 			}
   345 			}
   350 
   346 
   351 		__FILE_RESET;
   347 		__FILE_RESET;
   352 		}
   348 		}
   354 	TEST(type->Uid() == KTestEventUid);
   350 	TEST(type->Uid() == KTestEventUid);
   355 	TEST(type->Description() == KTestEventDesc1);
   351 	TEST(type->Description() == KTestEventDesc1);
   356 	TEST(type->LoggingEnabled());
   352 	TEST(type->LoggingEnabled());
   357 
   353 
   358 	CleanupStack::PopAndDestroy(2); // active, type
   354 	CleanupStack::PopAndDestroy(2); // active, type
   359 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
   355 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
   360 	}
   356 	}
   361 
   357 
   362 /**
   358 /**
   363 @SYMTestCaseID          SYSLIB-LOGENG-CT-0914
   359 @SYMTestCaseID          SYSLIB-LOGENG-CT-0914
   364 @SYMTestCaseDesc	    Changing an event type test,
   360 @SYMTestCaseDesc	    Changing an event type test,
   388 		error = KErrNone;
   384 		error = KErrNone;
   389 
   385 
   390 		type->SetDescription(KTestEventDesc2);
   386 		type->SetDescription(KTestEventDesc2);
   391 		type->SetLoggingEnabled(EFalse);
   387 		type->SetLoggingEnabled(EFalse);
   392 
   388 
   393         if(failCount == 8)
   389         if(failCount == 3)
   394             {
   390             {
   395             aClient.ChangeEventType(*type, active->iStatus);
   391             aClient.ChangeEventType(*type, active->iStatus);
   396             active->StartL();
   392             active->StartL();
   397             CActiveScheduler::Start();
   393             CActiveScheduler::Start();
   398             TEST2(active->iStatus.Int(), KErrNone);
   394             TEST2(active->iStatus.Int(), KErrNone);
   399             finished = ETrue;
   395             finished = ETrue;
   400             continue;
   396             continue;
   401             }
   397             }
   402 		
   398 		
   403 		TheTest.Printf(_L("%d  \r"), failCount);
   399 		__FILE_FAILNEXT(++failCount);
   404 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
       
   405 
   400 
   406 		aClient.ChangeEventType(*type, active->iStatus);
   401 		aClient.ChangeEventType(*type, active->iStatus);
   407 
   402 
   408 		active->StartL();
   403 		active->StartL();
   409 		CActiveScheduler::Start();
   404 		CActiveScheduler::Start();
   413 		else
   408 		else
   414 			error = active->iStatus.Int();
   409 			error = active->iStatus.Int();
   415 
   410 
   416 		__FILE_RESET;
   411 		__FILE_RESET;
   417 
   412 
   418 		if (error == KErrNoMemory)
   413 		if (error == KErrGeneral)
   419 			{
   414 			{
   420 			active->StartL();
   415 			active->StartL();
   421 			aClient.GetEventType(*type, active->iStatus);
   416 			aClient.GetEventType(*type, active->iStatus);
   422 			CActiveScheduler::Start();
   417 			CActiveScheduler::Start();
   423 			TEST2(active->iStatus.Int(), KErrNone);
   418 			TEST2(active->iStatus.Int(), KErrNone);
   439 	TEST(type->Uid() == KTestEventUid);
   434 	TEST(type->Uid() == KTestEventUid);
   440 	TEST(type->Description() == KTestEventDesc2);
   435 	TEST(type->Description() == KTestEventDesc2);
   441 	TEST(type->LoggingEnabled() == EFalse);
   436 	TEST(type->LoggingEnabled() == EFalse);
   442 
   437 
   443 	CleanupStack::PopAndDestroy(2); // type, active
   438 	CleanupStack::PopAndDestroy(2); // type, active
   444 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
   439 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
   445 	}
   440 	}
   446 
   441 
   447 /**
   442 /**
   448 @SYMTestCaseID          SYSLIB-LOGENG-CT-0915
   443 @SYMTestCaseID          SYSLIB-LOGENG-CT-0915
   449 @SYMTestCaseDesc	    Deleting an event type test
   444 @SYMTestCaseDesc	    Deleting an event type test
   470 
   465 
   471 	while(!finished)
   466 	while(!finished)
   472 		{
   467 		{
   473 		error = KErrNone;
   468 		error = KErrNone;
   474 
   469 
   475         if(failCount == 8)
   470         if(failCount == 3)
   476             {
   471             {
   477             aClient.DeleteEventType(KTestEventUid, active->iStatus);
   472             aClient.DeleteEventType(KTestEventUid, active->iStatus);
   478             active->StartL();
   473             active->StartL();
   479             CActiveScheduler::Start();
   474             CActiveScheduler::Start();
   480             TEST2(active->iStatus.Int(), KErrNone);
   475             TEST2(active->iStatus.Int(), KErrNone);
   481             finished = ETrue;
   476             finished = ETrue;
   482             continue;
   477             continue;
   483             }
   478             }
   484 		
   479 		
   485 		TheTest.Printf(_L("%d  \r"), failCount);
   480 		__FILE_FAILNEXT(++failCount);
   486 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
       
   487 
   481 
   488 		aClient.DeleteEventType(KTestEventUid, active->iStatus);
   482 		aClient.DeleteEventType(KTestEventUid, active->iStatus);
   489 
   483 
   490 		active->StartL();
   484 		active->StartL();
   491 		CActiveScheduler::Start();
   485 		CActiveScheduler::Start();
   495 		else
   489 		else
   496 			error = active->iStatus.Int();
   490 			error = active->iStatus.Int();
   497 
   491 
   498 		__FILE_RESET;
   492 		__FILE_RESET;
   499 
   493 
   500 		if (error == KErrNoMemory)
   494 		if (error == KErrGeneral)
   501 			{
   495 			{
   502 			active->StartL();
   496 			active->StartL();
   503 			aClient.GetEventType(*type, active->iStatus);
   497 			aClient.GetEventType(*type, active->iStatus);
   504 			CActiveScheduler::Start();
   498 			CActiveScheduler::Start();
   505 			TEST2(active->iStatus.Int(), KErrNone);
   499 			TEST2(active->iStatus.Int(), KErrNone);
   512 	aClient.GetEventType(*type, active->iStatus);
   506 	aClient.GetEventType(*type, active->iStatus);
   513 	CActiveScheduler::Start();
   507 	CActiveScheduler::Start();
   514 	TEST2(active->iStatus.Int(), KErrNotFound);
   508 	TEST2(active->iStatus.Int(), KErrNotFound);
   515 
   509 
   516 	CleanupStack::PopAndDestroy(2); // type, active
   510 	CleanupStack::PopAndDestroy(2); // type, active
   517 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
   511 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
   518 	}
   512 	}
   519 
   513 
   520 /**
   514 /**
   521 @SYMTestCaseID          SYSLIB-LOGENG-CT-0916
   515 @SYMTestCaseID          SYSLIB-LOGENG-CT-0916
   522 @SYMTestCaseDesc	    Adding an event test,
   516 @SYMTestCaseDesc	    Adding an event test,
   572 
   566 
   573 	while(!finished)
   567 	while(!finished)
   574 		{
   568 		{
   575 		error = KErrNone;
   569 		error = KErrNone;
   576 
   570 
   577         if(failCount == 8)
   571         if(failCount == 3)
   578             {
   572             {
   579             aClient.AddEvent(*event, active->iStatus);
   573             aClient.AddEvent(*event, active->iStatus);
   580             active->StartL();
   574             active->StartL();
   581             CActiveScheduler::Start();
   575             CActiveScheduler::Start();
   582             TEST2(active->iStatus.Int(), KErrNone);
   576             TEST2(active->iStatus.Int(), KErrNone);
   583             finished = ETrue;
   577             finished = ETrue;
   584             continue;
   578             continue;
   585             }
   579             }
   586 
   580 
   587 		TheTest.Printf(_L("%d  \r"), failCount);
   581 		__FILE_FAILNEXT(++failCount);
   588 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
       
   589 		aClient.AddEvent(*event, active->iStatus);
   582 		aClient.AddEvent(*event, active->iStatus);
   590 
   583 
   591 		active->StartL();
   584 		active->StartL();
   592 		CActiveScheduler::Start();
   585 		CActiveScheduler::Start();
   593 
   586 
   596 		else
   589 		else
   597 			error = active->iStatus.Int();
   590 			error = active->iStatus.Int();
   598 
   591 
   599 		__FILE_RESET;
   592 		__FILE_RESET;
   600 
   593 
   601 		if (error == KErrNoMemory)
   594 		if (error == KErrGeneral)
   602 			{
   595 			{
       
   596 			TEST2(error, KErrGeneral);
   603 			event->SetId(0);
   597 			event->SetId(0);
   604 
   598 
   605 			active->StartL();
   599 			active->StartL();
   606 			aClient.GetEvent(*event, active->iStatus);
   600 			aClient.GetEvent(*event, active->iStatus);
   607 			CActiveScheduler::Start();
   601 			CActiveScheduler::Start();
   621 	aClient.GetEvent(*event, active->iStatus);
   615 	aClient.GetEvent(*event, active->iStatus);
   622 	CActiveScheduler::Start();
   616 	CActiveScheduler::Start();
   623 	TEST2(active->iStatus.Int(), KErrNone);
   617 	TEST2(active->iStatus.Int(), KErrNone);
   624 
   618 
   625 	CleanupStack::PopAndDestroy(3); // event, active, type
   619 	CleanupStack::PopAndDestroy(3); // event, active, type
   626 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
   620 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
   627 	}
   621 	}
   628 
   622 
   629 /**
   623 /**
   630 @SYMTestCaseID          SYSLIB-LOGENG-CT-0917
   624 @SYMTestCaseID          SYSLIB-LOGENG-CT-0917
   631 @SYMTestCaseDesc	    Get an events' information test
   625 @SYMTestCaseDesc	    Get an events' information test
   650 	TInt failCount = 0;
   644 	TInt failCount = 0;
   651 	TBool finished = EFalse;
   645 	TBool finished = EFalse;
   652 
   646 
   653 	while(!finished)
   647 	while(!finished)
   654 		{
   648 		{
   655 		TheTest.Printf(_L("%d  \r"), failCount);
   649 		__FILE_FAILNEXT(++failCount);
   656 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
       
   657 		aClient.GetEvent(*event, active->iStatus);
   650 		aClient.GetEvent(*event, active->iStatus);
   658 
   651 
   659 		active->StartL();
   652 		active->StartL();
   660 		CActiveScheduler::Start();
   653 		CActiveScheduler::Start();
   661 
   654 
   662 		if (active->iStatus == KErrNone)
   655 		if (active->iStatus == KErrNone)
   663 			finished = ETrue;
   656 			finished = ETrue;
   664 		else
   657 		else
   665 			TEST2(active->iStatus.Int(), KErrNoMemory);
   658 			TEST2(active->iStatus.Int(), KErrGeneral);
   666 
   659 
   667 		__FILE_RESET;
   660 		__FILE_RESET;
   668 		}
   661 		}
   669 
   662 
   670 	TEST(event->Id() == 0);
   663 	TEST(event->Id() == 0);
   681 	TEST(event->Contact() == KTestContact1);
   674 	TEST(event->Contact() == KTestContact1);
   682 	TEST(event->Link() == KTestLink1);
   675 	TEST(event->Link() == KTestLink1);
   683 	TEST(event->Data() == KTestData1);
   676 	TEST(event->Data() == KTestData1);
   684 
   677 
   685 	CleanupStack::PopAndDestroy(2); // event, active
   678 	CleanupStack::PopAndDestroy(2); // event, active
   686 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
   679 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
   687 	}
   680 	}
   688 
   681 
   689 /**
   682 /**
   690 @SYMTestCaseID          SYSLIB-LOGENG-CT-0918
   683 @SYMTestCaseID          SYSLIB-LOGENG-CT-0918
   691 @SYMTestCaseDesc	    Changing an event type test
   684 @SYMTestCaseDesc	    Changing an event type test
   727 		event->SetNumber(KTestNumber2);
   720 		event->SetNumber(KTestNumber2);
   728 		event->SetContact(KTestContact2);
   721 		event->SetContact(KTestContact2);
   729 		event->SetLink(KTestLink2);
   722 		event->SetLink(KTestLink2);
   730 		event->SetDataL(KTestData2);
   723 		event->SetDataL(KTestData2);
   731 
   724 
   732         if(failCount == 14)
   725         if(failCount == 3)
   733             {
   726             {
   734             aClient.ChangeEvent(*event, active->iStatus);
   727             aClient.ChangeEvent(*event, active->iStatus);
   735             active->StartL();
   728             active->StartL();
   736             CActiveScheduler::Start();
   729             CActiveScheduler::Start();
   737             TEST2(active->iStatus.Int(), KErrNone);
   730             TEST2(active->iStatus.Int(), KErrNone);
   738             finished = ETrue;
   731             finished = ETrue;
   739             continue;
   732             continue;
   740             }
   733             }
   741 		
   734 		
   742 		TheTest.Printf(_L("%d  \r"), failCount);
   735 		__FILE_FAILNEXT(++failCount);
   743 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
       
   744 
   736 
   745 		aClient.ChangeEvent(*event, active->iStatus);
   737 		aClient.ChangeEvent(*event, active->iStatus);
   746 
   738 
   747 		active->StartL();
   739 		active->StartL();
   748 		CActiveScheduler::Start();
   740 		CActiveScheduler::Start();
   751 		else
   743 		else
   752 			error = active->iStatus.Int();
   744 			error = active->iStatus.Int();
   753 
   745 
   754 		__FILE_RESET;
   746 		__FILE_RESET;
   755 
   747 
   756 		if (error == KErrNoMemory)
   748 		if (error == KErrGeneral)
   757 			{
   749 			{
   758 			active->StartL();
   750 			active->StartL();
   759 			aClient.GetEvent(*event, active->iStatus);
   751 			aClient.GetEvent(*event, active->iStatus);
   760 			CActiveScheduler::Start();
   752 			CActiveScheduler::Start();
   761 			if (active->iStatus != KErrNone) 
   753 			if (active->iStatus != KErrNone) 
   762 			    TheTest.Printf(_L("\nerror code:%d failcount:%d\n"),active->iStatus.Int(),failCount);
   754 			    TheTest.Printf(_L("error code:%d failcount:%d\n"),active->iStatus.Int(),failCount);
   763 			TEST2(active->iStatus.Int(), KErrNone);
   755 			TEST2(active->iStatus.Int(), KErrNone);
   764 
   756 
   765 			TEST(event->Id() == 0);
   757 			TEST(event->Id() == 0);
   766 			TEST(event->Time() > TTime(0));
   758 			TEST(event->Time() > TTime(0));
   767 			TEST(event->Description() == KTestEventDesc1);
   759 			TEST(event->Description() == KTestEventDesc1);
   800 	TEST(event->Contact() == KTestContact2);
   792 	TEST(event->Contact() == KTestContact2);
   801 	TEST(event->Link() == KTestLink2);
   793 	TEST(event->Link() == KTestLink2);
   802 	TEST(event->Data() == KTestData2);
   794 	TEST(event->Data() == KTestData2);
   803 
   795 
   804 	CleanupStack::PopAndDestroy(2); // event, active
   796 	CleanupStack::PopAndDestroy(2); // event, active
   805 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
   797 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
   806 	}
   798 	}
   807 
   799 
   808 /**
   800 /**
   809 @SYMTestCaseID          SYSLIB-LOGENG-CT-0919
   801 @SYMTestCaseID          SYSLIB-LOGENG-CT-0919
   810 @SYMTestCaseDesc	    Deleting an event test,
   802 @SYMTestCaseDesc	    Deleting an event test,
   832 
   824 
   833 	while(!finished)
   825 	while(!finished)
   834 		{
   826 		{
   835 		error = KErrNone;
   827 		error = KErrNone;
   836 
   828 
   837         if(failCount == 10)
   829         if(failCount == 6)
   838             {
   830             {
   839             aClient.DeleteEvent(0, active->iStatus);
   831             aClient.DeleteEvent(0, active->iStatus);
   840             active->StartL();
   832             active->StartL();
   841             CActiveScheduler::Start();
   833             CActiveScheduler::Start();
   842             TEST2(active->iStatus.Int(), KErrNone);
   834             TEST2(active->iStatus.Int(), KErrNone);
   843             finished = ETrue;
   835             finished = ETrue;
   844             continue;
   836             continue;
   845             }
   837             }
   846 		
   838 		
   847 		TheTest.Printf(_L("%d  \r"), failCount);
   839 		__FILE_FAILNEXT(++failCount);
   848 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
       
   849 
   840 
   850 		aClient.DeleteEvent(0, active->iStatus);
   841 		aClient.DeleteEvent(0, active->iStatus);
   851 
   842 
   852 		active->StartL();
   843 		active->StartL();
   853 		CActiveScheduler::Start();
   844 		CActiveScheduler::Start();
   857 		else
   848 		else
   858 			error = active->iStatus.Int();
   849 			error = active->iStatus.Int();
   859 
   850 
   860 		__FILE_RESET;
   851 		__FILE_RESET;
   861 
   852 
   862 		if (error == KErrNoMemory)
   853 		if (error == KErrGeneral)
   863 			{
   854 			{
   864 			active->StartL();
   855 			active->StartL();
   865 			aClient.GetEvent(*event, active->iStatus);
   856 			aClient.GetEvent(*event, active->iStatus);
   866 			CActiveScheduler::Start();
   857 			CActiveScheduler::Start();
   867 			TEST2(active->iStatus.Int(), KErrNone);
   858 			TEST2(active->iStatus.Int(), KErrNone);
   874 	aClient.GetEvent(*event, active->iStatus);
   865 	aClient.GetEvent(*event, active->iStatus);
   875 	CActiveScheduler::Start();
   866 	CActiveScheduler::Start();
   876 	TEST2(active->iStatus.Int(), KErrNotFound);
   867 	TEST2(active->iStatus.Int(), KErrNotFound);
   877 
   868 
   878 	CleanupStack::PopAndDestroy(2); // event, active
   869 	CleanupStack::PopAndDestroy(2); // event, active
   879 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
   870 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
   880 	}
   871 	}
   881 
   872 
   882 /**
   873 /**
   883 @SYMTestCaseID          SYSLIB-LOGENG-CT-0920
   874 @SYMTestCaseID          SYSLIB-LOGENG-CT-0920
   884 @SYMTestCaseDesc	    Getting the Log Engine configuration information test
   875 @SYMTestCaseDesc	    Getting the Log Engine configuration information test
   904 	TInt failCount = 0;
   895 	TInt failCount = 0;
   905 	TBool finished = EFalse;
   896 	TBool finished = EFalse;
   906 
   897 
   907 	while(!finished)
   898 	while(!finished)
   908 		{
   899 		{
   909 		TheTest.Printf(_L("%d  \r"), failCount);
   900 		__FILE_FAILNEXT(++failCount);
   910 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
       
   911 		aClient.GetConfig(config, active->iStatus);
   901 		aClient.GetConfig(config, active->iStatus);
   912 
   902 
   913 		active->StartL();
   903 		active->StartL();
   914 		CActiveScheduler::Start();
   904 		CActiveScheduler::Start();
   915 
   905 
   916 		if (active->iStatus == KErrNone)
   906 		if (active->iStatus == KErrNone)
   917 			finished = ETrue;
   907 			finished = ETrue;
   918 		else
   908 		else
   919 			TEST2(active->iStatus.Int(), KErrNoMemory);
   909 			TEST2(active->iStatus.Int(), KErrGeneral);
   920 
   910 
   921 		__FILE_RESET;
   911 		__FILE_RESET;
   922 		}
   912 		}
   923 
   913 
   924 	TEST(config.iMaxEventAge > 0);
   914 	TEST(config.iMaxEventAge > 0);
   925 	TEST(config.iMaxLogSize > 0);
   915 	TEST(config.iMaxLogSize > 0);
   926 	TEST(config.iMaxRecentLogSize > 0);
   916 	TEST(config.iMaxRecentLogSize > 0);
   927 
   917 
   928 	CleanupStack::PopAndDestroy(); // active
   918 	CleanupStack::PopAndDestroy(); // active
   929 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
   919 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
   930 	}
   920 	}
   931 
   921 
   932 /**
   922 /**
   933 @SYMTestCaseID          SYSLIB-LOGENG-CT-0921
   923 @SYMTestCaseID          SYSLIB-LOGENG-CT-0921
   934 @SYMTestCaseDesc	    Changing the configuration of Log Engine test,
   924 @SYMTestCaseDesc	    Changing the configuration of Log Engine test,
   964 
   954 
   965 		config.iMaxLogSize = KTestMaxLogSize;
   955 		config.iMaxLogSize = KTestMaxLogSize;
   966 		config.iMaxRecentLogSize = KTestMaxRecentLogSize;
   956 		config.iMaxRecentLogSize = KTestMaxRecentLogSize;
   967 		config.iMaxEventAge = KTestMaxEventAge;
   957 		config.iMaxEventAge = KTestMaxEventAge;
   968 
   958 
   969         if(failCount == 11)
   959         if(failCount == 4)
   970             {
   960             {
   971             aClient.ChangeConfig(config, active->iStatus);
   961             aClient.ChangeConfig(config, active->iStatus);
   972             active->StartL();
   962             active->StartL();
   973             CActiveScheduler::Start();
   963             CActiveScheduler::Start();
   974             TEST2(active->iStatus.Int(), KErrNone);
   964             TEST2(active->iStatus.Int(), KErrNone);
   975             finished = ETrue;
   965             finished = ETrue;
   976             continue;
   966             continue;
   977             }
   967             }
   978 		
   968 		
   979 		TheTest.Printf(_L("%d  \r"), failCount);
   969 		__FILE_FAILNEXT(++failCount);
   980 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
       
   981 
   970 
   982 		aClient.ChangeConfig(config, active->iStatus);
   971 		aClient.ChangeConfig(config, active->iStatus);
   983 
   972 
   984 		active->StartL();
   973 		active->StartL();
   985 		CActiveScheduler::Start();
   974 		CActiveScheduler::Start();
   989 		else
   978 		else
   990 			error = active->iStatus.Int();
   979 			error = active->iStatus.Int();
   991 		
   980 		
   992 		__FILE_RESET;
   981 		__FILE_RESET;
   993 
   982 
   994 		if (error == KErrNoMemory)
   983 		if (error == KErrGeneral)
   995 			{
   984 			{
   996 			active->StartL();
   985 			active->StartL();
   997 			aClient.GetConfig(config, active->iStatus);
   986 			aClient.GetConfig(config, active->iStatus);
   998 			CActiveScheduler::Start();
   987 			CActiveScheduler::Start();
   999 			TEST2(active->iStatus.Int(), KErrNone);
   988 			TEST2(active->iStatus.Int(), KErrNone);
  1009 	TEST(config.iMaxLogSize == KTestMaxLogSize);
   998 	TEST(config.iMaxLogSize == KTestMaxLogSize);
  1010 	TEST(config.iMaxRecentLogSize == KTestMaxRecentLogSize);
   999 	TEST(config.iMaxRecentLogSize == KTestMaxRecentLogSize);
  1011 	TEST(config.iMaxEventAge == KTestMaxEventAge);
  1000 	TEST(config.iMaxEventAge == KTestMaxEventAge);
  1012 
  1001 
  1013 	CleanupStack::PopAndDestroy(); // active
  1002 	CleanupStack::PopAndDestroy(); // active
  1014 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
  1003 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
  1015 	}
  1004 	}
  1016 
  1005 
  1017 /**
  1006 /**
  1018 @SYMTestCaseID          SYSLIB-LOGENG-CT-0922
  1007 @SYMTestCaseID          SYSLIB-LOGENG-CT-0922
  1019 @SYMTestCaseDesc	    Getting a standard string from the specified resource file test
  1008 @SYMTestCaseDesc	    Getting a standard string from the specified resource file test
  1033 	TBool finished = EFalse;
  1022 	TBool finished = EFalse;
  1034 	TInt error;
  1023 	TInt error;
  1035 
  1024 
  1036 	while(!finished)
  1025 	while(!finished)
  1037 		{
  1026 		{
  1038 		TheTest.Printf(_L("%d  \r"), failCount);
  1027 		__FILE_FAILNEXT(++failCount);
  1039 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
       
  1040 
  1028 
  1041 		error = aClient.GetString(str, R_LOG_DIR_IN);
  1029 		error = aClient.GetString(str, R_LOG_DIR_IN);
  1042 
  1030 
  1043 		__FILE_RESET;
  1031 		__FILE_RESET;
  1044 
  1032 
  1047 			finished = ETrue;
  1035 			finished = ETrue;
  1048 			TEST(str.Length() > 0);
  1036 			TEST(str.Length() > 0);
  1049 			}
  1037 			}
  1050 		else
  1038 		else
  1051 			{
  1039 			{
  1052 			TEST2(error, KErrNoMemory);
  1040 			TEST2(error, KErrGeneral);
  1053 			TEST(str.Length() == 0);
  1041 			TEST(str.Length() == 0);
  1054 			}
  1042 			}
  1055 		}
  1043 		}
  1056 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
  1044 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
  1057 	}
  1045 	}
  1058 
  1046 
  1059 /**
  1047 /**
  1060 @SYMTestCaseID          SYSLIB-LOGENG-CT-0923
  1048 @SYMTestCaseID          SYSLIB-LOGENG-CT-0923
  1061 @SYMTestCaseDesc	    Clearing the Log Event test.
  1049 @SYMTestCaseDesc	    Clearing the Log Event test.
  1154 	TInt failCount = 0;
  1142 	TInt failCount = 0;
  1155 	TBool finished = EFalse;
  1143 	TBool finished = EFalse;
  1156 
  1144 
  1157 	while(!finished)
  1145 	while(!finished)
  1158 		{
  1146 		{
  1159 		TheTest.Printf(_L("%d  \r"), failCount);
  1147 		__FILE_FAILNEXT(++failCount);
  1160 		__FILE_FAILNEXT(KErrNoMemory, failCount++);
       
  1161 
  1148 
  1162 #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
  1149 #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
  1163 		if(aUseSimId)
  1150 		if(aUseSimId)
  1164 			{
  1151 			{
  1165 			aClient.ClearLog(date1, KLogNullSimId, active->iStatus);
  1152 			aClient.ClearLog(date1, KLogNullSimId, active->iStatus);
  1176 		CActiveScheduler::Start();
  1163 		CActiveScheduler::Start();
  1177 
  1164 
  1178 		if (active->iStatus == KErrNone)
  1165 		if (active->iStatus == KErrNone)
  1179 			finished = ETrue;
  1166 			finished = ETrue;
  1180 		else
  1167 		else
  1181 			TEST2(active->iStatus.Int(), KErrNoMemory);
  1168 			TEST2(active->iStatus.Int(), KErrGeneral);
  1182 		}
  1169 		}
  1183 
  1170 
  1184 	active->StartL();
  1171 	active->StartL();
  1185 	aClient.GetEvent(*event1, active->iStatus);
  1172 	aClient.GetEvent(*event1, active->iStatus);
  1186 	CActiveScheduler::Start();
  1173 	CActiveScheduler::Start();
  1217 	aClient.GetEvent(*event2, active->iStatus);
  1204 	aClient.GetEvent(*event2, active->iStatus);
  1218 	CActiveScheduler::Start();
  1205 	CActiveScheduler::Start();
  1219 	TEST2(active->iStatus.Int(), KErrNotFound);
  1206 	TEST2(active->iStatus.Int(), KErrNotFound);
  1220 
  1207 
  1221 	CleanupStack::PopAndDestroy(5); // event4, event3, event2, event1, active
  1208 	CleanupStack::PopAndDestroy(5); // event4, event3, event2, event1, active
  1222 	TheTest.Printf(_L("\r\nThe test has succeeded at iteration %d\n"), failCount);
  1209 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
  1223 	}
  1210 	}
  1224 
  1211 
  1225 void doTestsL()
  1212 void doTestsL()
  1226 	{
  1213 	{
  1227 	TestUtils::Initialize(_L("t_logfile"));
  1214 	TestUtils::Initialize(_L("t_logfile"));
  1228 
  1215 
  1229     TheTest.Start(_L("Construction + create db"));
  1216     TheTest.Start(_L("Construction + create db"));
  1230 	TestUtils::DeleteDatabaseL();
  1217 	TestUtils::DeleteDatabaseL();
  1231 	TestConstructionL(); // Creates database
  1218 	TestConstructionL(); // Creates database
  1232 	TheTest.Next(_L("Construction + open db"));
  1219     TheTest.Next(_L("Construction + open db"));
  1233 	TestConstructionL(); // Opens existing database
  1220 	TestConstructionL(); // Opens existing database
  1234 	TestUtils::DeleteDatabaseL();
  1221 	TestUtils::DeleteDatabaseL();
  1235 	theLog.Write(_L8("Test 1 OK\n"));
  1222 	theLog.Write(_L8("Test 1 OK\n"));
  1236 
  1223 
  1237 	CLogClient* client = CLogClient::NewL(theFs);
  1224 	CLogClient* client = CLogClient::NewL(theFs);