/** @SYMTestCaseID SYSLIB-LOGENG-CT-0879 @SYMTestCaseDesc Tests for maximum number of events that a recent event list holds @SYMTestPriority High @SYMTestActions Set the event configuration data of recent log size(10) to maximum and Add events to the log.Set the filter on the view and check for NO error. Reduce the recent log size(5) and set the new configuration. Clear all the events and test for no errors and the total count of events and the logviewrecent should be zero. Tests for CLogViewRecent::SetRecentListL @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ LOCAL_C void TestMaxRecentSizeConfigL(CLogClient& aClient) { TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0879 ")); CLogEvent* event = CLogEvent::NewL(); CleanupStack::PushL(event); // Incoming TBuf<KLogMaxDirectionLength> buf; aClient.GetString(buf, R_LOG_DIR_IN); event->SetEventType(KLogCallEventTypeUid); event->SetDirection(buf); CTestActive* active = new(ELeave)CTestActive(); CleanupStack::PushL(active); CLogViewRecent* recent = CLogViewRecent::NewL(aClient); CleanupStack::PushL(recent); TLogConfig config; // Get log configuration active->StartL(); aClient.GetConfig(config, active->iStatus); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), KErrNone); // Set the maximum log size config.iMaxLogSize = KTestRecentNum * 2; config.iMaxRecentLogSize = KTestRecentNum; // Change the log engine config active->StartL(); aClient.ChangeConfig(config, active->iStatus); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), KErrNone); // Initialise the views - There should be no events TEST(!recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus)); // Add a number of events TInt count; for(count = 0; count < KTestRecentNum; count++) { event->SetContact(count); active->StartL(); aClient.AddEvent(*event, active->iStatus); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), KErrNone); } TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus)); active->StartL(); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), KErrNone); TEST(recent->CountL() == KTestRecentNum); // Reduce the maximum allowed recent list size // The oldest ones should be removed config.iMaxRecentLogSize = KTestRecentNum / 2; active->StartL(); aClient.ChangeConfig(config, active->iStatus); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), KErrNone); TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus)); active->StartL(); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), KErrNone); TEST(recent->CountL() == KTestRecentNum / 2); User::After(0x1000000); TTime now; now.UniversalTime(); now+=(TTimeIntervalDays )1; // Clear all the events active->StartL(); aClient.ClearLog(now, active->iStatus); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), KErrNone); TEST(!recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus)); TEST(recent->CountL() == 0); CleanupStack::PopAndDestroy(3); // recent, active, event }
/** @SYMTestCaseID SYSLIB-LOGENG-CT-0880 @SYMTestCaseDesc Tests for CLogViewRecent::SetRecentListL(),CLogViewRecent::DuplicatesL() functions @SYMTestPriority High @SYMTestActions Set the event configuration data of recent log size(10) to maximum and Add events to the log.Set the filter on the view and check for NO error. Reduce the recent log size(5) and set the new configuration. Clear all the events and test for no errors and the total count of events and the logviewrecent should be zero. Tests for CLogViewRecent::SetRecentListL() @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ LOCAL_C void TestMaxRecentSize2L(CLogClient& aClient) { TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0880 ")); CLogEvent* event = CLogEvent::NewL(); CleanupStack::PushL(event); // Incoming TBuf<KLogMaxDirectionLength> buf; aClient.GetString(buf, R_LOG_DIR_IN); event->SetEventType(KLogCallEventTypeUid); event->SetDirection(buf); CTestActive* active = new(ELeave)CTestActive(); CleanupStack::PushL(active); CLogViewRecent* recent = CLogViewRecent::NewL(aClient); CleanupStack::PushL(recent); CLogViewDuplicate* dup = CLogViewDuplicate::NewL(aClient); CleanupStack::PushL(dup); CLogFilter* filter = CLogFilter::NewL(); CleanupStack::PushL(filter); TLogConfig config; // Get log configuration active->StartL(); aClient.GetConfig(config, active->iStatus); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), KErrNone); // Set the maximum log size config.iMaxLogSize = (KTestRecentNum * KTestDuplicateNum) * 2; config.iMaxRecentLogSize = KTestRecentNum; // Change the log engine config active->StartL(); aClient.ChangeConfig(config, active->iStatus); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), KErrNone); // Initialise the view - There should be no events TEST(!recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus)); // Add a number of events TInt count; for(count = 0; count < KTestRecentNum; count++) { TBuf<KLogMaxRemotePartyLength> buf; buf.Format(KTestRemoteParty, count); event->SetRemoteParty(buf); active->StartL(); aClient.AddEvent(*event, active->iStatus); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), KErrNone); // Add some duplicates TInt duplicate; for(duplicate = 0; duplicate < KTestDuplicateNum; duplicate++) { active->StartL(); aClient.AddEvent(*event, active->iStatus); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), KErrNone); } // The views should now have the correct number of events TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus)); active->StartL(); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), KErrNone); TEST(recent->CountL() == count + 1); TEST(recent->DuplicatesL(*dup, active->iStatus)); active->StartL(); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), KErrNone); TEST(dup->CountL() == KTestDuplicateNum); } event->SetRemoteParty(KNullDesC); // Add the more events - the old ones should be removed for(count = 0; count < KTestRecentNum; count++) { // Add another event - the oldest should be removed from recent list active->StartL(); aClient.AddEvent(*event, active->iStatus); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), KErrNone); TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus)); active->StartL(); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), KErrNone); // Check an event has been removed from recent view TEST(recent->CountL() == KTestRecentNum); } User::After(0x1000000); TTime now; now.UniversalTime(); now+=(TTimeIntervalDays )1; // Clear all the events active->StartL(); aClient.ClearLog(now, active->iStatus); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), KErrNone); TEST(!recent->DuplicatesL(*dup, active->iStatus)); CleanupStack::PopAndDestroy(5); // filter, dup, recent, active, event }
//See TestUtils::AddViewTestEventsL(). Adds events to the LogEng database. static void AddTestEventsL() { TheTestScheduler = new (ELeave) CActiveScheduler; CleanupStack::PushL(TheTestScheduler); CActiveScheduler::Install(TheTestScheduler); CTestActive* active = new(ELeave)CTestActive; CleanupStack::PushL(active); CLogClient* client = CLogClient::NewL(theFs); CleanupStack::PushL(client); TLogString direction; client->GetString(direction, R_LOG_DIR_IN); // Create a test event type CLogEventType* type = CLogEventType::NewL(); CleanupStack::PushL(type); type->SetUid(KTestEventUid); type->SetDescription(KTestEventDesc); type->SetLoggingEnabled(ETrue); // Register the event type active->StartL(); client->AddEventType(*type, active->iStatus); CActiveScheduler::Start(); LEAVE_IF_ERROR(active->iStatus.Int()); // Now add some events... // CLogEvent* event = CLogEvent::NewL(); CleanupStack::PushL(event); // event->SetEventType(KLogCallEventTypeUid); event->SetContact(KTestContact1); event->SetDirection(direction); event->SetDurationType(KLogDurationValid); event->SetNumber(KTestNumber1); event->SetRemoteParty(KTestRemote1); event->SetStatus(KTestStatus1); // Add event active->StartL(); client->AddEvent(*event, active->iStatus); CActiveScheduler::Start(); LEAVE_IF_ERROR(active->iStatus.Int()); // event->SetEventType(KTestEventUid); // low cap visible event->SetContact(KTestContact1); event->SetDirection(direction); event->SetDurationType(KLogDurationNone); event->SetNumber(KTestNumber1); event->SetRemoteParty(KTestRemote1); event->SetStatus(KTestStatus1); // Add event active->StartL(); client->AddEvent(*event, active->iStatus); CActiveScheduler::Start(); LEAVE_IF_ERROR(active->iStatus.Int()); // event->SetEventType(KLogCallEventTypeUid); event->SetContact(KTestContact2); event->SetDirection(direction); event->SetDurationType(KLogDurationValid); event->SetNumber(KTestNumber1); event->SetRemoteParty(KTestRemote2); event->SetStatus(KTestStatus2); // Add event and 4 duplicates for(TInt i=0; i<5; i++) { active->StartL(); client->AddEvent(*event, active->iStatus); CActiveScheduler::Start(); LEAVE_IF_ERROR(active->iStatus.Int()); } event->SetEventType(KTestEventUid); // low cap visible event->SetContact(KTestContact2); event->SetDirection(KTestDirection1); event->SetDurationType(KLogDurationData); event->SetNumber(KTestNumber1); event->SetRemoteParty(KTestRemote3); event->SetStatus(KTestStatusT3); // Add event active->StartL(); client->AddEvent(*event, active->iStatus); CActiveScheduler::Start(); LEAVE_IF_ERROR(active->iStatus.Int()); CleanupStack::PopAndDestroy(5); // event, client, type, active, scheduler TheTestScheduler = NULL; }
EXPORT_C void CEventLogger::LogDataAddEvent(TInt aRConnectionStatusId, const TDesC& aRemote, TInt aLogDir, const TDesC& aTelNum, TUid aDataEventType) { LOGSTRING2("GenConn:\tCEventLogger LogDataAddEvent aRConnectionStatusId:%d", aRConnectionStatusId); //It is possible to add a new logevent with a new log id for the same connection (reconnect case) // assuming that all the next updates will be for the new event and not the old one. // [NeilMa 140403]: This method cannot leave and has no return value, but // performs memory allocations if the event cannot be logged immediately. // Therefore, if the memory alloc fails for any reason, the event is // currently discarded with no record. This method should be replaced by // one which can Leave or returns an error code. See Typhoon DEF022946. TTime time; time.UniversalTime(); if (!IsActive() && (iLogEventQueue->Count() ==0)) { iCurrentLogEvent->SetId(KGenconnLogWaitingForLogId); iCurrentLogEvent->SetTime(time); TBuf<KLogMaxStatusLength > logStatusBuf; iLogWrap->Log().GetString(logStatusBuf, aRConnectionStatusId); // Ignore error - string blank on error which is ok iCurrentLogEvent->SetStatus(logStatusBuf); iCurrentLogEvent->SetRemoteParty(aRemote); TBuf<KLogMaxDirectionLength> logDirBuf; iLogWrap->Log().GetString(logDirBuf, aLogDir); // Ignore error - string blank on error which is ok iCurrentLogEvent->SetDirection(logDirBuf); iCurrentLogEvent->SetNumber(aTelNum); iCurrentLogEvent->SetEventType(aDataEventType); iCurrentLogEvent->SetDurationType(KLogDurationValid); iStatus=KRequestPending; iLogWrap->Log().AddEvent(*iCurrentLogEvent, iStatus); SetActive(); } else { // add the request to the queue, it will be processed asap CLogEvent* eventUpdate = 0; TRAPD(error, eventUpdate = CLogEvent::NewL()); if (KErrNone != error) { return; // event is discarded! } eventUpdate->SetId(KGenconnLogWaitingForLogId); eventUpdate->SetTime(time); TBuf<KLogMaxStatusLength > logStatusBuf; iLogWrap->Log().GetString(logStatusBuf, aRConnectionStatusId); // Ignore error - string blank on error which is ok eventUpdate->SetStatus(logStatusBuf); eventUpdate->SetRemoteParty(aRemote); TBuf<KLogMaxDirectionLength> logDirBuf; iLogWrap->Log().GetString(logDirBuf, aLogDir); // Ignore error - string blank on error which is ok eventUpdate->SetDirection(logDirBuf); eventUpdate->SetNumber(aTelNum); eventUpdate->SetEventType(aDataEventType); eventUpdate->SetDurationType(KLogDurationValid); // add to the queue TRAP(error, iLogEventQueue->AppendL(eventUpdate)); if (KErrNone != error) { delete eventUpdate; // event is discarded! return; } } }
/** @SYMTestCaseID SYSLIB-LOGENG-CT-1009 @SYMTestCaseDesc Tests for CLogEvent::NewL(),SetDataL() functions @SYMTestPriority High @SYMTestActions Tests for creation of log event on heap and test for setting event specific data from the specified stream and try to read the data back. Check for memory errors @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ LOCAL_C void TestEventWithHeapFailL() { TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1009 ")); #ifdef _DEBUG TInt failCount = 0; #endif TInt error; TBool finished = EFalse; CLogEvent* event = NULL; while(!finished) { __UHEAP_FAILNEXT(failCount++); TRAP(error, event = CLogEvent::NewL()); __UHEAP_RESET; if (error == KErrNone) { finished = ETrue; CleanupStack::PushL(event); } else TEST2(error, KErrNoMemory); } _LIT8(KDataTest1, "01234567890123456789"); _LIT8(KDataTest2, "012345678901234567890123456789"); finished = EFalse; #ifdef _DEBUG failCount = 0; #endif event->SetDataL(KNullDesC8); while(!finished) { __UHEAP_FAILNEXT(failCount++); TRAP(error, event->SetDataL(KDataTest1)); __UHEAP_RESET; if (error == KErrNone) { finished = ETrue; TEST(event->Data() == KDataTest1); } else { TEST2(error, KErrNoMemory); TEST(event->Data() == KNullDesC8); } } finished = EFalse; #ifdef _DEBUG failCount = 0; #endif event->SetDataL(KNullDesC8); while(!finished) { __UHEAP_FAILNEXT(failCount++); TRAP(error, event->SetDataL(KDataTest2)); __UHEAP_RESET; if (error == KErrNone) { finished = ETrue; TEST(event->Data() == KDataTest2); } else { TEST2(error, KErrNoMemory); TEST(event->Data() == KNullDesC8); } } finished = EFalse; #ifdef _DEBUG failCount = 0; #endif event->SetDataL(KNullDesC8); // Check we don't get any more failures __UHEAP_FAILNEXT(0); event->SetDataL(KDataTest2); TEST(event->Data() == KDataTest2); event->SetDataL(KDataTest1); TEST(event->Data() == KDataTest1); event->SetDataL(KNullDesC8); TEST(event->Data() == KNullDesC8); __UHEAP_RESET; // streaming TFileName storename = _L("c:\\T_BASIC_DATA"); TUid uid={0x12345678}; // create a store theFs.Delete(storename); CDictionaryFileStore* store = CDictionaryFileStore::OpenLC(theFs, storename, uid); RDictionaryWriteStream write; RDictionaryReadStream read; uid.iUid++; write.AssignL(*store, uid); write << KNullDesC8; write.CommitL(); write.Close(); read.OpenL(*store, uid); #ifdef _DEBUG failCount = 0; #endif finished = EFalse; __UHEAP_FAILNEXT(0); event->SetDataL(read, 0); __UHEAP_RESET; read.Close(); TEST(event->Data() == KNullDesC8); HBufC8* buf8 = TestUtils::CreateBuf8LC(100); uid.iUid++; write.AssignL(*store, uid); write.WriteL(buf8->Des()); write.CommitL(); write.Close(); read.OpenL(*store, uid); while(!finished) { __UHEAP_FAILNEXT(failCount++); TRAP(error, event->SetDataL(read, 100)); __UHEAP_RESET; if (error == KErrNone) { TEST(event->Data() == buf8->Des()); read.Close(); finished = ETrue; } else { TEST2(error, KErrNoMemory); TEST(event->Data() == KNullDesC8); } } event->SetId(0x12345678); event->SetEventType(TUid::Uid(0x12345678)); HBufC* buf = TestUtils::CreateBufLC(KLogMaxRemotePartyLength / 2); event->SetRemoteParty(buf->Des()); CleanupStack::PopAndDestroy(); // buf buf = TestUtils::CreateBufLC(KLogMaxDirectionLength / 2); event->SetDirection(buf->Des()); CleanupStack::PopAndDestroy(); // buf TTime time; time.UniversalTime(); event->SetTime(time); TEST(event->Time() == time); event->SetDurationType(0xf); event->SetDuration(0x12345678); buf = TestUtils::CreateBufLC(KLogMaxStatusLength / 2); event->SetStatus(buf->Des()); CleanupStack::PopAndDestroy(); // buf buf = TestUtils::CreateBufLC(KLogMaxSubjectLength / 2); event->SetSubject(buf->Des()); CleanupStack::PopAndDestroy(); // buf buf = TestUtils::CreateBufLC(KLogMaxNumberLength / 2); event->SetNumber(buf->Des()); CleanupStack::PopAndDestroy(); // buf event->SetContact(0x12345678); event->SetLink(0x12345678); buf = TestUtils::CreateBufLC(KLogMaxDescriptionLength / 2); event->SetDescription(buf->Des()); CleanupStack::PopAndDestroy(); // buf event->SetFlags(0xA); buf8 = TestUtils::CreateBuf8LC(100); event->SetDataL(buf8->Des()); TEST(event->Data() == buf8->Des()); CleanupStack::PopAndDestroy(); // buf8 CLogEvent* event1 = CLogEvent::NewL(); CleanupStack::PushL(event1); CLogEvent* event2 = CLogEvent::NewL(); CleanupStack::PushL(event2); TEST(TestUtils::EventsEqual(*event1, *event2)); finished = EFalse; #ifdef _DEBUG failCount = 0; #endif while(!finished) { __UHEAP_FAILNEXT(failCount++); TRAP(error, event1->CopyL(*event)); __UHEAP_RESET; if (error == KErrNone) { TEST(!TestUtils::EventsEqual(*event1, *event2)); TEST(TestUtils::EventsEqual(*event1, *event)); finished = ETrue; } else { TEST2(error, KErrNoMemory); TEST(TestUtils::EventsEqual(*event1, *event2)); TEST(!TestUtils::EventsEqual(*event1, *event)); } } CleanupStack::PopAndDestroy(5); // buf8, store, event, event1, event2 ::DeleteDataFile(storename); }
/** @SYMTestCaseID SYSLIB-LOGENG-CT-0119 @SYMTestCaseDesc Tests AddEvent, GetEvent, ChangeEvent and DeleteEvent. @SYMTestPriority High @SYMTestActions See the description and expected results. @SYMTestExpectedResults 1. a client with sufficient capability succeed in all cases would expect the following... AddEvent - KErrNone GetEvent - KErrNone ChangeEvent - KErrNone DeleteEvent - KErrNone 2. a client with insufficient capability would expect the following results... AddEvent - KErrPermissionDenied GetEvent - KErrNone ChangeEvent - KErrPermissionDenied DeleteEvent - KErrPermissionDenied @SYMREQ REQ3431 */ LOCAL_C void TestBasicL(CLogClient& aClient) { TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0119 ")); CTestActive* active = new(ELeave)CTestActive(); CleanupStack::PushL(active); CLogEvent* event = CLogEvent::NewL(); CleanupStack::PushL(event); TTime now; now.UniversalTime(); event->SetEventType(KLogCallEventTypeUid); active->StartL(); aClient.AddEvent(*event, active->iStatus); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), TheHiCapability ? KErrNone : KErrPermissionDenied); if(!TheHiCapability) { TInt eventId = TestUtils::AddEventL(); TEST(eventId >= 0); event->SetId(eventId); } TEST(event->EventType() == KLogCallEventTypeUid); now = event->Time(); TLogId id = event->Id(); event->SetRemoteParty(KTestRemoteParty1); event->SetDirection(KTestDirection1); event->SetDurationType(KTestDurationType1); event->SetDuration(KTestDuration1); event->SetStatus(KTestStatus1); event->SetSubject(KTestSubject1); event->SetNumber(KTestNumber1); event->SetContact(KTestContact1); event->SetLink(KTestLink1); event->SetDataL(KTestData1); active->StartL(); aClient.ChangeEvent(*event, active->iStatus); CActiveScheduler::Start(); TheTest.Printf(_L("TestBasicL(), TheHiCapability=%d, event id=%d\r\n"), TheHiCapability, id); TEST2(active->iStatus.Int(), TheHiCapability ? KErrNone : KErrPermissionDenied); TEST(event->Id() == id ); TEST(event->EventType() == KLogCallEventTypeUid); if(TheHiCapability) { TEST(event->Description().Length() > 0); TEST(event->Time() == now); TEST(event->RemoteParty() == KTestRemoteParty1); TEST(event->Direction() == KTestDirection1); TEST(event->DurationType() == KTestDurationType1); TEST(event->Duration() == KTestDuration1); TEST(event->Status() == KTestStatus1); TEST(event->Subject() == KTestSubject1); TEST(event->Number() == KTestNumber1); TEST(event->Contact() == KTestContact1); TEST(event->Link() == KTestLink1); TEST(event->Data() == KTestData1); } CleanupStack::PopAndDestroy(); // event; event = CLogEvent::NewL(); CleanupStack::PushL(event); event->SetId(id); active->StartL(); aClient.GetEvent(*event, active->iStatus); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), TheHiCapability ? KErrNone : KErrPermissionDenied); if(TheHiCapability) { TEST(event->Id() == id); TEST(event->EventType() == KLogCallEventTypeUid); TEST(event->Description().Length() > 0); TEST(event->Time() == now); TEST(event->RemoteParty() == KTestRemoteParty1); TEST(event->Direction() == KTestDirection1); TEST(event->DurationType() == KTestDurationType1); TEST(event->Duration() == KTestDuration1); TEST(event->Status() == KTestStatus1); TEST(event->Subject() == KTestSubject1); TEST(event->Number() == KTestNumber1); TEST(event->Contact() == KTestContact1); TEST(event->Link() == KTestLink1); TEST(event->Data() == KTestData1); } active->StartL(); aClient.DeleteEvent(id, active->iStatus); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), TheHiCapability ? KErrNone : KErrPermissionDenied); active->StartL(); aClient.GetEvent(*event, active->iStatus); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), TheHiCapability ? KErrNotFound : KErrPermissionDenied); // try to delete a non-existent event... active->StartL(); aClient.DeleteEvent(123, active->iStatus); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), KErrNotFound); CleanupStack::PopAndDestroy(2); // event, active }
/** @SYMTestCaseID SYSLIB-LOGENG-CT-1022 @SYMTestCaseDesc Tests for operations on log database @SYMTestPriority High @SYMTestActions Check by add new event,change the event,and get event and check for integrity of data @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ LOCAL_C void TestEventViewL(CLogClient& aClient) { TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1022 ")); CTestActive* active = new(ELeave)CTestActive(); CleanupStack::PushL(active); CLogViewChangeObserver* changeObs = CLogViewChangeObserver::NewLC(); changeObs->SetActive(); CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs); CleanupStack::PushL(view); CLogEvent* event; TLogId id; TTime now; now.UniversalTime(); TInt count; for(count = 0; count < KTestEventNum; count++) { event = CLogEvent::NewL(); CleanupStack::PushL(event); event->SetEventType(KLogCallEventTypeUid); //User::After(Math::Random() % 100000); User::After(1000000); active->StartL(); aClient.AddEvent(*event, active->iStatus); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), KErrNone); TEST(event->EventType() == KLogCallEventTypeUid); TEST(event->Description().Length() > 0); TEST(event->Time() >= now); now = event->Time(); id = event->Id(); event->SetRemoteParty(KTestRemoteParty1); event->SetDirection(KTestDirection1); event->SetDurationType(KTestDurationType1); event->SetDuration(KTestDuration1); event->SetStatus(KTestStatus1); event->SetSubject(KTestSubject1); event->SetNumber(KTestNumber1); event->SetLink(KTestLink1); event->SetDataL(KTestData1); event->SetFlags(KTestFlags1); event->SetContact((TLogContactItemId) count+1); User::After(Math::Random() % 100000); active->StartL(); aClient.ChangeEvent(*event, active->iStatus); CActiveScheduler::Start(); //If the test fails on the next line with -1 or -12 error, it is possible that the contacts database is missing: //c:\private\10003a73\SQLite__Contacts.cdb. Copy it to the specified location and rerun the test. TEST2(active->iStatus.Int(), KErrNone); TEST(event->EventType() == KLogCallEventTypeUid); TEST(event->RemoteParty() == KTestRemoteParty1); TEST(event->Direction() == KTestDirection1); TEST(event->DurationType() == KTestDurationType1); TEST(event->Duration() == KTestDuration1); TEST(event->Status() == KTestStatus1); TEST(event->Subject() == KTestSubject1); TEST(event->Number() == KTestNumber1); TEST(event->Link() == KTestLink1); TEST(event->Data() == KTestData1); TLogFlags eventFlags; if(TheMatchingIsEnabled) { eventFlags=KTestFlags1|KLogEventContactSearched; } else { eventFlags=KTestFlags1; } //If the test fails on the next line, it is quite possible that there is a //z:\private\10202be9a\101f401d.txt file that sets the contacts match count to 0. //Delete the file and run the test again. TEST(event->Flags() == eventFlags); TEST(event->Contact()==(TLogContactItemId) count+1); CleanupStack::PopAndDestroy(); // event; event = CLogEvent::NewL(); CleanupStack::PushL(event); event->SetId(id); active->StartL(); aClient.GetEvent(*event, active->iStatus); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), KErrNone); TEST(event->EventType() == KLogCallEventTypeUid); TEST(event->RemoteParty() == KTestRemoteParty1); TEST(event->Direction() == KTestDirection1); TEST(event->DurationType() == KTestDurationType1); TEST(event->Duration() == KTestDuration1); TEST(event->Status() == KTestStatus1); TEST(event->Subject() == KTestSubject1); TEST(event->Number() == KTestNumber1); TEST(event->Link() == KTestLink1); TEST(event->Data() == KTestData1); TEST(event->Flags() == eventFlags); TEST(event->Contact()==(TLogContactItemId) count+1); CleanupStack::PopAndDestroy(); // event; } CleanupStack::PopAndDestroy(3, active); // Delete view, changeObs, active }