os/persistentdata/loggingservices/eventlogger/test/src/t_logview2.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #include <s32file.h>
    17 #include <logeng.h>
    18 #include <tz.h>
    19 #include "t_logutil2.h"
    20 #include <logview.h>
    21 
    22 RTest TheTest(_L("t_logview2"));
    23 
    24 const TInt KTestEventNum = 20;
    25 const TInt KTestErrorEventNum = 3;
    26 const TLogContactItemId KTestContact1 = 0x123;
    27 const TLogContactItemId KTestContact2 = 0x456;
    28 const TLogContactItemId KTestContact3 = 0x789;
    29 _LIT(KTestDirection1, "Direction Test 1");
    30 _LIT(KTestDirection2, "Direction Test 2");
    31 _LIT(KTestDirection3, "Direction Test 3");
    32 _LIT(KTestNumber1, "Number Test 1");
    33 _LIT(KTestNumber2, "Number Test 2");
    34 _LIT(KTestNumber3, "Number Test 3");
    35 _LIT(KTestRemote1, "Remote Test 1");
    36 _LIT(KTestRemote2, "Remote Test 2");
    37 _LIT(KTestRemote3, "Remote Test 3");
    38 _LIT(KTestStatus1, "Status Test 1");
    39 _LIT(KTestStatus2, "Status Test 2");
    40 _LIT(KTestStatus3, "Status Test 3");
    41 _LIT(KTestSubject, "Test Subject");
    42 const TLogLink KTestLink = 0x123456;
    43 _LIT8(KTestData, "Test data");
    44 
    45 /**
    46 @SYMTestCaseID          SYSLIB-LOGENG-CT-0930
    47 @SYMTestCaseDesc	    Tests for the functionality of CLogViewEvent,CLogFilter classes
    48 @SYMTestPriority 	    High
    49 @SYMTestActions  	    Tests for event view after setting filter on the views.
    50                         Change the filter list configuration and test for the view
    51 @SYMTestExpectedResults Test must not fail
    52 @SYMREQ                 REQ0000
    53 */
    54 LOCAL_C void TestEventViewWithFilterListL(CLogClient& aClient)
    55 	{
    56 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0930 "));
    57 	CTestActive* active = new(ELeave)CTestActive;
    58 	CleanupStack::PushL(active);
    59 
    60 	CLogEvent* event = CLogEvent::NewL();
    61 	CleanupStack::PushL(event);
    62 
    63 	event->SetEventType(KLogCallEventTypeUid);
    64 	event->SetContact(KTestContact1);
    65 	event->SetDirection(KTestDirection1);
    66 	event->SetDurationType(KLogDurationNone);
    67 	event->SetNumber(KTestNumber1);
    68 	event->SetRemoteParty(KTestRemote1);
    69 	event->SetStatus(KTestStatus1);
    70 
    71 	// Add event
    72 	active->StartL();
    73 	aClient.AddEvent(*event, active->iStatus);
    74 	CActiveScheduler::Start();
    75 	TEST2(active->iStatus.Int(), KErrNone);
    76 
    77 	event->SetEventType(KLogDataEventTypeUid);
    78 	event->SetContact(KTestContact2);
    79 	event->SetDirection(KTestDirection2);
    80 	event->SetDurationType(KLogDurationValid);
    81 	event->SetNumber(KTestNumber2);
    82 	event->SetRemoteParty(KTestRemote2);
    83 	event->SetStatus(KTestStatus2);
    84 
    85 	// Add event
    86 	active->StartL();
    87 	aClient.AddEvent(*event, active->iStatus);
    88 	CActiveScheduler::Start();
    89 	TEST2(active->iStatus.Int(), KErrNone);
    90 
    91 	event->SetEventType(KLogFaxEventTypeUid);
    92 	event->SetContact(KTestContact3);
    93 	event->SetDirection(KTestDirection3);
    94 	event->SetDurationType(KLogDurationData);
    95 	event->SetNumber(KTestNumber3);
    96 	event->SetRemoteParty(KTestRemote3);
    97 	event->SetStatus(KTestStatus3);
    98 
    99 	// Add event
   100 	active->StartL();
   101 	aClient.AddEvent(*event, active->iStatus);
   102 	CActiveScheduler::Start();
   103 	TEST2(active->iStatus.Int(), KErrNone);
   104 
   105 	CLogFilterList* list = new(ELeave)CLogFilterList;
   106 	CleanupStack::PushL(list);
   107 
   108 	CLogViewEvent* view = CLogViewEvent::NewL(aClient);
   109 	CleanupStack::PushL(view);
   110 
   111 	CLogFilter* filter = CLogFilter::NewL();
   112 	CleanupStack::PushL(filter);
   113 	
   114 	// Set filter
   115 	filter->SetContact(KTestContact1);
   116 
   117 	list->AppendL(filter);
   118 	CleanupStack::Pop(); // filter
   119 
   120 	// Test View
   121 	active->StartL();
   122 	TEST(view->SetFilterL(*list, active->iStatus));
   123 	CActiveScheduler::Start();
   124 	TEST2(view->CountL(),1);
   125 
   126 	filter = CLogFilter::NewL();
   127 	CleanupStack::PushL(filter);
   128 	
   129 	// Set filter
   130 	filter->SetContact(KTestContact2);
   131 
   132 	list->AppendL(filter);
   133 	CleanupStack::Pop(); // filter
   134 
   135 	// Test View
   136 	active->StartL();
   137 	TEST(view->SetFilterL(*list, active->iStatus));
   138 	CActiveScheduler::Start();
   139 	TEST2(view->CountL(), 2);
   140 
   141 	filter = CLogFilter::NewL();
   142 	CleanupStack::PushL(filter);
   143 	
   144 	// Set filter
   145 	filter->SetContact(KTestContact3);
   146 
   147 	list->AppendL(filter);
   148 	CleanupStack::Pop(); // filter
   149 
   150 	// Test View
   151 	active->StartL();
   152 	TEST(view->SetFilterL(*list, active->iStatus));
   153 	CActiveScheduler::Start();
   154 	TEST2(view->CountL(), 3);
   155 
   156 	list->ResetAndDestroy();
   157 
   158 	/////////////////////////////////////////
   159 
   160 	filter = CLogFilter::NewL();
   161 	CleanupStack::PushL(filter);
   162 	
   163 	// Set filter
   164 	filter->SetContact(KTestContact1);
   165 	filter->SetDirection(KTestDirection1);
   166 
   167 	list->AppendL(filter);
   168 	CleanupStack::Pop(); // filter
   169 
   170 	// Test View
   171 	active->StartL();
   172 	TEST(view->SetFilterL(*list, active->iStatus));
   173 	CActiveScheduler::Start();
   174 	TEST2(view->CountL(), 1);
   175 
   176 	filter = CLogFilter::NewL();
   177 	CleanupStack::PushL(filter);
   178 	
   179 	// Set filter
   180 	filter->SetContact(KTestContact2);
   181 	filter->SetDirection(KTestDirection2);
   182 
   183 	list->AppendL(filter);
   184 	CleanupStack::Pop(); // filter
   185 
   186 	// Test View
   187 	active->StartL();
   188 	TEST(view->SetFilterL(*list, active->iStatus));
   189 	CActiveScheduler::Start();
   190 	TEST2(view->CountL(), 2);
   191 
   192 	filter = CLogFilter::NewL();
   193 	CleanupStack::PushL(filter);
   194 	
   195 	// Set filter
   196 	filter->SetContact(KTestContact3);
   197 	filter->SetDirection(KTestDirection3);
   198 
   199 	list->AppendL(filter);
   200 	CleanupStack::Pop(); // filter
   201 
   202 	// Test View
   203 	active->StartL();
   204 	TEST(view->SetFilterL(*list, active->iStatus));
   205 	CActiveScheduler::Start();
   206 	TEST2(view->CountL(), 3);
   207 
   208 	list->ResetAndDestroy();
   209 
   210 	/////////////////////////////////////////
   211 
   212 	filter = CLogFilter::NewL();
   213 	CleanupStack::PushL(filter);
   214 	
   215 	// Set filter
   216 	filter->SetContact(KTestContact1);
   217 	filter->SetDirection(KTestDirection1);
   218 	filter->SetDurationType(KLogDurationNone);
   219 
   220 	list->AppendL(filter);
   221 	CleanupStack::Pop(); // filter
   222 
   223 	// Test View
   224 	active->StartL();
   225 	TEST(view->SetFilterL(*list, active->iStatus));
   226 	CActiveScheduler::Start();
   227 	TEST2(view->CountL(), 1);
   228 
   229 	filter = CLogFilter::NewL();
   230 	CleanupStack::PushL(filter);
   231 	
   232 	// Set filter
   233 	filter->SetContact(KTestContact2);
   234 	filter->SetDirection(KTestDirection2);
   235 	filter->SetDurationType(KLogDurationValid);
   236 
   237 	list->AppendL(filter);
   238 	CleanupStack::Pop(); // filter
   239 
   240 	// Test View
   241 	active->StartL();
   242 	TEST(view->SetFilterL(*list, active->iStatus));
   243 	CActiveScheduler::Start();
   244 	TEST2(view->CountL(), 2);
   245 
   246 	filter = CLogFilter::NewL();
   247 	CleanupStack::PushL(filter);
   248 	
   249 	// Set filter
   250 	filter->SetContact(KTestContact3);
   251 	filter->SetDirection(KTestDirection3);
   252 	filter->SetDurationType(KLogDurationData);
   253 
   254 	list->AppendL(filter);
   255 	CleanupStack::Pop(); // filter
   256 
   257 	// Test View
   258 	active->StartL();
   259 	TEST(view->SetFilterL(*list, active->iStatus));
   260 	CActiveScheduler::Start();
   261 	TEST2(view->CountL(), 3);
   262 
   263 	list->ResetAndDestroy();
   264 
   265 	/////////////////////////////////////////
   266 
   267 	filter = CLogFilter::NewL();
   268 	CleanupStack::PushL(filter);
   269 	
   270 	// Set filter
   271 	filter->SetContact(KTestContact1);
   272 	filter->SetDirection(KTestDirection1);
   273 	filter->SetDurationType(KLogDurationNone);
   274 	filter->SetEventType(KLogCallEventTypeUid);
   275 
   276 	list->AppendL(filter);
   277 	CleanupStack::Pop(); // filter
   278 
   279 	// Test View
   280 	active->StartL();
   281 	TEST(view->SetFilterL(*list, active->iStatus));
   282 	CActiveScheduler::Start();
   283 	TEST2(view->CountL(), 1);
   284 
   285 	filter = CLogFilter::NewL();
   286 	CleanupStack::PushL(filter);
   287 	
   288 	// Set filter
   289 	filter->SetContact(KTestContact2);
   290 	filter->SetDirection(KTestDirection2);
   291 	filter->SetDurationType(KLogDurationValid);
   292 	filter->SetEventType(KLogDataEventTypeUid);
   293 
   294 	list->AppendL(filter);
   295 	CleanupStack::Pop(); // filter
   296 
   297 	// Test View
   298 	active->StartL();
   299 	TEST(view->SetFilterL(*list, active->iStatus));
   300 	CActiveScheduler::Start();
   301 	TEST2(view->CountL(), 2);
   302 
   303 	filter = CLogFilter::NewL();
   304 	CleanupStack::PushL(filter);
   305 	
   306 	// Set filter
   307 	filter->SetContact(KTestContact3);
   308 	filter->SetDirection(KTestDirection3);
   309 	filter->SetDurationType(KLogDurationData);
   310 	filter->SetEventType(KLogFaxEventTypeUid);
   311 
   312 	list->AppendL(filter);
   313 	CleanupStack::Pop(); // filter
   314 
   315 	// Test View
   316 	active->StartL();
   317 	TEST(view->SetFilterL(*list, active->iStatus));
   318 	CActiveScheduler::Start();
   319 	TEST2(view->CountL(), 3);
   320 
   321 	list->ResetAndDestroy();
   322 
   323 	/////////////////////////////////////////
   324 
   325 	filter = CLogFilter::NewL();
   326 	CleanupStack::PushL(filter);
   327 	
   328 	// Set filter
   329 	filter->SetContact(KTestContact1);
   330 	filter->SetDirection(KTestDirection1);
   331 	filter->SetDurationType(KLogDurationNone);
   332 	filter->SetEventType(KLogCallEventTypeUid);
   333 	filter->SetNumber(KTestNumber1);
   334 
   335 	list->AppendL(filter);
   336 	CleanupStack::Pop(); // filter
   337 
   338 	// Test View
   339 	active->StartL();
   340 	TEST(view->SetFilterL(*list, active->iStatus));
   341 	CActiveScheduler::Start();
   342 	TEST2(view->CountL(), 1);
   343 
   344 	filter = CLogFilter::NewL();
   345 	CleanupStack::PushL(filter);
   346 	
   347 	// Set filter
   348 	filter->SetContact(KTestContact2);
   349 	filter->SetDirection(KTestDirection2);
   350 	filter->SetDurationType(KLogDurationValid);
   351 	filter->SetEventType(KLogDataEventTypeUid);
   352 	filter->SetNumber(KTestNumber2);
   353 
   354 	list->AppendL(filter);
   355 	CleanupStack::Pop(); // filter
   356 
   357 	// Test View
   358 	active->StartL();
   359 	TEST(view->SetFilterL(*list, active->iStatus));
   360 	CActiveScheduler::Start();
   361 	TEST2(view->CountL(), 2);
   362 
   363 	filter = CLogFilter::NewL();
   364 	CleanupStack::PushL(filter);
   365 	
   366 	// Set filter
   367 	filter->SetContact(KTestContact3);
   368 	filter->SetDirection(KTestDirection3);
   369 	filter->SetDurationType(KLogDurationData);
   370 	filter->SetEventType(KLogFaxEventTypeUid);
   371 	filter->SetNumber(KTestNumber3);
   372 
   373 	list->AppendL(filter);
   374 	CleanupStack::Pop(); // filter
   375 
   376 	// Test View
   377 	active->StartL();
   378 	TEST(view->SetFilterL(*list, active->iStatus));
   379 	CActiveScheduler::Start();
   380 	TEST2(view->CountL(), 3);
   381 
   382 	list->ResetAndDestroy();
   383 
   384 	/////////////////////////////////////////
   385 
   386 	filter = CLogFilter::NewL();
   387 	CleanupStack::PushL(filter);
   388 	
   389 	// Set filter
   390 	filter->SetContact(KTestContact1);
   391 	filter->SetDirection(KTestDirection1);
   392 	filter->SetDurationType(KLogDurationNone);
   393 	filter->SetEventType(KLogCallEventTypeUid);
   394 	filter->SetNumber(KTestNumber1);
   395 	filter->SetRemoteParty(KTestRemote1);
   396 
   397 	list->AppendL(filter);
   398 	CleanupStack::Pop(); // filter
   399 
   400 	// Test View
   401 	active->StartL();
   402 	TEST(view->SetFilterL(*list, active->iStatus));
   403 	CActiveScheduler::Start();
   404 	TEST2(view->CountL(), 1);
   405 
   406 	filter = CLogFilter::NewL();
   407 	CleanupStack::PushL(filter);
   408 	
   409 	// Set filter
   410 	filter->SetContact(KTestContact2);
   411 	filter->SetDirection(KTestDirection2);
   412 	filter->SetDurationType(KLogDurationValid);
   413 	filter->SetEventType(KLogDataEventTypeUid);
   414 	filter->SetNumber(KTestNumber2);
   415 	filter->SetRemoteParty(KTestRemote2);
   416 
   417 	list->AppendL(filter);
   418 	CleanupStack::Pop(); // filter
   419 
   420 	// Test View
   421 	active->StartL();
   422 	TEST(view->SetFilterL(*list, active->iStatus));
   423 	CActiveScheduler::Start();
   424 	TEST2(view->CountL(), 2);
   425 
   426 	filter = CLogFilter::NewL();
   427 	CleanupStack::PushL(filter);
   428 	
   429 	// Set filter
   430 	filter->SetContact(KTestContact3);
   431 	filter->SetDirection(KTestDirection3);
   432 	filter->SetDurationType(KLogDurationData);
   433 	filter->SetEventType(KLogFaxEventTypeUid);
   434 	filter->SetNumber(KTestNumber3);
   435 	filter->SetRemoteParty(KTestRemote3);
   436 
   437 	list->AppendL(filter);
   438 	CleanupStack::Pop(); // filter
   439 
   440 	// Test View
   441 	active->StartL();
   442 	TEST(view->SetFilterL(*list, active->iStatus));
   443 	CActiveScheduler::Start();
   444 	TEST2(view->CountL(), 3);
   445 
   446 	list->ResetAndDestroy();
   447 
   448 	/////////////////////////////////////////
   449 
   450 	filter = CLogFilter::NewL();
   451 	CleanupStack::PushL(filter);
   452 	
   453 	// Set filter
   454 	filter->SetContact(KTestContact1);
   455 	filter->SetDirection(KTestDirection1);
   456 	filter->SetDurationType(KLogDurationNone);
   457 	filter->SetEventType(KLogCallEventTypeUid);
   458 	filter->SetNumber(KTestNumber1);
   459 	filter->SetRemoteParty(KTestRemote1);
   460 	filter->SetStatus(KTestStatus1);
   461 
   462 	list->AppendL(filter);
   463 	CleanupStack::Pop(); // filter
   464 
   465 	// Test View
   466 	active->StartL();
   467 	TEST(view->SetFilterL(*list, active->iStatus));
   468 	CActiveScheduler::Start();
   469 	TEST2(view->CountL(), 1);
   470 
   471 	filter = CLogFilter::NewL();
   472 	CleanupStack::PushL(filter);
   473 	
   474 	// Set filter
   475 	filter->SetContact(KTestContact2);
   476 	filter->SetDirection(KTestDirection2);
   477 	filter->SetDurationType(KLogDurationValid);
   478 	filter->SetEventType(KLogDataEventTypeUid);
   479 	filter->SetNumber(KTestNumber2);
   480 	filter->SetRemoteParty(KTestRemote2);
   481 	filter->SetStatus(KTestStatus2);
   482 
   483 	list->AppendL(filter);
   484 	CleanupStack::Pop(); // filter
   485 
   486 	// Test View
   487 	active->StartL();
   488 	TEST(view->SetFilterL(*list, active->iStatus));
   489 	CActiveScheduler::Start();
   490 	TEST2(view->CountL(), 2);
   491 
   492 	filter = CLogFilter::NewL();
   493 	CleanupStack::PushL(filter);
   494 	
   495 	// Set filter
   496 	filter->SetContact(KTestContact3);
   497 	filter->SetDirection(KTestDirection3);
   498 	filter->SetDurationType(KLogDurationData);
   499 	filter->SetEventType(KLogFaxEventTypeUid);
   500 	filter->SetNumber(KTestNumber3);
   501 	filter->SetRemoteParty(KTestRemote3);
   502 	filter->SetStatus(KTestStatus3);
   503 
   504 	list->AppendL(filter);
   505 	CleanupStack::Pop(); // filter
   506 
   507 	// Test View
   508 	active->StartL();
   509 	TEST(view->SetFilterL(*list, active->iStatus));
   510 	CActiveScheduler::Start();
   511 	TEST2(view->CountL(), 3);
   512 
   513 	list->ResetAndDestroy();
   514 
   515 	CleanupStack::PopAndDestroy(4); // list, view, event, active
   516 	}
   517 
   518 /**
   519 @SYMTestCaseID          SYSLIB-LOGENG-CT-3432
   520 @SYMTestCaseDesc	    Test the functionality of CLogViewEvent::SetFilterL with the CLogFilterList parameter containing multiple filters with start time and end time.
   521 @SYMTestPriority 	    High
   522 @SYMTestActions  	    1. Add 2 events.
   523 						2. Setup a CLogFilterList with two filters targeting the first event. Both filters have start and end time. Call SetFilterL.
   524 						3. Verify view has 1 event and no LogServ panic.
   525 						4. Clear the filter list.
   526 						5. Setup filter for first event with start and end time. Call SetFilterL.
   527 						6. Verify view has one event.
   528                         7. Setup second filter for second event with start and end time. Append this filter to filter list and call SetFilterL.
   529 						8. Verify view has 2 events and no LogServ panic.
   530 @SYMTestExpectedResults Log view has expected number of events and no LogServ panic.
   531 @SYMDEF                 INC102412
   532 */
   533 LOCAL_C void TestEventViewWithTimestampsInFilterListL(CLogClient& aClient)
   534 	{
   535 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-3432 "));
   536 	TTime testStartTime;
   537 	testStartTime.UniversalTime();
   538 	TTime tomorrow = testStartTime + (TTimeIntervalDays)1;
   539 	TTime twoDaysFromNow = tomorrow + (TTimeIntervalDays)1;
   540 
   541 	CTestActive* active = new(ELeave)CTestActive;
   542 	CleanupStack::PushL(active);
   543 
   544 	// Get rid of all the events in the log
   545 	active->StartL();
   546 	aClient.ClearLog(tomorrow, active->iStatus);
   547 	CActiveScheduler::Start();
   548 	TEST2(active->iStatus.Int(), KErrNone);
   549 	
   550 	// Wait a second before adding events to log.
   551 	User::After(1100000);
   552 
   553 	// Add two events to log
   554 	CLogEvent* event = CLogEvent::NewL();
   555 	CleanupStack::PushL(event);
   556 
   557 	// Add event 1
   558 	event->SetEventType(KLogCallEventTypeUid);
   559 	event->SetContact(KTestContact1);
   560 	event->SetDirection(KTestDirection1);
   561 	event->SetDurationType(KLogDurationNone);
   562 	event->SetNumber(KTestNumber1);
   563 	event->SetRemoteParty(KTestRemote1);
   564 	event->SetStatus(KTestStatus1);
   565 
   566 	active->StartL();
   567 	aClient.AddEvent(*event, active->iStatus);
   568 	CActiveScheduler::Start();
   569 	TEST2(active->iStatus.Int(), KErrNone);
   570 
   571 	// Add event 2
   572 	event->SetEventType(KLogDataEventTypeUid);
   573 	event->SetContact(KTestContact2);
   574 	event->SetDirection(KTestDirection2);
   575 	event->SetDurationType(KLogDurationValid);
   576 	event->SetNumber(KTestNumber2);
   577 	event->SetRemoteParty(KTestRemote2);
   578 	event->SetStatus(KTestStatus2);
   579 
   580 	active->StartL();
   581 	aClient.AddEvent(*event, active->iStatus);
   582 	CActiveScheduler::Start();
   583 	TEST2(active->iStatus.Int(), KErrNone);
   584 
   585 	// Setup filter
   586 	CLogFilterList* list = new(ELeave)CLogFilterList;
   587 	CleanupStack::PushL(list);
   588 
   589 	CLogViewEvent* view = CLogViewEvent::NewL(aClient);
   590 	CleanupStack::PushL(view);
   591 
   592 	CLogFilter* filter = CLogFilter::NewL();
   593 	CleanupStack::PushL(filter);
   594 	
   595 	// Set half a filter
   596 	filter->SetContact(KTestContact1);
   597 	filter->SetDirection(KTestDirection1);
   598 	filter->SetDurationType(KLogDurationNone);
   599 	filter->SetStartTime(testStartTime);
   600 	TTime t1 = filter->StartTime();
   601 	TEST(t1 == testStartTime);
   602 	filter->SetEndTime(tomorrow);
   603 	TTime t2 = filter->EndTime();
   604 	TEST(t2 == tomorrow);
   605 
   606 	list->AppendL(filter);
   607 	CleanupStack::Pop(); // filter
   608 
   609 	// set the other half of filter for event 1
   610 	filter = CLogFilter::NewL();
   611 	CleanupStack::PushL(filter);
   612 
   613 	filter->SetEventType(KLogCallEventTypeUid);
   614 	filter->SetNumber(KTestNumber1);
   615 	filter->SetRemoteParty(KTestRemote1);
   616 	filter->SetStatus(KTestStatus1);
   617 
   618 	// start time is duplicate of previous filter, 
   619 	// end time is not duplicate
   620 	filter->SetStartTime(testStartTime);
   621 	filter->SetEndTime(twoDaysFromNow);
   622 
   623 	list->AppendL(filter);
   624 	CleanupStack::Pop(); // filter
   625 
   626 	// Test View
   627 	active->StartL();
   628 	TEST(view->SetFilterL(*list, active->iStatus));
   629 	CActiveScheduler::Start();
   630 	TEST2(view->CountL(),1);
   631 
   632 	list->ResetAndDestroy();
   633 
   634 	// check contents of the event.
   635 	TBool res = view->FirstL(active->iStatus);
   636 	TEST(res);
   637 	active->StartL();
   638 	CActiveScheduler::Start();
   639 	TEST2(active->iStatus.Int(), KErrNone);
   640 	
   641 	TEST2(view->Event().Contact(), KTestContact1);
   642 	TEST( view->Event().Number() == KTestNumber1);
   643 	TEST( view->Event().Status() == KTestStatus1);
   644 	TEST( view->Event().RemoteParty() == KTestRemote1);
   645 
   646 	/////////////////////////////////////////
   647 
   648 	filter = CLogFilter::NewL();
   649 	CleanupStack::PushL(filter);
   650 	
   651 	// Set filter
   652 	filter->SetContact(KTestContact1);
   653 	filter->SetDirection(KTestDirection1);
   654 	filter->SetDurationType(KLogDurationNone);
   655 	filter->SetEventType(KLogCallEventTypeUid);
   656 	filter->SetNumber(KTestNumber1);
   657 	filter->SetRemoteParty(KTestRemote1);
   658 	filter->SetStatus(KTestStatus1);
   659 	filter->SetStartTime(testStartTime);
   660 	filter->SetEndTime(tomorrow);
   661 
   662 	list->AppendL(filter);
   663 	CleanupStack::Pop(); // filter
   664 
   665 	// Test View
   666 	active->StartL();
   667 	TEST(view->SetFilterL(*list, active->iStatus));
   668 	CActiveScheduler::Start();
   669 	TEST2(view->CountL(), 1);
   670 
   671 	filter = CLogFilter::NewL();
   672 	CleanupStack::PushL(filter);
   673 	
   674 	// Set filter
   675 	filter->SetContact(KTestContact2);
   676 	filter->SetDirection(KTestDirection2);
   677 	filter->SetDurationType(KLogDurationValid);
   678 	filter->SetEventType(KLogDataEventTypeUid);
   679 	filter->SetNumber(KTestNumber2);
   680 	filter->SetRemoteParty(KTestRemote2);
   681 	filter->SetStatus(KTestStatus2);
   682 
   683 	// start time is duplicate,
   684 	// end time is not duplicate
   685 	filter->SetStartTime(testStartTime);
   686 	filter->SetEndTime(twoDaysFromNow);
   687 
   688 	list->AppendL(filter);
   689 	CleanupStack::Pop(); // filter
   690 
   691 	// Test View
   692 	active->StartL();
   693 	TEST(view->SetFilterL(*list, active->iStatus));
   694 	CActiveScheduler::Start();
   695 	TEST2(view->CountL(), 2);
   696 
   697 	list->ResetAndDestroy();
   698 
   699 	// check contents of event 2 (most recent)
   700 	res = view->FirstL(active->iStatus);
   701 	TEST(res);
   702 	active->StartL();
   703 	CActiveScheduler::Start();
   704 	TEST2(active->iStatus.Int(), KErrNone);
   705 	
   706 	TEST2(view->Event().Contact(), KTestContact2);
   707 	TEST( view->Event().Number() == KTestNumber2);
   708 	TEST( view->Event().Status() == KTestStatus2);
   709 	TEST( view->Event().RemoteParty() == KTestRemote2);
   710 
   711 	// check contents of event 1 (older)
   712 	res = view->NextL(active->iStatus);
   713 	TEST(res);
   714 	active->StartL();
   715 	CActiveScheduler::Start();
   716 	TEST2(active->iStatus.Int(), KErrNone);
   717 	
   718 	TEST2(view->Event().Contact(), KTestContact1);
   719 	TEST( view->Event().Number() == KTestNumber1);
   720 	TEST( view->Event().Status() == KTestStatus1);
   721 	TEST( view->Event().RemoteParty() == KTestRemote1);
   722 
   723 	CleanupStack::PopAndDestroy(4); // list, view, event, active
   724 	}
   725 
   726 /**
   727 @SYMTestCaseID          SYSLIB-LOGENG-CT-0931
   728 @SYMTestCaseDesc	    Tests for recent view list with filters 
   729 @SYMTestPriority 	    High
   730 @SYMTestActions  	    Tests for recent view list,with different settings of the filter. 
   731 @SYMTestExpectedResults Test must not fail
   732 @SYMREQ                 REQ0000
   733 */
   734 LOCAL_C void TestRecentViewWithFilterL(CLogClient& aClient)
   735 	{
   736 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0931 "));
   737 	CLogEvent* event = CLogEvent::NewL();
   738 	CleanupStack::PushL(event);
   739 
   740 	CTestActive* active = new(ELeave)CTestActive();
   741 	CleanupStack::PushL(active);
   742 
   743 	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
   744 	CleanupStack::PushL(view);
   745 
   746 	// Incoming
   747 	TLogString buf;
   748 	aClient.GetString(buf, R_LOG_DIR_IN);
   749 
   750 	event->SetEventType(KLogCallEventTypeUid);
   751 	event->SetDirection(buf);
   752 	event->SetNumber(_L("1"));
   753 
   754 	// Add event
   755 	active->StartL();
   756 	aClient.AddEvent(*event, active->iStatus);
   757 	CActiveScheduler::Start();
   758 	TEST2(active->iStatus.Int(), KErrNone);
   759 
   760 	event->SetDurationType(KLogDurationData);
   761 	event->SetNumber(_L("2"));
   762 
   763 	// Add event
   764 	active->StartL();
   765 	aClient.AddEvent(*event, active->iStatus);
   766 	CActiveScheduler::Start();
   767 	TEST2(active->iStatus.Int(), KErrNone);
   768 
   769 	event->SetStatus(KTestStatus1);
   770 	event->SetNumber(_L("3"));
   771 
   772 	// Add event
   773 	active->StartL();
   774 	aClient.AddEvent(*event, active->iStatus);
   775 	CActiveScheduler::Start();
   776 	TEST2(active->iStatus.Int(), KErrNone);
   777 
   778 	event->SetContact(KTestContact1);
   779 	event->SetNumber(_L("4"));
   780 
   781 	// Add event
   782 	active->StartL();
   783 	aClient.AddEvent(*event, active->iStatus);
   784 	CActiveScheduler::Start();
   785 	TEST2(active->iStatus.Int(), KErrNone);
   786 
   787 	active->StartL();
   788 	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
   789 	CActiveScheduler::Start();
   790 	TEST2(view->CountL(), 4);
   791 
   792 	CLogFilter* filter = CLogFilter::NewL();
   793 	CleanupStack::PushL(filter);
   794 
   795 	// This should make no difference
   796 	filter->SetEventType(KLogCallEventTypeUid);
   797 
   798 	active->StartL();
   799 	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
   800 	CActiveScheduler::Start();
   801 	TEST2(view->CountL(), 4);
   802 
   803 	// This should make no difference
   804 	filter->SetDirection(buf);
   805 
   806 	active->StartL();
   807 	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
   808 	CActiveScheduler::Start();
   809 	TEST2(view->CountL(), 4);
   810 
   811 	filter->SetDurationType(KLogDurationData);
   812 
   813 	active->StartL();
   814 	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
   815 	CActiveScheduler::Start();
   816 	TEST2(view->CountL(), 3);
   817 
   818 	filter->SetStatus(KTestStatus1);
   819 
   820 	active->StartL();
   821 	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
   822 	CActiveScheduler::Start();
   823 	TEST2(view->CountL(), 2);
   824 
   825 	filter->SetContact(KTestContact1);
   826 
   827 	active->StartL();
   828 	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
   829 	CActiveScheduler::Start();
   830 	TEST2(view->CountL(), 1);
   831 
   832 	filter->SetStatus(_L("Dummy"));
   833 	TEST(!view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
   834 
   835 	CleanupStack::PopAndDestroy(4); // filter, view, active, event
   836 	}
   837 
   838 /**
   839 @SYMTestCaseID          SYSLIB-LOGENG-CT-0932
   840 @SYMTestCaseDesc	    Tests for recent view list with filter set for the view
   841 @SYMTestPriority 	    High
   842 @SYMTestActions  	    Tests for recent view list set by the specified set of filters.
   843 @SYMTestExpectedResults Test must not fail
   844 @SYMREQ                 REQ0000
   845 */
   846 LOCAL_C void TestRecentViewWithFilterListL(CLogClient& aClient)
   847 	{
   848 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0932 "));
   849 	CLogEvent* event = CLogEvent::NewL();
   850 	CleanupStack::PushL(event);
   851 
   852 	CTestActive* active = new(ELeave)CTestActive();
   853 	CleanupStack::PushL(active);
   854 
   855 	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
   856 	CleanupStack::PushL(view);
   857 
   858 	// Make sure there are no entries in any recent lists
   859 	active->StartL();
   860 	aClient.ClearLog(KLogNullRecentList, active->iStatus);
   861 	CActiveScheduler::Start();
   862 	TEST2(active->iStatus.Int(), KErrNone);
   863 
   864 	// Incoming
   865 	TLogString buf;
   866 	aClient.GetString(buf, R_LOG_DIR_IN);
   867 
   868 	event->SetEventType(KLogCallEventTypeUid);
   869 	event->SetDirection(buf);
   870 	event->SetDurationType(KLogDurationNone);
   871 	event->SetContact(KTestContact1);
   872 	event->SetStatus(KTestStatus1);
   873 
   874 	// Add event
   875 	active->StartL();
   876 	aClient.AddEvent(*event, active->iStatus);
   877 	CActiveScheduler::Start();
   878 	TEST2(active->iStatus.Int(), KErrNone);
   879 
   880 	event->SetDurationType(KLogDurationValid);
   881 	event->SetContact(KTestContact2);
   882 	event->SetStatus(KTestStatus2);
   883 
   884 	// Add event
   885 	active->StartL();
   886 	aClient.AddEvent(*event, active->iStatus);
   887 	CActiveScheduler::Start();
   888 	TEST2(active->iStatus.Int(), KErrNone);
   889 
   890 	event->SetDurationType(KLogDurationData);
   891 	event->SetContact(KTestContact3);
   892 	event->SetStatus(KTestStatus3);
   893 
   894 	// Add event
   895 	active->StartL();
   896 	aClient.AddEvent(*event, active->iStatus);
   897 	CActiveScheduler::Start();
   898 	TEST2(active->iStatus.Int(), KErrNone);
   899 
   900 	active->StartL();
   901 	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
   902 	CActiveScheduler::Start();
   903 	TEST2(active->iStatus.Int(), KErrNone);
   904 	TEST2(view->CountL(), 3);
   905 
   906 	CLogFilterList* list = new(ELeave)CLogFilterList;
   907 	CleanupStack::PushL(list);
   908 
   909 	CLogFilter* filter = CLogFilter::NewL();
   910 	CleanupStack::PushL(filter);
   911 	list->AppendL(filter);
   912 	CleanupStack::Pop(); // filter
   913 
   914 	filter->SetDurationType(KLogDurationNone);
   915 	filter->SetStatus(KTestStatus1);
   916 	filter->SetContact(KTestContact1);
   917 
   918 	active->StartL();
   919 	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *list, active->iStatus));
   920 	CActiveScheduler::Start();
   921 	TEST2(active->iStatus.Int(), KErrNone);
   922 	TEST2(view->CountL(), 1);
   923 
   924 	filter = CLogFilter::NewL();
   925 	CleanupStack::PushL(filter);
   926 	list->AppendL(filter);
   927 	CleanupStack::Pop(); // filter
   928 
   929 	filter->SetDurationType(KLogDurationValid);
   930 	filter->SetStatus(KTestStatus2);
   931 	filter->SetContact(KTestContact2);
   932 
   933 	active->StartL();
   934 	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *list, active->iStatus));
   935 	CActiveScheduler::Start();
   936 	TEST2(active->iStatus.Int(), KErrNone);
   937 	TEST2(view->CountL(), 2);
   938 
   939 	filter = CLogFilter::NewL();
   940 	CleanupStack::PushL(filter);
   941 	list->AppendL(filter);
   942 	CleanupStack::Pop(); // filter
   943 
   944 	filter->SetDurationType(KLogDurationData);
   945 	filter->SetStatus(KTestStatus3);
   946 	filter->SetContact(KTestContact3);
   947 
   948 	active->StartL();
   949 	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *list, active->iStatus));
   950 	CActiveScheduler::Start();
   951 	TEST2(active->iStatus.Int(), KErrNone);
   952 	TEST2(view->CountL(), 3);
   953 
   954 	list->ResetAndDestroy();
   955 	CleanupStack::PopAndDestroy(4); // list, view, active, event
   956 	}
   957 
   958 /**
   959 @SYMTestCaseID          SYSLIB-LOGENG-CT-0933
   960 @SYMTestCaseDesc	    Tests for duplicate event view with filter 
   961 @SYMTestPriority 	    High
   962 @SYMTestActions  	    Tests for duplicate event view count. 
   963 @SYMTestExpectedResults Test must not fail
   964 @SYMREQ                 REQ0000
   965 */
   966 LOCAL_C void TestDuplicateViewWithFilterL(CLogClient& aClient)
   967 	{
   968 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0933 "));
   969 	CLogEvent* event = CLogEvent::NewL();
   970 	CleanupStack::PushL(event);
   971 
   972 	CTestActive* active = new(ELeave)CTestActive();
   973 	CleanupStack::PushL(active);
   974 
   975 	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
   976 	CleanupStack::PushL(view);
   977 
   978 	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
   979 	CleanupStack::PushL(duplicate);
   980 
   981 	// Make sure there are no entries in any recent lists
   982 	active->StartL();
   983 	aClient.ClearLog(KLogNullRecentList, active->iStatus);
   984 	CActiveScheduler::Start();
   985 	TEST2(active->iStatus.Int(), KErrNone);
   986 
   987 	// Incoming
   988 	TLogString buf;
   989 	aClient.GetString(buf, R_LOG_DIR_IN);
   990 
   991 	event->SetEventType(KLogCallEventTypeUid);
   992 	event->SetDirection(buf);
   993 	event->SetContact(KTestContact1);
   994 
   995 	// Add event
   996 	active->StartL();
   997 	aClient.AddEvent(*event, active->iStatus);
   998 	CActiveScheduler::Start();
   999 	TEST2(active->iStatus.Int(), KErrNone);
  1000 
  1001 	event->SetDurationType(KLogDurationValid);
  1002 
  1003 	// Add event
  1004 	active->StartL();
  1005 	aClient.AddEvent(*event, active->iStatus);
  1006 	CActiveScheduler::Start();
  1007 	TEST2(active->iStatus.Int(), KErrNone);
  1008 
  1009 	event->SetStatus(KTestStatus1);
  1010 
  1011 	// Add event
  1012 	active->StartL();
  1013 	aClient.AddEvent(*event, active->iStatus);
  1014 	CActiveScheduler::Start();
  1015 	TEST2(active->iStatus.Int(), KErrNone);
  1016 
  1017 	event->SetDurationType(KLogDurationNone);
  1018 	event->SetStatus(KNullDesC);
  1019 
  1020 	// Add event - This will be the entry in recent list
  1021 	active->StartL();
  1022 	aClient.AddEvent(*event, active->iStatus);
  1023 	CActiveScheduler::Start();
  1024 	TEST2(active->iStatus.Int(), KErrNone);
  1025 	TLogId logId1 = event->Id();
  1026 
  1027 	// Should only be one event in recent list - the rest are duplicates
  1028 	active->StartL();
  1029 	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1030 	CActiveScheduler::Start();
  1031 	TEST2(active->iStatus.Int(), KErrNone);
  1032 	TEST2(view->CountL(), 1);
  1033 	
  1034 	TLogRecentList recentList = view->RecentList();
  1035 	TEST(recentList == KLogRecentIncomingCalls);
  1036 
  1037 	// Check duplicate count
  1038 	active->StartL();
  1039 	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  1040 	CActiveScheduler::Start();
  1041 	TEST2(active->iStatus.Int(), KErrNone);
  1042 	TEST2(duplicate->CountL(), 3);
  1043 	
  1044 	TLogId logId2 = duplicate->Source();
  1045 	TEST(logId1 == logId2);
  1046 
  1047 	CLogFilter* filter = CLogFilter::NewL();
  1048 	CleanupStack::PushL(filter);
  1049 
  1050 	active->StartL();
  1051 	TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
  1052 	CActiveScheduler::Start();
  1053 	TEST2(active->iStatus.Int(), KErrNone);
  1054 	TEST2(duplicate->CountL(), 3);
  1055 
  1056 	filter->SetDurationType(KLogDurationValid);
  1057 
  1058 	active->StartL();
  1059 	TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
  1060 	CActiveScheduler::Start();
  1061 	TEST2(active->iStatus.Int(), KErrNone);
  1062 	TEST2(duplicate->CountL(), 2);
  1063 
  1064 	filter->SetStatus(KTestStatus1);
  1065 
  1066 	active->StartL();
  1067 	TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
  1068 	CActiveScheduler::Start();
  1069 	TEST2(active->iStatus.Int(), KErrNone);
  1070 	TEST2(duplicate->CountL(), 1);
  1071 
  1072 	filter->SetStatus(KTestStatus2);
  1073 	TEST(!view->DuplicatesL(*duplicate, *filter, active->iStatus));
  1074 
  1075 	CleanupStack::PopAndDestroy(5); // filter, duplicate, view, active, event
  1076 	}
  1077 
  1078 /**
  1079 @SYMTestCaseID          SYSLIB-LOGENG-CT-0934
  1080 @SYMTestCaseDesc	    Tests for duplicate event view with filter list
  1081 @SYMTestPriority 	    High
  1082 @SYMTestActions  	    Tests for duplicate event view count,set by the specified set of filters.
  1083 @SYMTestExpectedResults Test must not fail
  1084 @SYMREQ                 REQ0000
  1085 */
  1086 LOCAL_C void TestDuplicateViewWithFilterListL(CLogClient& aClient)
  1087 	{
  1088 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0934 "));
  1089 	CLogEvent* event = CLogEvent::NewL();
  1090 	CleanupStack::PushL(event);
  1091 
  1092 	CTestActive* active = new(ELeave)CTestActive();
  1093 	CleanupStack::PushL(active);
  1094 
  1095 	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  1096 	CleanupStack::PushL(view);
  1097 
  1098 	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  1099 	CleanupStack::PushL(duplicate);
  1100 
  1101 	// Make sure there are no entries in any recent lists
  1102 	active->StartL();
  1103 	aClient.ClearLog(KLogNullRecentList, active->iStatus);
  1104 	CActiveScheduler::Start();
  1105 	TEST2(active->iStatus.Int(), KErrNone);
  1106 
  1107 	// Incoming
  1108 	TLogString buf;
  1109 	aClient.GetString(buf, R_LOG_DIR_IN);
  1110 
  1111 	event->SetEventType(KLogCallEventTypeUid);
  1112 	event->SetDirection(buf);
  1113 	event->SetContact(KTestContact1);
  1114 
  1115 	event->SetDurationType(KLogDurationNone);
  1116 	event->SetStatus(KNullDesC);
  1117 
  1118 	// Add event
  1119 	active->StartL();
  1120 	aClient.AddEvent(*event, active->iStatus);
  1121 	CActiveScheduler::Start();
  1122 	TEST2(active->iStatus.Int(), KErrNone);
  1123 
  1124 	event->SetDurationType(KLogDurationValid);
  1125 
  1126 	active->StartL();
  1127 	aClient.AddEvent(*event, active->iStatus);
  1128 	CActiveScheduler::Start();
  1129 	TEST2(active->iStatus.Int(), KErrNone);
  1130 
  1131 	event->SetDurationType(KLogDurationData);
  1132 
  1133 	active->StartL();
  1134 	aClient.AddEvent(*event, active->iStatus);
  1135 	CActiveScheduler::Start();
  1136 	TEST2(active->iStatus.Int(), KErrNone);
  1137 
  1138 	// Final event will be most recent
  1139 	event->SetDurationType(KLogDurationNone);
  1140 	event->SetStatus(KNullDesC);
  1141 
  1142 	// Add event
  1143 	active->StartL();
  1144 	aClient.AddEvent(*event, active->iStatus);
  1145 	CActiveScheduler::Start();
  1146 	TEST2(active->iStatus.Int(), KErrNone);
  1147 
  1148 	CLogFilterList* list = new(ELeave)CLogFilterList;
  1149 	CleanupStack::PushL(list);
  1150 
  1151 	active->StartL();
  1152 	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1153 	CActiveScheduler::Start();
  1154 	TEST2(active->iStatus.Int(), KErrNone);
  1155 	TEST2(view->CountL(), 1);
  1156 
  1157 	active->StartL();
  1158 	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  1159 	CActiveScheduler::Start();
  1160 	TEST2(active->iStatus.Int(), KErrNone);
  1161 	TEST2(duplicate->CountL(), 3);
  1162 
  1163 	CLogFilter* filter = CLogFilter::NewL();
  1164 	CleanupStack::PushL(filter);
  1165 	list->AppendL(filter);
  1166 	CleanupStack::Pop(); // filter
  1167 
  1168 	filter->SetDurationType(KLogDurationValid);
  1169 
  1170 	active->StartL();
  1171 	TEST(view->DuplicatesL(*duplicate, *list, active->iStatus));
  1172 	CActiveScheduler::Start();
  1173 	TEST2(active->iStatus.Int(), KErrNone);
  1174 	TEST2(duplicate->CountL(), 1);
  1175 
  1176 	filter = CLogFilter::NewL();
  1177 	CleanupStack::PushL(filter);
  1178 	list->AppendL(filter);
  1179 	CleanupStack::Pop(); // filter
  1180 
  1181 	filter->SetDurationType(KLogDurationData);
  1182 
  1183 	active->StartL();
  1184 	TEST(view->DuplicatesL(*duplicate, *list, active->iStatus));
  1185 	CActiveScheduler::Start();
  1186 	TEST2(active->iStatus.Int(), KErrNone);
  1187 	TEST2(duplicate->CountL(), 2);
  1188 
  1189 	list->ResetAndDestroy();
  1190 	CleanupStack::PopAndDestroy(5); // list, duplicate, view, active, event
  1191 	}
  1192 
  1193 /**
  1194 @SYMTestCaseID          SYSLIB-LOGENG-CT-0935
  1195 @SYMTestCaseDesc	    Tests for null field set on filter in the event view 
  1196                         Tests for CLogFilter::SetNullFields() function
  1197 @SYMTestPriority 	    High
  1198 @SYMTestActions  	    Clear the log events and add new events with fields set in.Define null fields in the filter and check the view
  1199 @SYMTestExpectedResults Test must not fail
  1200 @SYMREQ                 REQ0000
  1201 */
  1202 LOCAL_C void TestEventViewForNullFieldsL(CLogClient& aClient)
  1203 	{
  1204 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0935 "));
  1205 	CTestActive* active = new(ELeave)CTestActive;
  1206 	CleanupStack::PushL(active);
  1207 
  1208 	CLogEvent* event = CLogEvent::NewL();
  1209 	CleanupStack::PushL(event);
  1210 	event->SetEventType(KLogCallEventTypeUid);
  1211 
  1212 	CLogViewEvent* view = CLogViewEvent::NewL(aClient);
  1213 	CleanupStack::PushL(view);
  1214 
  1215 	CLogFilter* filter = CLogFilter::NewL();
  1216 	CleanupStack::PushL(filter);
  1217 
  1218 	// Wait a second
  1219 	User::After(1000000);
  1220 
  1221 	TTime now;
  1222 	now.UniversalTime();
  1223 	now += (TTimeIntervalDays)+1;
  1224 	// Get rid of all the events in the log
  1225 	active->StartL();
  1226 	aClient.ClearLog(now, active->iStatus);
  1227 	CActiveScheduler::Start();
  1228 	TEST2(active->iStatus.Int(), KErrNone);
  1229 	
  1230 	// Make sure there are no events
  1231 	TEST(!view->SetFilterL(*filter, active->iStatus));
  1232 
  1233 	active->StartL();
  1234 	aClient.AddEvent(*event, active->iStatus);
  1235 	CActiveScheduler::Start();
  1236 	TEST2(active->iStatus.Int(), KErrNone);
  1237 
  1238 	event->SetContact(KTestContact1);
  1239 
  1240 	active->StartL();
  1241 	aClient.AddEvent(*event, active->iStatus);
  1242 	CActiveScheduler::Start();
  1243 	TEST2(active->iStatus.Int(), KErrNone);
  1244 
  1245 	event->SetDirection(KTestDirection1);
  1246 
  1247 	active->StartL();
  1248 	aClient.AddEvent(*event, active->iStatus);
  1249 	CActiveScheduler::Start();
  1250 	TEST2(active->iStatus.Int(), KErrNone);
  1251 
  1252 	event->SetNumber(KTestNumber1);
  1253 
  1254 	active->StartL();
  1255 	aClient.AddEvent(*event, active->iStatus);
  1256 	CActiveScheduler::Start();
  1257 	TEST2(active->iStatus.Int(), KErrNone);
  1258 
  1259 	event->SetRemoteParty(KTestRemote1);
  1260 
  1261 	active->StartL();
  1262 	aClient.AddEvent(*event, active->iStatus);
  1263 	CActiveScheduler::Start();
  1264 	TEST2(active->iStatus.Int(), KErrNone);
  1265 
  1266 	event->SetStatus(KTestStatus1);
  1267 
  1268 	active->StartL();
  1269 	aClient.AddEvent(*event, active->iStatus);
  1270 	CActiveScheduler::Start();
  1271 	TEST2(active->iStatus.Int(), KErrNone);
  1272 
  1273 	event->SetSubject(KTestSubject);
  1274 
  1275 	active->StartL();
  1276 	aClient.AddEvent(*event, active->iStatus);
  1277 	CActiveScheduler::Start();
  1278 	TEST2(active->iStatus.Int(), KErrNone);
  1279 
  1280 	event->SetLink(KTestLink);
  1281 
  1282 	active->StartL();
  1283 	aClient.AddEvent(*event, active->iStatus);
  1284 	CActiveScheduler::Start();
  1285 	TEST2(active->iStatus.Int(), KErrNone);
  1286 
  1287 	event->SetDataL(KTestData);
  1288 
  1289 	active->StartL();
  1290 	aClient.AddEvent(*event, active->iStatus);
  1291 	CActiveScheduler::Start();
  1292 	TEST2(active->iStatus.Int(), KErrNone);
  1293 
  1294 	// Test for NULL fields
  1295 
  1296 	active->StartL();
  1297 	TEST(view->SetFilterL(*filter, active->iStatus));
  1298 	CActiveScheduler::Start();
  1299 	TEST2(active->iStatus.Int(), KErrNone);
  1300 	TEST2(view->CountL(), 9);
  1301 
  1302 	filter->SetNullFields(ELogContactField);
  1303 
  1304 	active->StartL();
  1305 	TEST(view->SetFilterL(*filter, active->iStatus));
  1306 	CActiveScheduler::Start();
  1307 	TEST2(active->iStatus.Int(), KErrNone);
  1308 	TEST2(view->CountL(), 1);
  1309 
  1310 	filter->SetNullFields(ELogContactField | ELogDirectionField);
  1311 
  1312 	active->StartL();
  1313 	TEST(view->SetFilterL(*filter, active->iStatus));
  1314 	CActiveScheduler::Start();
  1315 	TEST2(active->iStatus.Int(), KErrNone);
  1316 	TEST2(view->CountL(), 1);
  1317 
  1318 	filter->SetNullFields(ELogContactField | ELogDirectionField);
  1319 
  1320 	active->StartL();
  1321 	TEST(view->SetFilterL(*filter, active->iStatus));
  1322 	CActiveScheduler::Start();
  1323 	TEST2(active->iStatus.Int(), KErrNone);
  1324 	TEST2(view->CountL(), 1);
  1325 
  1326 	filter->SetNullFields(ELogContactField | ELogDirectionField | ELogNumberField);
  1327 
  1328 	active->StartL();
  1329 	TEST(view->SetFilterL(*filter, active->iStatus));
  1330 	CActiveScheduler::Start();
  1331 	TEST2(active->iStatus.Int(), KErrNone);
  1332 	TEST2(view->CountL(), 1);
  1333 
  1334 	filter->SetNullFields(ELogContactField | ELogDirectionField | ELogNumberField | ELogRemotePartyField);
  1335 
  1336 	active->StartL();
  1337 	TEST(view->SetFilterL(*filter, active->iStatus));
  1338 	CActiveScheduler::Start();
  1339 	TEST2(active->iStatus.Int(), KErrNone);
  1340 	TEST2(view->CountL(), 1);
  1341 
  1342 	filter->SetNullFields(ELogContactField | ELogDirectionField | ELogNumberField | ELogRemotePartyField | ELogStatusField);
  1343 
  1344 	active->StartL();
  1345 	TEST(view->SetFilterL(*filter, active->iStatus));
  1346 	CActiveScheduler::Start();
  1347 	TEST2(active->iStatus.Int(), KErrNone);
  1348 	TEST2(view->CountL(), 1);
  1349 
  1350 	filter->SetNullFields(ELogContactField | ELogDirectionField | ELogNumberField | ELogRemotePartyField | ELogStatusField | ELogSubjectField);
  1351 
  1352 	active->StartL();
  1353 	TEST(view->SetFilterL(*filter, active->iStatus));
  1354 	CActiveScheduler::Start();
  1355 	TEST2(active->iStatus.Int(), KErrNone);
  1356 	TEST2(view->CountL(), 1);
  1357 
  1358 	filter->SetNullFields(ELogContactField | ELogDirectionField | ELogNumberField | ELogRemotePartyField | ELogStatusField | ELogSubjectField | ELogLinkField);
  1359 
  1360 	active->StartL();
  1361 	TEST(view->SetFilterL(*filter, active->iStatus));
  1362 	CActiveScheduler::Start();
  1363 	TEST2(active->iStatus.Int(), KErrNone);
  1364 	TEST2(view->CountL(), 1);
  1365 
  1366 	filter->SetNullFields(ELogContactField | ELogDirectionField | ELogNumberField | ELogRemotePartyField | ELogStatusField | ELogSubjectField | ELogLinkField | ELogDataField);
  1367 
  1368 	active->StartL();
  1369 	TEST(view->SetFilterL(*filter, active->iStatus));
  1370 	CActiveScheduler::Start();
  1371 	TEST2(active->iStatus.Int(), KErrNone);
  1372 	TEST2(view->CountL(), 1);
  1373 
  1374 	CleanupStack::PopAndDestroy(4); // filter, view, event, active
  1375 	}
  1376 
  1377 /**
  1378 @SYMTestCaseID          SYSLIB-LOGENG-CT-0936
  1379 @SYMTestCaseDesc	    Tests for null field set on filter for the recent event view list 
  1380 @SYMTestPriority 	    High
  1381 @SYMTestActions  	    Clear the log events and add new events with fields set in.Define null fields in the filter and check the view
  1382 @SYMTestExpectedResults Test must not fail
  1383 @SYMREQ                 REQ0000
  1384 */
  1385 LOCAL_C void TestRecentViewForNullFieldsL(CLogClient& aClient)
  1386 	{
  1387 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0936 "));
  1388 	CLogEvent* event = CLogEvent::NewL();
  1389 	CleanupStack::PushL(event);
  1390 
  1391 	CTestActive* active = new(ELeave)CTestActive();
  1392 	CleanupStack::PushL(active);
  1393 
  1394 	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  1395 	CleanupStack::PushL(view);
  1396 
  1397 	// Incoming
  1398 	TLogString buf;
  1399 	aClient.GetString(buf, R_LOG_DIR_IN);
  1400 
  1401 	event->SetEventType(KLogCallEventTypeUid);
  1402 	event->SetDirection(buf);
  1403 	event->SetNumber(_L("1"));
  1404 
  1405 	// Add event
  1406 	active->StartL();
  1407 	aClient.AddEvent(*event, active->iStatus);
  1408 	CActiveScheduler::Start();
  1409 	TEST2(active->iStatus.Int(), KErrNone);
  1410 
  1411 	event->SetStatus(KTestStatus1);
  1412 	event->SetNumber(_L("2"));
  1413 
  1414 	// Add event
  1415 	active->StartL();
  1416 	aClient.AddEvent(*event, active->iStatus);
  1417 	CActiveScheduler::Start();
  1418 	TEST2(active->iStatus.Int(), KErrNone);
  1419 
  1420 	event->SetSubject(KTestSubject);
  1421 	event->SetNumber(_L("3"));
  1422 
  1423 	active->StartL();
  1424 	aClient.AddEvent(*event, active->iStatus);
  1425 	CActiveScheduler::Start();
  1426 	TEST2(active->iStatus.Int(), KErrNone);
  1427 
  1428 	event->SetLink(KTestLink);
  1429 	event->SetNumber(_L("4"));
  1430 
  1431 	active->StartL();
  1432 	aClient.AddEvent(*event, active->iStatus);
  1433 	CActiveScheduler::Start();
  1434 	TEST2(active->iStatus.Int(), KErrNone);
  1435 
  1436 	event->SetDataL(KTestData);
  1437 	event->SetNumber(_L("5"));
  1438 
  1439 	active->StartL();
  1440 	aClient.AddEvent(*event, active->iStatus);
  1441 	CActiveScheduler::Start();
  1442 	TEST2(active->iStatus.Int(), KErrNone);
  1443 
  1444 	active->StartL();
  1445 	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1446 	CActiveScheduler::Start();
  1447 	TEST2(view->CountL(), 5);
  1448 
  1449 	CLogFilter* filter = CLogFilter::NewL();
  1450 	CleanupStack::PushL(filter);
  1451 	
  1452 	// Test for NULL fields
  1453 
  1454 	filter->SetNullFields(ELogStatusField);
  1455 
  1456 	active->StartL();
  1457 	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
  1458 	CActiveScheduler::Start();
  1459 	TEST2(view->CountL(), 1);
  1460 
  1461 	filter->SetNullFields(ELogStatusField | ELogSubjectField);
  1462 
  1463 	active->StartL();
  1464 	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
  1465 	CActiveScheduler::Start();
  1466 	TEST2(view->CountL(), 1);
  1467 
  1468 	filter->SetNullFields(ELogStatusField | ELogSubjectField | ELogLinkField);
  1469 
  1470 	active->StartL();
  1471 	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
  1472 	CActiveScheduler::Start();
  1473 	TEST2(view->CountL(), 1);
  1474 
  1475 	filter->SetNullFields(ELogStatusField | ELogSubjectField | ELogLinkField | ELogDataField);
  1476 
  1477 	active->StartL();
  1478 	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
  1479 	CActiveScheduler::Start();
  1480 	TEST2(view->CountL(), 1);
  1481 
  1482 	CleanupStack::PopAndDestroy(4); // filter, view, active, event
  1483 	}
  1484 
  1485 /**
  1486 @SYMTestCaseID          SYSLIB-LOGENG-CT-0937
  1487 @SYMTestCaseDesc	    Tests for null field set on filter for the duplicate event view list 
  1488 @SYMTestPriority 	    High
  1489 @SYMTestActions  	    Clear the log events and add new events with fields set in.Define null fields in the filter and check the view
  1490 @SYMTestExpectedResults Test must not fail
  1491 @SYMREQ                 REQ0000
  1492 */
  1493 LOCAL_C void TestDuplicateViewForNullFieldsL(CLogClient& aClient)
  1494 	{
  1495 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0937 "));
  1496 	CLogEvent* event = CLogEvent::NewL();
  1497 	CleanupStack::PushL(event);
  1498 
  1499 	CTestActive* active = new(ELeave)CTestActive();
  1500 	CleanupStack::PushL(active);
  1501 
  1502 	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  1503 	CleanupStack::PushL(view);
  1504 
  1505 	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  1506 	CleanupStack::PushL(duplicate);
  1507 
  1508 	// Make sure there are no entries in any recent lists
  1509 	active->StartL();
  1510 	aClient.ClearLog(KLogNullRecentList, active->iStatus);
  1511 	CActiveScheduler::Start();
  1512 	TEST2(active->iStatus.Int(), KErrNone);
  1513 
  1514 	// Incoming
  1515 	TLogString buf;
  1516 	aClient.GetString(buf, R_LOG_DIR_IN);
  1517 
  1518 	event->SetEventType(KLogCallEventTypeUid);
  1519 	event->SetDirection(buf);
  1520 	event->SetContact(KTestContact1);
  1521 
  1522 	// Add event
  1523 	active->StartL();
  1524 	aClient.AddEvent(*event, active->iStatus);
  1525 	CActiveScheduler::Start();
  1526 	TEST2(active->iStatus.Int(), KErrNone);
  1527 
  1528 	event->SetStatus(KTestStatus1);
  1529 
  1530 	// Add event
  1531 	active->StartL();
  1532 	aClient.AddEvent(*event, active->iStatus);
  1533 	CActiveScheduler::Start();
  1534 	TEST2(active->iStatus.Int(), KErrNone);
  1535 
  1536 	event->SetSubject(KTestSubject);
  1537 
  1538 	// Add event
  1539 	active->StartL();
  1540 	aClient.AddEvent(*event, active->iStatus);
  1541 	CActiveScheduler::Start();
  1542 	TEST2(active->iStatus.Int(), KErrNone);
  1543 
  1544 	event->SetLink(KTestLink);
  1545 
  1546 	// Add event
  1547 	active->StartL();
  1548 	aClient.AddEvent(*event, active->iStatus);
  1549 	CActiveScheduler::Start();
  1550 	TEST2(active->iStatus.Int(), KErrNone);
  1551 
  1552 	event->SetDataL(KTestData);
  1553 
  1554 	// Add event
  1555 	active->StartL();
  1556 	aClient.AddEvent(*event, active->iStatus);
  1557 	CActiveScheduler::Start();
  1558 	TEST2(active->iStatus.Int(), KErrNone);
  1559 
  1560 	event->SetDurationType(KLogDurationNone);
  1561 	event->SetStatus(KNullDesC);
  1562 
  1563 	// Add event - This will be the entry in recent list
  1564 	active->StartL();
  1565 	aClient.AddEvent(*event, active->iStatus);
  1566 	CActiveScheduler::Start();
  1567 	TEST2(active->iStatus.Int(), KErrNone);
  1568 
  1569 	// Should only be one event in recent list - the rest are duplicates
  1570 	active->StartL();
  1571 	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1572 	CActiveScheduler::Start();
  1573 	TEST2(active->iStatus.Int(), KErrNone);
  1574 	TEST2(view->CountL(), 1);
  1575 
  1576 	// Check duplicate count
  1577 	active->StartL();
  1578 	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  1579 	CActiveScheduler::Start();
  1580 	TEST2(active->iStatus.Int(), KErrNone);
  1581 	TEST2(duplicate->CountL(), 5);
  1582 
  1583 	CLogFilter* filter = CLogFilter::NewL();
  1584 	CleanupStack::PushL(filter);
  1585 
  1586 	filter->SetNullFields(ELogStatusField);
  1587 
  1588 	active->StartL();
  1589 	TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
  1590 	CActiveScheduler::Start();
  1591 	TEST2(active->iStatus.Int(), KErrNone);
  1592 	TEST2(duplicate->CountL(), 1);
  1593 
  1594 	filter->SetNullFields(ELogStatusField | ELogSubjectField);
  1595 
  1596 	active->StartL();
  1597 	TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
  1598 	CActiveScheduler::Start();
  1599 	TEST2(active->iStatus.Int(), KErrNone);
  1600 	TEST2(duplicate->CountL(), 1);
  1601 
  1602 	filter->SetNullFields(ELogStatusField | ELogSubjectField | ELogLinkField);
  1603 
  1604 	active->StartL();
  1605 	TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
  1606 	CActiveScheduler::Start();
  1607 	TEST2(active->iStatus.Int(), KErrNone);
  1608 	TEST2(duplicate->CountL(), 1);
  1609 
  1610 	filter->SetNullFields(ELogStatusField | ELogSubjectField | ELogLinkField | ELogDataField);
  1611 
  1612 	active->StartL();
  1613 	TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
  1614 	CActiveScheduler::Start();
  1615 	TEST2(active->iStatus.Int(), KErrNone);
  1616 	TEST2(duplicate->CountL(), 1);
  1617 
  1618 	CleanupStack::PopAndDestroy(5); // filter, duplicate, view, active, event
  1619 	}
  1620 
  1621 /**
  1622 @SYMTestCaseID          SYSLIB-LOGENG-CT-0938
  1623 @SYMTestCaseDesc	    Querying event view for flags test
  1624 @SYMTestPriority 	    High
  1625 @SYMTestActions  	    Clear the log events and add new events with fields set in.Define null fields and set flags in the filter and check the view
  1626 @SYMTestExpectedResults Test must not fail
  1627 @SYMREQ                 REQ0000
  1628 */
  1629 LOCAL_C void TestEventViewForFlagsL(CLogClient& aClient)
  1630 	{
  1631 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0938 "));
  1632 	CLogEvent* event = CLogEvent::NewL();
  1633 	CleanupStack::PushL(event);
  1634 
  1635 	CTestActive* active = new(ELeave)CTestActive();
  1636 	CleanupStack::PushL(active);
  1637 
  1638 	CLogViewEvent* view = CLogViewEvent::NewL(aClient);
  1639 	CleanupStack::PushL(view);
  1640 
  1641 	CLogFilter* filter = CLogFilter::NewL();
  1642 	CleanupStack::PushL(filter);
  1643 
  1644 	// Wait a second
  1645 	User::After(1000000);
  1646 
  1647 	TTime now;
  1648 	now.UniversalTime();
  1649 	now += (TTimeIntervalDays)+1;
  1650 	
  1651 	// Get rid of all the events in the log
  1652 	active->StartL();
  1653 	aClient.ClearLog(now, active->iStatus);
  1654 	CActiveScheduler::Start();
  1655 	TEST2(active->iStatus.Int(), KErrNone);
  1656 	
  1657 	// Make sure there are now events
  1658 	TEST(!view->SetFilterL(*filter, active->iStatus));
  1659 
  1660 	// Add some events
  1661 	event->SetEventType(KLogCallEventTypeUid);
  1662 	TLogFlags flags = KLogFlagsMask + 1;
  1663 	TLogFlags flags2;
  1664 
  1665 	while(flags--)
  1666 		{
  1667 		event->ClearFlags(0xF);
  1668 		event->SetFlags(flags);
  1669 
  1670 		// Add event
  1671 		active->StartL();
  1672 		aClient.AddEvent(*event, active->iStatus);
  1673 		CActiveScheduler::Start();
  1674 		TEST2(active->iStatus.Int(), KErrNone);
  1675 		}
  1676 
  1677 	flags = KLogFlagsMask + 1;
  1678 	while(flags--)
  1679 		{
  1680 		filter->ClearFlags(0xF);
  1681 		// we use this because, since the events were all created without contact ids
  1682 		// the log engine looked each one up in the contacts DB and set the flag so we
  1683 		// need to set it in the flags being looked for
  1684 		flags2 = static_cast<TLogFlags>(flags | KLogEventContactSearched);
  1685 		filter->SetFlags(flags2);
  1686 		active->StartL();
  1687 		TEST(view->SetFilterL(*filter, active->iStatus));
  1688 		CActiveScheduler::Start();
  1689 		TEST2(active->iStatus.Int(), KErrNone);
  1690 		TEST((view->Event().Flags() & flags2) == flags2);
  1691 
  1692 		while(view->NextL(active->iStatus))
  1693 			{
  1694 			active->StartL();
  1695 			CActiveScheduler::Start();
  1696 			TEST2(active->iStatus.Int(), KErrNone);
  1697 			TEST((view->Event().Flags() & flags2) == flags2);
  1698 			}
  1699 		}
  1700 	
  1701 	// Now TEST we can query for the inverse
  1702 	filter->SetNullFields(ELogFlagsField);
  1703 
  1704 	flags = KLogFlagsMask + 1;
  1705 	while(flags--)
  1706 		{
  1707 		filter->ClearFlags(0xF);
  1708 		// we use this because, since the events were all created without contact ids
  1709 		// the log engine looked each one up in the contacts DB and set the flag so we
  1710 		// need to unset it in the flags being excluded
  1711 		flags2 = static_cast<TLogFlags>(flags & ~KLogEventContactSearched);
  1712 		filter->SetFlags(flags2);
  1713 
  1714 		active->StartL();
  1715 		TEST(view->SetFilterL(*filter, active->iStatus));
  1716 		CActiveScheduler::Start();
  1717 		TEST2(active->iStatus.Int(), KErrNone);
  1718 		TEST((~view->Event().Flags() & flags2) == flags2);
  1719 
  1720 		while(view->NextL(active->iStatus))
  1721 			{
  1722 			active->StartL();
  1723 			CActiveScheduler::Start();
  1724 			TEST2(active->iStatus.Int(), KErrNone);
  1725 			TEST((~view->Event().Flags() & flags2) == flags2);
  1726 			}
  1727 		}
  1728 
  1729 	CleanupStack::PopAndDestroy(4); // filter, view, active, event
  1730 	}
  1731 
  1732 /**
  1733 @SYMTestCaseID          SYSLIB-LOGENG-CT-0939
  1734 @SYMTestCaseDesc	    Querying recent event view for flags test
  1735 @SYMTestPriority 	    High
  1736 @SYMTestActions  	    Change the log configuration.Clear the log for any recent list and add some events.Query for flags in the recent view list
  1737 @SYMTestExpectedResults Test must not fail
  1738 @SYMREQ                 REQ0000
  1739 */
  1740 LOCAL_C void TestRecentViewForFlagsL(CLogClient& aClient)
  1741 	{
  1742 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0939 "));
  1743 	CLogEvent* event = CLogEvent::NewL();
  1744 	CleanupStack::PushL(event);
  1745 
  1746 	CTestActive* active = new(ELeave)CTestActive();
  1747 	CleanupStack::PushL(active);
  1748 
  1749 	TLogConfig config;
  1750 
  1751 	// Change the log engine config
  1752 	active->StartL();
  1753 	aClient.GetConfig(config, active->iStatus);
  1754 	CActiveScheduler::Start();
  1755 	TEST2(active->iStatus.Int(), KErrNone);
  1756 
  1757 	config.iMaxRecentLogSize = KLogFlagsMask + 1;
  1758 
  1759 	// Change the log engine config
  1760 	active->StartL();
  1761 	aClient.ChangeConfig(config, active->iStatus);
  1762 	CActiveScheduler::Start();
  1763 	TEST2(active->iStatus.Int(), KErrNone);
  1764 
  1765 	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  1766 	CleanupStack::PushL(view);
  1767 
  1768 	CLogFilter* filter = CLogFilter::NewL();
  1769 	CleanupStack::PushL(filter);
  1770 
  1771 	// Make sure there are no entries in any recent lists
  1772 	active->StartL();
  1773 	aClient.ClearLog(KLogNullRecentList, active->iStatus);
  1774 	CActiveScheduler::Start();
  1775 	TEST2(active->iStatus.Int(), KErrNone);
  1776 
  1777 	// Make sure there are no events
  1778 	TEST(!view->SetRecentListL(KLogNullRecentList, *filter, active->iStatus));
  1779 
  1780 	// Incoming
  1781 	TLogString buf;
  1782 	aClient.GetString(buf, R_LOG_DIR_IN);
  1783 
  1784 	// Add some events
  1785 	event->SetEventType(KLogCallEventTypeUid);
  1786 	event->SetDirection(buf);
  1787 
  1788 	TLogFlags flags = KLogFlagsMask + 1;
  1789 	while(flags--)
  1790 		{
  1791 		event->ClearFlags(0xF);
  1792 		event->SetFlags(flags);
  1793 		event->SetContact(flags);
  1794 
  1795 		// Add event
  1796 		active->StartL();
  1797 		aClient.AddEvent(*event, active->iStatus);
  1798 		CActiveScheduler::Start();
  1799 		TEST2(active->iStatus.Int(), KErrNone);
  1800 		}
  1801 
  1802 	flags = KLogFlagsMask + 1;
  1803 	while(flags--)
  1804 		{
  1805 		filter->ClearFlags(0xF);
  1806 		filter->SetFlags(flags);
  1807 
  1808 		active->StartL();
  1809 		TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
  1810 		CActiveScheduler::Start();
  1811 		TEST2(active->iStatus.Int(), KErrNone);
  1812 		TEST((view->Event().Flags() & flags) == flags);
  1813 
  1814 		while(view->NextL(active->iStatus))
  1815 			{
  1816 			active->StartL();
  1817 			CActiveScheduler::Start();
  1818 			TEST2(active->iStatus.Int(), KErrNone);
  1819 			TEST((view->Event().Flags() & flags) == flags);
  1820 			}
  1821 		}
  1822 	
  1823 	// Now TEST we can query for the inverse
  1824 	filter->SetNullFields(ELogFlagsField);
  1825 
  1826 	flags = KLogFlagsMask + 1;
  1827 	while(flags--)
  1828 		{
  1829 		filter->ClearFlags(0xF);
  1830 		filter->SetFlags(flags);
  1831 
  1832 		active->StartL();
  1833 		TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
  1834 		CActiveScheduler::Start();
  1835 		TEST2(active->iStatus.Int(), KErrNone);
  1836 		TEST((~view->Event().Flags() & flags) == flags);
  1837 
  1838 		while(view->NextL(active->iStatus))
  1839 			{
  1840 			active->StartL();
  1841 			CActiveScheduler::Start();
  1842 			TEST2(active->iStatus.Int(), KErrNone);
  1843 			TEST((~view->Event().Flags() & flags) == flags);
  1844 			}
  1845 		}
  1846 
  1847 	CleanupStack::PopAndDestroy(4); // filter, view, active, event
  1848 	}
  1849 
  1850 /**
  1851 @SYMTestCaseID          SYSLIB-LOGENG-CT-0940
  1852 @SYMTestCaseDesc	    Querying duplicate event view for flags test
  1853 @SYMTestPriority 	    High
  1854 @SYMTestActions  	    Change the log configuration.Clear the log for any recent list and add some events.Query for flags in the duplicate view list
  1855 @SYMTestExpectedResults Test must not fail
  1856 @SYMREQ                 REQ0000
  1857 */
  1858 LOCAL_C void TestDuplicateViewForFlagsL(CLogClient& aClient)
  1859 	{
  1860 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0940 "));
  1861 	CLogEvent* event = CLogEvent::NewL();
  1862 	CleanupStack::PushL(event);
  1863 
  1864 	CTestActive* active = new(ELeave)CTestActive();
  1865 	CleanupStack::PushL(active);
  1866 
  1867 	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  1868 	CleanupStack::PushL(view);
  1869 
  1870 	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  1871 	CleanupStack::PushL(duplicate);
  1872 
  1873 	CLogFilter* filter = CLogFilter::NewL();
  1874 	CleanupStack::PushL(filter);
  1875 
  1876 	// Make sure there are no entries in any recent lists
  1877 	active->StartL();
  1878 	aClient.ClearLog(KLogNullRecentList, active->iStatus);
  1879 	CActiveScheduler::Start();
  1880 	TEST2(active->iStatus.Int(), KErrNone);
  1881 
  1882 	// Make sure there are now events
  1883 	TEST(!view->SetRecentListL(KLogNullRecentList, *filter, active->iStatus));
  1884 
  1885 	// Incoming
  1886 	TLogString buf;
  1887 	aClient.GetString(buf, R_LOG_DIR_IN);
  1888 
  1889 	// Add some events
  1890 	event->SetEventType(KLogCallEventTypeUid);
  1891 	event->SetDirection(buf);
  1892 	event->SetDurationType(KLogDurationNone);
  1893 	event->SetContact(KTestContact1);
  1894 	event->SetStatus(KTestStatus1);
  1895 
  1896 	TLogFlags flags = KLogFlagsMask + 1;
  1897 	while(flags--)
  1898 		{
  1899 		event->ClearFlags(0xF);
  1900 		event->SetFlags(flags);
  1901 
  1902 		// Add event
  1903 		active->StartL();
  1904 		aClient.AddEvent(*event, active->iStatus);
  1905 		CActiveScheduler::Start();
  1906 		TEST2(active->iStatus.Int(), KErrNone);
  1907 		}
  1908 
  1909 	// Add an extra event which will be the most recent
  1910 	active->StartL();
  1911 	aClient.AddEvent(*event, active->iStatus);
  1912 	CActiveScheduler::Start();
  1913 	TEST2(active->iStatus.Int(), KErrNone);
  1914 
  1915 	active->StartL();
  1916 	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
  1917 	CActiveScheduler::Start();
  1918 	TEST2(active->iStatus.Int(), KErrNone);
  1919 	TEST2(view->CountL(), 1);
  1920 
  1921 	flags = KLogFlagsMask + 1;
  1922 	while(flags--)
  1923 		{
  1924 		filter->ClearFlags(0xF);
  1925 		filter->SetFlags(flags);
  1926 
  1927 		active->StartL();
  1928 		TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
  1929 		CActiveScheduler::Start();
  1930 		TEST2(active->iStatus.Int(), KErrNone);
  1931 		TEST((duplicate->Event().Flags() & flags) == flags);
  1932 
  1933 		while(duplicate->NextL(active->iStatus))
  1934 			{
  1935 			active->StartL();
  1936 			CActiveScheduler::Start();
  1937 			TEST2(active->iStatus.Int(), KErrNone);
  1938 			TEST((duplicate->Event().Flags() & flags) == flags);
  1939 			}
  1940 		}
  1941 	
  1942 	// Now TEST we can query for the inverse
  1943 	filter->SetNullFields(ELogFlagsField);
  1944 
  1945 	flags = KLogFlagsMask + 1;
  1946 	while(flags--)
  1947 		{
  1948 		filter->ClearFlags(0xF);
  1949 		filter->SetFlags(flags);
  1950 
  1951 		active->StartL();
  1952 		TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
  1953 		CActiveScheduler::Start();
  1954 		TEST2(active->iStatus.Int(), KErrNone);
  1955 		TEST((~duplicate->Event().Flags() & flags) == flags);
  1956 
  1957 		while(duplicate->NextL(active->iStatus))
  1958 			{
  1959 			active->StartL();
  1960 			CActiveScheduler::Start();
  1961 			TEST2(active->iStatus.Int(), KErrNone);
  1962 			TEST((~duplicate->Event().Flags() & flags) == flags);
  1963 			}
  1964 		}
  1965 
  1966 	CleanupStack::PopAndDestroy(5); // filter, duplicate, view, active, event
  1967 	}
  1968 
  1969 /**
  1970 @SYMTestCaseID          SYSLIB-LOGENG-CT-0941
  1971 @SYMTestCaseDesc	    Tests for removing recent events.Tests for CLogClient::ClearLog() function 
  1972 @SYMTestPriority 	    High
  1973 @SYMTestActions  	    Clear log for any recent entries.Add events and create the view.Test for removing the recent events from the view
  1974 @SYMTestExpectedResults Test must not fail
  1975 @SYMREQ                 REQ0000
  1976 */
  1977 LOCAL_C void TestRemovingRecentEventsL(CLogClient& aClient)
  1978 	{
  1979 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0941 "));
  1980 	CLogEvent* event = CLogEvent::NewL();
  1981 	CleanupStack::PushL(event);
  1982 
  1983 	CTestActive* active = new(ELeave)CTestActive();
  1984 	CleanupStack::PushL(active);
  1985 
  1986 	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  1987 	CleanupStack::PushL(view);
  1988 
  1989 	// Make sure there are no entries in any recent lists
  1990 	active->StartL();
  1991 	aClient.ClearLog(KLogNullRecentList, active->iStatus);
  1992 	CActiveScheduler::Start();
  1993 	TEST2(active->iStatus.Int(), KErrNone);
  1994 
  1995 	// Make sure there are no events
  1996 	TEST(!view->SetRecentListL(KLogNullRecentList, active->iStatus));
  1997 
  1998 	// Incoming
  1999 	TLogString buf;
  2000 	aClient.GetString(buf, R_LOG_DIR_IN);
  2001 
  2002 	// Add some events
  2003 	event->SetEventType(KLogCallEventTypeUid);
  2004 	event->SetDirection(buf);
  2005 
  2006 	TInt count = 10;
  2007 	while(count--)
  2008 		{
  2009 		// Add event
  2010 		active->StartL();
  2011 		aClient.AddEvent(*event, active->iStatus);
  2012 		CActiveScheduler::Start();
  2013 		TEST2(active->iStatus.Int(), KErrNone);
  2014 		}
  2015 
  2016 	// Create the view
  2017 	active->StartL();
  2018 	TEST(view->SetRecentListL(KLogNullRecentList, active->iStatus));
  2019 	CActiveScheduler::Start();
  2020 	TEST2(active->iStatus.Int(), KErrNone);
  2021 
  2022 	TLogId id = view->Event().Id();
  2023 	while(view->NextL(active->iStatus))
  2024 		{
  2025 		active->StartL();
  2026 		CActiveScheduler::Start();
  2027 		TEST2(active->iStatus.Int(), KErrNone);
  2028 
  2029 		// Try removing the previous event
  2030 		view->RemoveL(id);
  2031 		id = view->Event().Id();
  2032 		}
  2033 
  2034 	// Try removing the current event
  2035 	view->RemoveL(id);
  2036 	TEST(!view->SetRecentListL(KLogNullRecentList, active->iStatus));
  2037 
  2038 	CleanupStack::PopAndDestroy(3); // view, active, event
  2039 	}
  2040 
  2041 /**
  2042 @SYMTestCaseID          SYSLIB-LOGENG-CT-0942
  2043 @SYMTestCaseDesc	    Removing duplicate events from the duplicate view
  2044                         Tests for CLogViewRecent::DuplicatesL() function
  2045 @SYMTestPriority 	    High
  2046 @SYMTestActions  	    Clear log for any recent entries.Add events and create the view and duplicate view.
  2047 @SYMTestExpectedResults Test must not fail
  2048 @SYMREQ                 REQ0000
  2049 */
  2050 LOCAL_C void TestRemovingDuplicateEventsL(CLogClient& aClient)
  2051 	{
  2052 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0942 "));
  2053 	CLogEvent* event = CLogEvent::NewL();
  2054 	CleanupStack::PushL(event);
  2055 
  2056 	CTestActive* active = new(ELeave)CTestActive();
  2057 	CleanupStack::PushL(active);
  2058 
  2059 	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  2060 	CleanupStack::PushL(view);
  2061 
  2062 	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  2063 	CleanupStack::PushL(duplicate);
  2064 
  2065 	// Make sure there are no entries in any recent lists
  2066 	active->StartL();
  2067 	aClient.ClearLog(KLogNullRecentList, active->iStatus);
  2068 	CActiveScheduler::Start();
  2069 	TEST2(active->iStatus.Int(), KErrNone);
  2070 
  2071 	// Make sure there are no events
  2072 	TEST(!view->SetRecentListL(KLogNullRecentList, active->iStatus));
  2073 
  2074 	// Incoming
  2075 	TLogString buf;
  2076 	aClient.GetString(buf, R_LOG_DIR_IN);
  2077 
  2078 	// Add some events
  2079 	event->SetEventType(KLogCallEventTypeUid);
  2080 	event->SetDirection(buf);
  2081 	event->SetDurationType(KLogDurationNone);
  2082 	event->SetContact(KTestContact1);
  2083 	event->SetStatus(KTestStatus1);
  2084 
  2085 	TInt count = 10;
  2086 	while(count--)
  2087 		{
  2088 		// Add event
  2089 		active->StartL();
  2090 		aClient.AddEvent(*event, active->iStatus);
  2091 		CActiveScheduler::Start();
  2092 		TEST2(active->iStatus.Int(), KErrNone);
  2093 		TheTest.Printf(_L("EVENT ID: %d\n"), event->Id());
  2094 		}
  2095 
  2096 	// Create the view
  2097 	active->StartL();
  2098 	TEST(view->SetRecentListL(KLogNullRecentList, active->iStatus));
  2099 	CActiveScheduler::Start();
  2100 	TEST2(active->iStatus.Int(), KErrNone);
  2101 
  2102 	// Create the duplicate view
  2103 	active->StartL();
  2104 	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  2105 	CActiveScheduler::Start();
  2106 	TEST2(active->iStatus.Int(), KErrNone);
  2107 	TEST2(view->CountL(), 1);
  2108 	count = duplicate->CountL();
  2109 	TEST2(count, 9);
  2110 
  2111 	TLogId id = duplicate->Event().Id();
  2112 	while(duplicate->NextL(active->iStatus))
  2113 		{
  2114 		active->StartL();
  2115 		CActiveScheduler::Start();
  2116 		TEST2(active->iStatus.Int(), KErrNone);
  2117 
  2118 		// Try removing the previous event
  2119 		duplicate->RemoveL(id);
  2120 		id = duplicate->Event().Id();
  2121 		}
  2122 
  2123 	// Try removing the current event
  2124 	duplicate->RemoveL(id);
  2125 	count = duplicate->CountL();
  2126 	TEST2(count, 0);
  2127 	//
  2128 	TEST(!view->DuplicatesL(*duplicate, active->iStatus));
  2129 
  2130 	CleanupStack::PopAndDestroy(4); // duplicate, view, active, event
  2131 	}
  2132 
  2133 /**
  2134 @SYMTestCaseID          SYSLIB-LOGENG-CT-0943
  2135 s@SYMTestCaseDesc	    Multiple log event views test
  2136 @SYMTestPriority 	    High
  2137 @SYMTestActions  	    Add events and set the filter with different fields.Check for log event views
  2138 @SYMTestExpectedResults Test must not fail
  2139 @SYMREQ                 REQ0000
  2140 */
  2141 LOCAL_C void TestMultipleViews1L(CLogClient& aClient)
  2142 	{
  2143 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0943 "));
  2144 	CTestActive* active1 = new(ELeave)CTestActive;
  2145 	CleanupStack::PushL(active1);
  2146 
  2147 	// Wait a second
  2148 	User::After(1000000);
  2149 
  2150 	TTime now;
  2151 	now.UniversalTime();
  2152 	now += (TTimeIntervalDays)+1;
  2153 
  2154 	// Get rid of all the events in the log
  2155 	active1->StartL();
  2156 	aClient.ClearLog(now, active1->iStatus);
  2157 	CActiveScheduler::Start();
  2158 	TEST2(active1->iStatus.Int(), KErrNone);
  2159 
  2160 	CTestActive* active2 = new(ELeave)CTestActive;
  2161 	CleanupStack::PushL(active2);
  2162 
  2163 	CLogEvent* event = CLogEvent::NewL();
  2164 	CleanupStack::PushL(event);
  2165 
  2166 	event->SetEventType(KLogCallEventTypeUid);
  2167 	event->SetContact(KTestContact1);
  2168 	event->SetDirection(KTestDirection1);
  2169 	event->SetDurationType(KLogDurationNone);
  2170 	event->SetNumber(KTestNumber1);
  2171 	event->SetRemoteParty(KTestRemote1);
  2172 	event->SetStatus(KTestStatus1);
  2173 
  2174 	// Add event
  2175 	active1->StartL();
  2176 	aClient.AddEvent(*event, active1->iStatus);
  2177 	CActiveScheduler::Start();
  2178 	TEST2(active1->iStatus.Int(), KErrNone);
  2179 
  2180 	event->SetEventType(KLogDataEventTypeUid);
  2181 	event->SetContact(KTestContact2);
  2182 	event->SetDirection(KTestDirection2);
  2183 	event->SetDurationType(KLogDurationValid);
  2184 	event->SetNumber(KTestNumber2);
  2185 	event->SetRemoteParty(KTestRemote2);
  2186 	event->SetStatus(KTestStatus2);
  2187 
  2188 	// Add event
  2189 	active1->StartL();
  2190 	aClient.AddEvent(*event, active1->iStatus);
  2191 	CActiveScheduler::Start();
  2192 	TEST2(active1->iStatus.Int(), KErrNone);
  2193 
  2194 	event->SetEventType(KLogFaxEventTypeUid);
  2195 	event->SetContact(KTestContact3);
  2196 	event->SetDirection(KTestDirection3);
  2197 	event->SetDurationType(KLogDurationData);
  2198 	event->SetNumber(KTestNumber3);
  2199 	event->SetRemoteParty(KTestRemote3);
  2200 	event->SetStatus(KTestStatus3);
  2201 
  2202 	// Add event
  2203 	active1->StartL();
  2204 	aClient.AddEvent(*event, active1->iStatus);
  2205 	CActiveScheduler::Start();
  2206 	TEST2(active1->iStatus.Int(), KErrNone);
  2207 
  2208 	CLogFilterList* list = new(ELeave)CLogFilterList;
  2209 	CleanupStack::PushL(list);
  2210 
  2211 	CLogViewEvent* view1 = CLogViewEvent::NewL(aClient);
  2212 	CleanupStack::PushL(view1);
  2213 
  2214 	CLogViewEvent* view2 = CLogViewEvent::NewL(aClient);
  2215 	CleanupStack::PushL(view2);
  2216 
  2217 	CLogFilter* filter = CLogFilter::NewL();
  2218 	CleanupStack::PushL(filter);
  2219 	
  2220 	// Set filter
  2221 	filter->SetContact(KTestContact1);
  2222 
  2223 	list->AppendL(filter);
  2224 	CleanupStack::Pop(); // filter
  2225 
  2226 	// Test Views
  2227 	active1->StartL();
  2228 	active2->StartL();
  2229 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2230 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2231 	CActiveScheduler::Start();
  2232 	CActiveScheduler::Start();
  2233 	TEST2(view1->CountL(), 1);
  2234 	TEST2(view2->CountL(), 1);
  2235 
  2236 	filter = CLogFilter::NewL();
  2237 	CleanupStack::PushL(filter);
  2238 	
  2239 	// Set filter
  2240 	filter->SetContact(KTestContact2);
  2241 
  2242 	list->AppendL(filter);
  2243 	CleanupStack::Pop(); // filter
  2244 
  2245 	// Test View
  2246 	active1->StartL();
  2247 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2248 	CActiveScheduler::Start();
  2249 	TEST2(view1->CountL(), 2);
  2250 
  2251 	filter = CLogFilter::NewL();
  2252 	CleanupStack::PushL(filter);
  2253 	
  2254 	// Set filter
  2255 	filter->SetContact(KTestContact3);
  2256 
  2257 	list->AppendL(filter);
  2258 	CleanupStack::Pop(); // filter
  2259 
  2260 	// Test View
  2261 	active1->StartL();
  2262 	active2->StartL();
  2263 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2264 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2265 	CActiveScheduler::Start();
  2266 	CActiveScheduler::Start();
  2267 	TEST2(view1->CountL(), 3);
  2268 	TEST2(view2->CountL(), 3);
  2269 
  2270 	list->ResetAndDestroy();
  2271 
  2272 	/////////////////////////////////////////
  2273 
  2274 	filter = CLogFilter::NewL();
  2275 	CleanupStack::PushL(filter);
  2276 	
  2277 	// Set filter
  2278 	filter->SetContact(KTestContact1);
  2279 	filter->SetDirection(KTestDirection1);
  2280 
  2281 	list->AppendL(filter);
  2282 	CleanupStack::Pop(); // filter
  2283 
  2284 	// Test View
  2285 	active1->StartL();
  2286 	active2->StartL();
  2287 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2288 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2289 	CActiveScheduler::Start();
  2290 	CActiveScheduler::Start();
  2291 	TEST2(view1->CountL(), 1);
  2292 	TEST2(view2->CountL(), 1);
  2293 
  2294 	filter = CLogFilter::NewL();
  2295 	CleanupStack::PushL(filter);
  2296 	
  2297 	// Set filter
  2298 	filter->SetContact(KTestContact2);
  2299 	filter->SetDirection(KTestDirection2);
  2300 
  2301 	list->AppendL(filter);
  2302 	CleanupStack::Pop(); // filter
  2303 
  2304 	// Test View
  2305 	active1->StartL();
  2306 	active2->StartL();
  2307 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2308 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2309 	CActiveScheduler::Start();
  2310 	CActiveScheduler::Start();
  2311 	TEST2(view1->CountL(), 2);
  2312 	TEST2(view2->CountL(), 2);
  2313 
  2314 	filter = CLogFilter::NewL();
  2315 	CleanupStack::PushL(filter);
  2316 	
  2317 	// Set filter
  2318 	filter->SetContact(KTestContact3);
  2319 	filter->SetDirection(KTestDirection3);
  2320 
  2321 	list->AppendL(filter);
  2322 	CleanupStack::Pop(); // filter
  2323 
  2324 	// Test View
  2325 	active1->StartL();
  2326 	active2->StartL();
  2327 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2328 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2329 	CActiveScheduler::Start();
  2330 	CActiveScheduler::Start();
  2331 	TEST2(view1->CountL(), 3);
  2332 	TEST2(view2->CountL(), 3);
  2333 
  2334 	list->ResetAndDestroy();
  2335 
  2336 	/////////////////////////////////////////
  2337 
  2338 	filter = CLogFilter::NewL();
  2339 	CleanupStack::PushL(filter);
  2340 	
  2341 	// Set filter
  2342 	filter->SetContact(KTestContact1);
  2343 	filter->SetDirection(KTestDirection1);
  2344 	filter->SetDurationType(KLogDurationNone);
  2345 
  2346 	list->AppendL(filter);
  2347 	CleanupStack::Pop(); // filter
  2348 
  2349 	// Test View
  2350 	active1->StartL();
  2351 	active2->StartL();
  2352 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2353 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2354 	CActiveScheduler::Start();
  2355 	CActiveScheduler::Start();
  2356 	TEST2(view1->CountL(), 1);
  2357 	TEST2(view2->CountL(), 1);
  2358 
  2359 	filter = CLogFilter::NewL();
  2360 	CleanupStack::PushL(filter);
  2361 	
  2362 	// Set filter
  2363 	filter->SetContact(KTestContact2);
  2364 	filter->SetDirection(KTestDirection2);
  2365 	filter->SetDurationType(KLogDurationValid);
  2366 
  2367 	list->AppendL(filter);
  2368 	CleanupStack::Pop(); // filter
  2369 
  2370 	// Test View
  2371 	active1->StartL();
  2372 	active2->StartL();
  2373 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2374 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2375 	CActiveScheduler::Start();
  2376 	CActiveScheduler::Start();
  2377 	TEST2(view1->CountL(), 2);
  2378 	TEST2(view2->CountL(), 2);
  2379 
  2380 	filter = CLogFilter::NewL();
  2381 	CleanupStack::PushL(filter);
  2382 	
  2383 	// Set filter
  2384 	filter->SetContact(KTestContact3);
  2385 	filter->SetDirection(KTestDirection3);
  2386 	filter->SetDurationType(KLogDurationData);
  2387 
  2388 	list->AppendL(filter);
  2389 	CleanupStack::Pop(); // filter
  2390 
  2391 	// Test View
  2392 	active1->StartL();
  2393 	active2->StartL();
  2394 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2395 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2396 	CActiveScheduler::Start();
  2397 	CActiveScheduler::Start();
  2398 	TEST2(view1->CountL(), 3);
  2399 	TEST2(view2->CountL(), 3);
  2400 
  2401 	list->ResetAndDestroy();
  2402 
  2403 	/////////////////////////////////////////
  2404 
  2405 	filter = CLogFilter::NewL();
  2406 	CleanupStack::PushL(filter);
  2407 	
  2408 	// Set filter
  2409 	filter->SetContact(KTestContact1);
  2410 	filter->SetDirection(KTestDirection1);
  2411 	filter->SetDurationType(KLogDurationNone);
  2412 	filter->SetEventType(KLogCallEventTypeUid);
  2413 
  2414 	list->AppendL(filter);
  2415 	CleanupStack::Pop(); // filter
  2416 
  2417 	// Test View
  2418 	active1->StartL();
  2419 	active2->StartL();
  2420 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2421 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2422 	CActiveScheduler::Start();
  2423 	CActiveScheduler::Start();
  2424 	TEST2(view1->CountL(), 1);
  2425 	TEST2(view2->CountL(), 1);
  2426 
  2427 	filter = CLogFilter::NewL();
  2428 	CleanupStack::PushL(filter);
  2429 	
  2430 	// Set filter
  2431 	filter->SetContact(KTestContact2);
  2432 	filter->SetDirection(KTestDirection2);
  2433 	filter->SetDurationType(KLogDurationValid);
  2434 	filter->SetEventType(KLogDataEventTypeUid);
  2435 
  2436 	list->AppendL(filter);
  2437 	CleanupStack::Pop(); // filter
  2438 
  2439 	// Test View
  2440 	active1->StartL();
  2441 	active2->StartL();
  2442 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2443 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2444 	CActiveScheduler::Start();
  2445 	CActiveScheduler::Start();
  2446 	TEST2(view1->CountL(), 2);
  2447 	TEST2(view2->CountL(), 2);
  2448 
  2449 	filter = CLogFilter::NewL();
  2450 	CleanupStack::PushL(filter);
  2451 	
  2452 	// Set filter
  2453 	filter->SetContact(KTestContact3);
  2454 	filter->SetDirection(KTestDirection3);
  2455 	filter->SetDurationType(KLogDurationData);
  2456 	filter->SetEventType(KLogFaxEventTypeUid);
  2457 
  2458 	list->AppendL(filter);
  2459 	CleanupStack::Pop(); // filter
  2460 
  2461 	// Test View
  2462 	active1->StartL();
  2463 	active2->StartL();
  2464 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2465 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2466 	CActiveScheduler::Start();
  2467 	CActiveScheduler::Start();
  2468 	TEST2(view1->CountL(), 3);
  2469 	TEST2(view2->CountL(), 3);
  2470 
  2471 	list->ResetAndDestroy();
  2472 
  2473 	/////////////////////////////////////////
  2474 
  2475 	filter = CLogFilter::NewL();
  2476 	CleanupStack::PushL(filter);
  2477 	
  2478 	// Set filter
  2479 	filter->SetContact(KTestContact1);
  2480 	filter->SetDirection(KTestDirection1);
  2481 	filter->SetDurationType(KLogDurationNone);
  2482 	filter->SetEventType(KLogCallEventTypeUid);
  2483 	filter->SetNumber(KTestNumber1);
  2484 
  2485 	list->AppendL(filter);
  2486 	CleanupStack::Pop(); // filter
  2487 
  2488 	// Test View
  2489 	active1->StartL();
  2490 	active2->StartL();
  2491 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2492 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2493 	CActiveScheduler::Start();
  2494 	CActiveScheduler::Start();
  2495 	TEST2(view1->CountL(), 1);
  2496 	TEST2(view2->CountL(), 1);
  2497 
  2498 	filter = CLogFilter::NewL();
  2499 	CleanupStack::PushL(filter);
  2500 	
  2501 	// Set filter
  2502 	filter->SetContact(KTestContact2);
  2503 	filter->SetDirection(KTestDirection2);
  2504 	filter->SetDurationType(KLogDurationValid);
  2505 	filter->SetEventType(KLogDataEventTypeUid);
  2506 	filter->SetNumber(KTestNumber2);
  2507 
  2508 	list->AppendL(filter);
  2509 	CleanupStack::Pop(); // filter
  2510 
  2511 	// Test View
  2512 	active1->StartL();
  2513 	active2->StartL();
  2514 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2515 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2516 	CActiveScheduler::Start();
  2517 	CActiveScheduler::Start();
  2518 	TEST2(view1->CountL(), 2);
  2519 	TEST2(view2->CountL(), 2);
  2520 
  2521 	filter = CLogFilter::NewL();
  2522 	CleanupStack::PushL(filter);
  2523 	
  2524 	// Set filter
  2525 	filter->SetContact(KTestContact3);
  2526 	filter->SetDirection(KTestDirection3);
  2527 	filter->SetDurationType(KLogDurationData);
  2528 	filter->SetEventType(KLogFaxEventTypeUid);
  2529 	filter->SetNumber(KTestNumber3);
  2530 
  2531 	list->AppendL(filter);
  2532 	CleanupStack::Pop(); // filter
  2533 
  2534 	// Test View
  2535 	active1->StartL();
  2536 	active2->StartL();
  2537 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2538 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2539 	CActiveScheduler::Start();
  2540 	CActiveScheduler::Start();
  2541 	TEST2(view1->CountL(), 3);
  2542 	TEST2(view2->CountL(), 3);
  2543 
  2544 	list->ResetAndDestroy();
  2545 
  2546 	/////////////////////////////////////////
  2547 
  2548 	filter = CLogFilter::NewL();
  2549 	CleanupStack::PushL(filter);
  2550 	
  2551 	// Set filter
  2552 	filter->SetContact(KTestContact1);
  2553 	filter->SetDirection(KTestDirection1);
  2554 	filter->SetDurationType(KLogDurationNone);
  2555 	filter->SetEventType(KLogCallEventTypeUid);
  2556 	filter->SetNumber(KTestNumber1);
  2557 	filter->SetRemoteParty(KTestRemote1);
  2558 
  2559 	list->AppendL(filter);
  2560 	CleanupStack::Pop(); // filter
  2561 
  2562 	// Test View
  2563 	active1->StartL();
  2564 	active2->StartL();
  2565 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2566 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2567 	CActiveScheduler::Start();
  2568 	CActiveScheduler::Start();
  2569 	TEST2(view1->CountL(), 1);
  2570 	TEST2(view2->CountL(), 1);
  2571 
  2572 	filter = CLogFilter::NewL();
  2573 	CleanupStack::PushL(filter);
  2574 	
  2575 	// Set filter
  2576 	filter->SetContact(KTestContact2);
  2577 	filter->SetDirection(KTestDirection2);
  2578 	filter->SetDurationType(KLogDurationValid);
  2579 	filter->SetEventType(KLogDataEventTypeUid);
  2580 	filter->SetNumber(KTestNumber2);
  2581 	filter->SetRemoteParty(KTestRemote2);
  2582 
  2583 	list->AppendL(filter);
  2584 	CleanupStack::Pop(); // filter
  2585 
  2586 	// Test View
  2587 	active1->StartL();
  2588 	active2->StartL();
  2589 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2590 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2591 	CActiveScheduler::Start();
  2592 	CActiveScheduler::Start();
  2593 	TEST2(view1->CountL(), 2);
  2594 	TEST2(view2->CountL(), 2);
  2595 
  2596 	filter = CLogFilter::NewL();
  2597 	CleanupStack::PushL(filter);
  2598 	
  2599 	// Set filter
  2600 	filter->SetContact(KTestContact3);
  2601 	filter->SetDirection(KTestDirection3);
  2602 	filter->SetDurationType(KLogDurationData);
  2603 	filter->SetEventType(KLogFaxEventTypeUid);
  2604 	filter->SetNumber(KTestNumber3);
  2605 	filter->SetRemoteParty(KTestRemote3);
  2606 
  2607 	list->AppendL(filter);
  2608 	CleanupStack::Pop(); // filter
  2609 
  2610 	// Test View
  2611 	active1->StartL();
  2612 	active2->StartL();
  2613 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2614 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2615 	CActiveScheduler::Start();
  2616 	CActiveScheduler::Start();
  2617 	TEST2(view1->CountL(), 3);
  2618 	TEST2(view2->CountL(), 3);
  2619 
  2620 	list->ResetAndDestroy();
  2621 
  2622 	/////////////////////////////////////////
  2623 
  2624 	filter = CLogFilter::NewL();
  2625 	CleanupStack::PushL(filter);
  2626 	
  2627 	// Set filter
  2628 	filter->SetContact(KTestContact1);
  2629 	filter->SetDirection(KTestDirection1);
  2630 	filter->SetDurationType(KLogDurationNone);
  2631 	filter->SetEventType(KLogCallEventTypeUid);
  2632 	filter->SetNumber(KTestNumber1);
  2633 	filter->SetRemoteParty(KTestRemote1);
  2634 	filter->SetStatus(KTestStatus1);
  2635 
  2636 	list->AppendL(filter);
  2637 	CleanupStack::Pop(); // filter
  2638 
  2639 	// Test View
  2640 	active1->StartL();
  2641 	active2->StartL();
  2642 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2643 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2644 	CActiveScheduler::Start();
  2645 	CActiveScheduler::Start();
  2646 	TEST2(view1->CountL(), 1);
  2647 	TEST2(view2->CountL(), 1);
  2648 
  2649 	filter = CLogFilter::NewL();
  2650 	CleanupStack::PushL(filter);
  2651 	
  2652 	// Set filter
  2653 	filter->SetContact(KTestContact2);
  2654 	filter->SetDirection(KTestDirection2);
  2655 	filter->SetDurationType(KLogDurationValid);
  2656 	filter->SetEventType(KLogDataEventTypeUid);
  2657 	filter->SetNumber(KTestNumber2);
  2658 	filter->SetRemoteParty(KTestRemote2);
  2659 	filter->SetStatus(KTestStatus2);
  2660 
  2661 	list->AppendL(filter);
  2662 	CleanupStack::Pop(); // filter
  2663 
  2664 	// Test View
  2665 	active1->StartL();
  2666 	active2->StartL();
  2667 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2668 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2669 	CActiveScheduler::Start();
  2670 	CActiveScheduler::Start();
  2671 	TEST2(view1->CountL(), 2);
  2672 	TEST2(view2->CountL(), 2);
  2673 
  2674 	filter = CLogFilter::NewL();
  2675 	CleanupStack::PushL(filter);
  2676 	
  2677 	// Set filter
  2678 	filter->SetContact(KTestContact3);
  2679 	filter->SetDirection(KTestDirection3);
  2680 	filter->SetDurationType(KLogDurationData);
  2681 	filter->SetEventType(KLogFaxEventTypeUid);
  2682 	filter->SetNumber(KTestNumber3);
  2683 	filter->SetRemoteParty(KTestRemote3);
  2684 	filter->SetStatus(KTestStatus3);
  2685 
  2686 	list->AppendL(filter);
  2687 	CleanupStack::Pop(); // filter
  2688 
  2689 	// Test View
  2690 	active1->StartL();
  2691 	active2->StartL();
  2692 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2693 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2694 	CActiveScheduler::Start();
  2695 	CActiveScheduler::Start();
  2696 	TEST2(view1->CountL(), 3);
  2697 	TEST2(view2->CountL(), 3);
  2698 
  2699 	list->ResetAndDestroy();
  2700 
  2701 	CleanupStack::PopAndDestroy(6); // list, view1, view2, event, active1, active2
  2702 	}
  2703 
  2704 /**
  2705 @SYMTestCaseID          SYSLIB-LOGENG-CT-0944
  2706 @SYMTestCaseDesc	    Multiple log event views test
  2707 @SYMTestPriority 	    High
  2708 @SYMTestActions  	    Add events and set the filter with different fields.
  2709 						Check for log event views and the test for the count of events
  2710 @SYMTestExpectedResults Test must not fail
  2711 @SYMREQ                 REQ0000
  2712 */
  2713 LOCAL_C void TestMultipleViews2L(CLogClient& aClient)
  2714 	{
  2715 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0944 "));
  2716 	CTestActive* active1 = new(ELeave)CTestActive;
  2717 	CleanupStack::PushL(active1);
  2718 
  2719 	// Wait a second
  2720 	User::After(1000000);
  2721 
  2722 	TTime now;
  2723 	now.UniversalTime();
  2724 	now += (TTimeIntervalDays)+1;
  2725 
  2726 	// Get rid of all the events in the log
  2727 	active1->StartL();
  2728 	aClient.ClearLog(now, active1->iStatus);
  2729 	CActiveScheduler::Start();
  2730 	TEST2(active1->iStatus.Int(), KErrNone);
  2731 
  2732 	CTestActive* active2 = new(ELeave)CTestActive;
  2733 	CleanupStack::PushL(active2);
  2734 
  2735 	CLogEvent* event = CLogEvent::NewL();
  2736 	CleanupStack::PushL(event);
  2737 
  2738 	event->SetEventType(KLogCallEventTypeUid);
  2739 	event->SetContact(KTestContact1);
  2740 	event->SetDirection(KTestDirection1);
  2741 	event->SetDurationType(KLogDurationNone);
  2742 	event->SetNumber(KTestNumber1);
  2743 	event->SetRemoteParty(KTestRemote1);
  2744 	event->SetStatus(KTestStatus1);
  2745 
  2746 	// Add event
  2747 	active1->StartL();
  2748 	aClient.AddEvent(*event, active1->iStatus);
  2749 	CActiveScheduler::Start();
  2750 	TEST2(active1->iStatus.Int(), KErrNone);
  2751 
  2752 	event->SetEventType(KLogDataEventTypeUid);
  2753 	event->SetContact(KTestContact2);
  2754 	event->SetDirection(KTestDirection2);
  2755 	event->SetDurationType(KLogDurationValid);
  2756 	event->SetNumber(KTestNumber2);
  2757 	event->SetRemoteParty(KTestRemote2);
  2758 	event->SetStatus(KTestStatus2);
  2759 
  2760 	// Add event
  2761 	active1->StartL();
  2762 	aClient.AddEvent(*event, active1->iStatus);
  2763 	CActiveScheduler::Start();
  2764 	TEST2(active1->iStatus.Int(), KErrNone);
  2765 
  2766 	event->SetEventType(KLogFaxEventTypeUid);
  2767 	event->SetContact(KTestContact3);
  2768 	event->SetDirection(KTestDirection3);
  2769 	event->SetDurationType(KLogDurationData);
  2770 	event->SetNumber(KTestNumber3);
  2771 	event->SetRemoteParty(KTestRemote3);
  2772 	event->SetStatus(KTestStatus3);
  2773 
  2774 	// Add event
  2775 	active1->StartL();
  2776 	aClient.AddEvent(*event, active1->iStatus);
  2777 	CActiveScheduler::Start();
  2778 	TEST2(active1->iStatus.Int(), KErrNone);
  2779 
  2780 	CLogFilterList* list = new(ELeave)CLogFilterList;
  2781 	CleanupStack::PushL(list);
  2782 
  2783 	CLogViewEvent* view1 = CLogViewEvent::NewL(aClient);
  2784 	CleanupStack::PushL(view1);
  2785 
  2786 	CLogClient* client2 = CLogClient::NewL(theFs);
  2787 	CleanupStack::PushL(client2);
  2788 
  2789 	CLogViewEvent* view2 = CLogViewEvent::NewL(*client2);
  2790 	CleanupStack::PushL(view2);
  2791 
  2792 	CLogFilter* filter = CLogFilter::NewL();
  2793 	CleanupStack::PushL(filter);
  2794 	
  2795 	// Set filter
  2796 	filter->SetContact(KTestContact1);
  2797 
  2798 	list->AppendL(filter);
  2799 	CleanupStack::Pop(); // filter
  2800 
  2801 	// Test Views
  2802 	active1->StartL();
  2803 	active2->StartL();
  2804 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2805 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2806 	CActiveScheduler::Start();
  2807 	CActiveScheduler::Start();
  2808 	TEST2(view1->CountL(), 1);
  2809 	TEST2(view2->CountL(), 1);
  2810 
  2811 	filter = CLogFilter::NewL();
  2812 	CleanupStack::PushL(filter);
  2813 	
  2814 	// Set filter
  2815 	filter->SetContact(KTestContact2);
  2816 
  2817 	list->AppendL(filter);
  2818 	CleanupStack::Pop(); // filter
  2819 
  2820 	// Test View
  2821 	active1->StartL();
  2822 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2823 	CActiveScheduler::Start();
  2824 	TEST2(view1->CountL(), 2);
  2825 
  2826 	filter = CLogFilter::NewL();
  2827 	CleanupStack::PushL(filter);
  2828 	
  2829 	// Set filter
  2830 	filter->SetContact(KTestContact3);
  2831 
  2832 	list->AppendL(filter);
  2833 	CleanupStack::Pop(); // filter
  2834 
  2835 	// Test View
  2836 	active1->StartL();
  2837 	active2->StartL();
  2838 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2839 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2840 	CActiveScheduler::Start();
  2841 	CActiveScheduler::Start();
  2842 	TEST2(view1->CountL(), 3);
  2843 	TEST2(view2->CountL(), 3);
  2844 
  2845 	list->ResetAndDestroy();
  2846 
  2847 	/////////////////////////////////////////
  2848 
  2849 	filter = CLogFilter::NewL();
  2850 	CleanupStack::PushL(filter);
  2851 	
  2852 	// Set filter
  2853 	filter->SetContact(KTestContact1);
  2854 	filter->SetDirection(KTestDirection1);
  2855 
  2856 	list->AppendL(filter);
  2857 	CleanupStack::Pop(); // filter
  2858 
  2859 	// Test View
  2860 	active1->StartL();
  2861 	active2->StartL();
  2862 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2863 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2864 	CActiveScheduler::Start();
  2865 	CActiveScheduler::Start();
  2866 	TEST2(view1->CountL(), 1);
  2867 	TEST2(view2->CountL(), 1);
  2868 
  2869 	filter = CLogFilter::NewL();
  2870 	CleanupStack::PushL(filter);
  2871 	
  2872 	// Set filter
  2873 	filter->SetContact(KTestContact2);
  2874 	filter->SetDirection(KTestDirection2);
  2875 
  2876 	list->AppendL(filter);
  2877 	CleanupStack::Pop(); // filter
  2878 
  2879 	// Test View
  2880 	active1->StartL();
  2881 	active2->StartL();
  2882 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2883 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2884 	CActiveScheduler::Start();
  2885 	CActiveScheduler::Start();
  2886 	TEST2(view1->CountL(), 2);
  2887 	TEST2(view2->CountL(), 2);
  2888 
  2889 	filter = CLogFilter::NewL();
  2890 	CleanupStack::PushL(filter);
  2891 	
  2892 	// Set filter
  2893 	filter->SetContact(KTestContact3);
  2894 	filter->SetDirection(KTestDirection3);
  2895 
  2896 	list->AppendL(filter);
  2897 	CleanupStack::Pop(); // filter
  2898 
  2899 	// Test View
  2900 	active1->StartL();
  2901 	active2->StartL();
  2902 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2903 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2904 	CActiveScheduler::Start();
  2905 	CActiveScheduler::Start();
  2906 	TEST2(view1->CountL(), 3);
  2907 	TEST2(view2->CountL(), 3);
  2908 
  2909 	list->ResetAndDestroy();
  2910 
  2911 	/////////////////////////////////////////
  2912 
  2913 	filter = CLogFilter::NewL();
  2914 	CleanupStack::PushL(filter);
  2915 	
  2916 	// Set filter
  2917 	filter->SetContact(KTestContact1);
  2918 	filter->SetDirection(KTestDirection1);
  2919 	filter->SetDurationType(KLogDurationNone);
  2920 
  2921 	list->AppendL(filter);
  2922 	CleanupStack::Pop(); // filter
  2923 
  2924 	// Test View
  2925 	active1->StartL();
  2926 	active2->StartL();
  2927 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2928 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2929 	CActiveScheduler::Start();
  2930 	CActiveScheduler::Start();
  2931 	TEST2(view1->CountL(), 1);
  2932 	TEST2(view2->CountL(), 1);
  2933 
  2934 	filter = CLogFilter::NewL();
  2935 	CleanupStack::PushL(filter);
  2936 	
  2937 	// Set filter
  2938 	filter->SetContact(KTestContact2);
  2939 	filter->SetDirection(KTestDirection2);
  2940 	filter->SetDurationType(KLogDurationValid);
  2941 
  2942 	list->AppendL(filter);
  2943 	CleanupStack::Pop(); // filter
  2944 
  2945 	// Test View
  2946 	active1->StartL();
  2947 	active2->StartL();
  2948 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2949 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2950 	CActiveScheduler::Start();
  2951 	CActiveScheduler::Start();
  2952 	TEST2(view1->CountL(), 2);
  2953 	TEST2(view2->CountL(), 2);
  2954 
  2955 	filter = CLogFilter::NewL();
  2956 	CleanupStack::PushL(filter);
  2957 	
  2958 	// Set filter
  2959 	filter->SetContact(KTestContact3);
  2960 	filter->SetDirection(KTestDirection3);
  2961 	filter->SetDurationType(KLogDurationData);
  2962 
  2963 	list->AppendL(filter);
  2964 	CleanupStack::Pop(); // filter
  2965 
  2966 	// Test View
  2967 	active1->StartL();
  2968 	active2->StartL();
  2969 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2970 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2971 	CActiveScheduler::Start();
  2972 	CActiveScheduler::Start();
  2973 	TEST2(view1->CountL(), 3);
  2974 	TEST2(view2->CountL(), 3);
  2975 
  2976 	list->ResetAndDestroy();
  2977 
  2978 	/////////////////////////////////////////
  2979 
  2980 	filter = CLogFilter::NewL();
  2981 	CleanupStack::PushL(filter);
  2982 	
  2983 	// Set filter
  2984 	filter->SetContact(KTestContact1);
  2985 	filter->SetDirection(KTestDirection1);
  2986 	filter->SetDurationType(KLogDurationNone);
  2987 	filter->SetEventType(KLogCallEventTypeUid);
  2988 
  2989 	list->AppendL(filter);
  2990 	CleanupStack::Pop(); // filter
  2991 
  2992 	// Test View
  2993 	active1->StartL();
  2994 	active2->StartL();
  2995 	TEST(view1->SetFilterL(*list, active1->iStatus));
  2996 	TEST(view2->SetFilterL(*list, active2->iStatus));
  2997 	CActiveScheduler::Start();
  2998 	CActiveScheduler::Start();
  2999 	TEST2(view1->CountL(), 1);
  3000 	TEST2(view2->CountL(), 1);
  3001 
  3002 	filter = CLogFilter::NewL();
  3003 	CleanupStack::PushL(filter);
  3004 	
  3005 	// Set filter
  3006 	filter->SetContact(KTestContact2);
  3007 	filter->SetDirection(KTestDirection2);
  3008 	filter->SetDurationType(KLogDurationValid);
  3009 	filter->SetEventType(KLogDataEventTypeUid);
  3010 
  3011 	list->AppendL(filter);
  3012 	CleanupStack::Pop(); // filter
  3013 
  3014 	// Test View
  3015 	active1->StartL();
  3016 	active2->StartL();
  3017 	TEST(view1->SetFilterL(*list, active1->iStatus));
  3018 	TEST(view2->SetFilterL(*list, active2->iStatus));
  3019 	CActiveScheduler::Start();
  3020 	CActiveScheduler::Start();
  3021 	TEST2(view1->CountL(), 2);
  3022 	TEST2(view2->CountL(), 2);
  3023 
  3024 	filter = CLogFilter::NewL();
  3025 	CleanupStack::PushL(filter);
  3026 	
  3027 	// Set filter
  3028 	filter->SetContact(KTestContact3);
  3029 	filter->SetDirection(KTestDirection3);
  3030 	filter->SetDurationType(KLogDurationData);
  3031 	filter->SetEventType(KLogFaxEventTypeUid);
  3032 
  3033 	list->AppendL(filter);
  3034 	CleanupStack::Pop(); // filter
  3035 
  3036 	// Test View
  3037 	active1->StartL();
  3038 	active2->StartL();
  3039 	TEST(view1->SetFilterL(*list, active1->iStatus));
  3040 	TEST(view2->SetFilterL(*list, active2->iStatus));
  3041 	CActiveScheduler::Start();
  3042 	CActiveScheduler::Start();
  3043 	TEST2(view1->CountL(), 3);
  3044 	TEST2(view2->CountL(), 3);
  3045 
  3046 	list->ResetAndDestroy();
  3047 
  3048 	/////////////////////////////////////////
  3049 
  3050 	filter = CLogFilter::NewL();
  3051 	CleanupStack::PushL(filter);
  3052 	
  3053 	// Set filter
  3054 	filter->SetContact(KTestContact1);
  3055 	filter->SetDirection(KTestDirection1);
  3056 	filter->SetDurationType(KLogDurationNone);
  3057 	filter->SetEventType(KLogCallEventTypeUid);
  3058 	filter->SetNumber(KTestNumber1);
  3059 
  3060 	list->AppendL(filter);
  3061 	CleanupStack::Pop(); // filter
  3062 
  3063 	// Test View
  3064 	active1->StartL();
  3065 	active2->StartL();
  3066 	TEST(view1->SetFilterL(*list, active1->iStatus));
  3067 	TEST(view2->SetFilterL(*list, active2->iStatus));
  3068 	CActiveScheduler::Start();
  3069 	CActiveScheduler::Start();
  3070 	TEST2(view1->CountL(), 1);
  3071 	TEST2(view2->CountL(), 1);
  3072 
  3073 	filter = CLogFilter::NewL();
  3074 	CleanupStack::PushL(filter);
  3075 	
  3076 	// Set filter
  3077 	filter->SetContact(KTestContact2);
  3078 	filter->SetDirection(KTestDirection2);
  3079 	filter->SetDurationType(KLogDurationValid);
  3080 	filter->SetEventType(KLogDataEventTypeUid);
  3081 	filter->SetNumber(KTestNumber2);
  3082 
  3083 	list->AppendL(filter);
  3084 	CleanupStack::Pop(); // filter
  3085 
  3086 	// Test View
  3087 	active1->StartL();
  3088 	active2->StartL();
  3089 	TEST(view1->SetFilterL(*list, active1->iStatus));
  3090 	TEST(view2->SetFilterL(*list, active2->iStatus));
  3091 	CActiveScheduler::Start();
  3092 	CActiveScheduler::Start();
  3093 	TEST2(view1->CountL(), 2);
  3094 	TEST2(view2->CountL(), 2);
  3095 
  3096 	filter = CLogFilter::NewL();
  3097 	CleanupStack::PushL(filter);
  3098 	
  3099 	// Set filter
  3100 	filter->SetContact(KTestContact3);
  3101 	filter->SetDirection(KTestDirection3);
  3102 	filter->SetDurationType(KLogDurationData);
  3103 	filter->SetEventType(KLogFaxEventTypeUid);
  3104 	filter->SetNumber(KTestNumber3);
  3105 
  3106 	list->AppendL(filter);
  3107 	CleanupStack::Pop(); // filter
  3108 
  3109 	// Test View
  3110 	active1->StartL();
  3111 	active2->StartL();
  3112 	TEST(view1->SetFilterL(*list, active1->iStatus));
  3113 	TEST(view2->SetFilterL(*list, active2->iStatus));
  3114 	CActiveScheduler::Start();
  3115 	CActiveScheduler::Start();
  3116 	TEST2(view1->CountL(), 3);
  3117 	TEST2(view2->CountL(), 3);
  3118 
  3119 	list->ResetAndDestroy();
  3120 
  3121 	/////////////////////////////////////////
  3122 
  3123 	filter = CLogFilter::NewL();
  3124 	CleanupStack::PushL(filter);
  3125 	
  3126 	// Set filter
  3127 	filter->SetContact(KTestContact1);
  3128 	filter->SetDirection(KTestDirection1);
  3129 	filter->SetDurationType(KLogDurationNone);
  3130 	filter->SetEventType(KLogCallEventTypeUid);
  3131 	filter->SetNumber(KTestNumber1);
  3132 	filter->SetRemoteParty(KTestRemote1);
  3133 
  3134 	list->AppendL(filter);
  3135 	CleanupStack::Pop(); // filter
  3136 
  3137 	// Test View
  3138 	active1->StartL();
  3139 	active2->StartL();
  3140 	TEST(view1->SetFilterL(*list, active1->iStatus));
  3141 	TEST(view2->SetFilterL(*list, active2->iStatus));
  3142 	CActiveScheduler::Start();
  3143 	CActiveScheduler::Start();
  3144 	TEST2(view1->CountL(), 1);
  3145 	TEST2(view2->CountL(), 1);
  3146 
  3147 	filter = CLogFilter::NewL();
  3148 	CleanupStack::PushL(filter);
  3149 	
  3150 	// Set filter
  3151 	filter->SetContact(KTestContact2);
  3152 	filter->SetDirection(KTestDirection2);
  3153 	filter->SetDurationType(KLogDurationValid);
  3154 	filter->SetEventType(KLogDataEventTypeUid);
  3155 	filter->SetNumber(KTestNumber2);
  3156 	filter->SetRemoteParty(KTestRemote2);
  3157 
  3158 	list->AppendL(filter);
  3159 	CleanupStack::Pop(); // filter
  3160 
  3161 	// Test View
  3162 	active1->StartL();
  3163 	active2->StartL();
  3164 	TEST(view1->SetFilterL(*list, active1->iStatus));
  3165 	TEST(view2->SetFilterL(*list, active2->iStatus));
  3166 	CActiveScheduler::Start();
  3167 	CActiveScheduler::Start();
  3168 	TEST2(view1->CountL(), 2);
  3169 	TEST2(view2->CountL(), 2);
  3170 
  3171 	filter = CLogFilter::NewL();
  3172 	CleanupStack::PushL(filter);
  3173 	
  3174 	// Set filter
  3175 	filter->SetContact(KTestContact3);
  3176 	filter->SetDirection(KTestDirection3);
  3177 	filter->SetDurationType(KLogDurationData);
  3178 	filter->SetEventType(KLogFaxEventTypeUid);
  3179 	filter->SetNumber(KTestNumber3);
  3180 	filter->SetRemoteParty(KTestRemote3);
  3181 
  3182 	list->AppendL(filter);
  3183 	CleanupStack::Pop(); // filter
  3184 
  3185 	// Test View
  3186 	active1->StartL();
  3187 	active2->StartL();
  3188 	TEST(view1->SetFilterL(*list, active1->iStatus));
  3189 	TEST(view2->SetFilterL(*list, active2->iStatus));
  3190 	CActiveScheduler::Start();
  3191 	CActiveScheduler::Start();
  3192 	TEST2(view1->CountL(), 3);
  3193 	TEST2(view2->CountL(), 3);
  3194 
  3195 	list->ResetAndDestroy();
  3196 
  3197 	/////////////////////////////////////////
  3198 
  3199 	filter = CLogFilter::NewL();
  3200 	CleanupStack::PushL(filter);
  3201 	
  3202 	// Set filter
  3203 	filter->SetContact(KTestContact1);
  3204 	filter->SetDirection(KTestDirection1);
  3205 	filter->SetDurationType(KLogDurationNone);
  3206 	filter->SetEventType(KLogCallEventTypeUid);
  3207 	filter->SetNumber(KTestNumber1);
  3208 	filter->SetRemoteParty(KTestRemote1);
  3209 	filter->SetStatus(KTestStatus1);
  3210 
  3211 	list->AppendL(filter);
  3212 	CleanupStack::Pop(); // filter
  3213 
  3214 	// Test View
  3215 	active1->StartL();
  3216 	active2->StartL();
  3217 	TEST(view1->SetFilterL(*list, active1->iStatus));
  3218 	TEST(view2->SetFilterL(*list, active2->iStatus));
  3219 	CActiveScheduler::Start();
  3220 	CActiveScheduler::Start();
  3221 	TEST2(view1->CountL(), 1);
  3222 	TEST2(view2->CountL(), 1);
  3223 
  3224 	filter = CLogFilter::NewL();
  3225 	CleanupStack::PushL(filter);
  3226 	
  3227 	// Set filter
  3228 	filter->SetContact(KTestContact2);
  3229 	filter->SetDirection(KTestDirection2);
  3230 	filter->SetDurationType(KLogDurationValid);
  3231 	filter->SetEventType(KLogDataEventTypeUid);
  3232 	filter->SetNumber(KTestNumber2);
  3233 	filter->SetRemoteParty(KTestRemote2);
  3234 	filter->SetStatus(KTestStatus2);
  3235 
  3236 	list->AppendL(filter);
  3237 	CleanupStack::Pop(); // filter
  3238 
  3239 	// Test View
  3240 	active1->StartL();
  3241 	active2->StartL();
  3242 	TEST(view1->SetFilterL(*list, active1->iStatus));
  3243 	TEST(view2->SetFilterL(*list, active2->iStatus));
  3244 	CActiveScheduler::Start();
  3245 	CActiveScheduler::Start();
  3246 	TEST2(view1->CountL(), 2);
  3247 	TEST2(view2->CountL(), 2);
  3248 
  3249 	filter = CLogFilter::NewL();
  3250 	CleanupStack::PushL(filter);
  3251 	
  3252 	// Set filter
  3253 	filter->SetContact(KTestContact3);
  3254 	filter->SetDirection(KTestDirection3);
  3255 	filter->SetDurationType(KLogDurationData);
  3256 	filter->SetEventType(KLogFaxEventTypeUid);
  3257 	filter->SetNumber(KTestNumber3);
  3258 	filter->SetRemoteParty(KTestRemote3);
  3259 	filter->SetStatus(KTestStatus3);
  3260 
  3261 	list->AppendL(filter);
  3262 	CleanupStack::Pop(); // filter
  3263 
  3264 	// Test View
  3265 	active1->StartL();
  3266 	active2->StartL();
  3267 	TEST(view1->SetFilterL(*list, active1->iStatus));
  3268 	TEST(view2->SetFilterL(*list, active2->iStatus));
  3269 	CActiveScheduler::Start();
  3270 	CActiveScheduler::Start();
  3271 	TEST2(view1->CountL(), 3);
  3272 	TEST2(view2->CountL(), 3);
  3273 
  3274 	list->ResetAndDestroy();
  3275 
  3276 	CleanupStack::PopAndDestroy(7); // list, view1, view2, client2, event, active1, active2
  3277 	}
  3278 
  3279 /**
  3280 @SYMTestCaseID          SYSLIB-LOGENG-CT-0945
  3281 @SYMTestCaseDesc	    Tests for notification on changes done to the view
  3282                         Tests for CLogViewChangeObserver::iStatus 
  3283 @SYMTestPriority 	    High
  3284 @SYMTestActions  	    Tests for setting a filter on the view.Check for receiving notifications on adding events to the view
  3285 @SYMTestExpectedResults Test must not fail
  3286 @SYMREQ                 REQ0000
  3287 */
  3288 LOCAL_C void TestViewChangeEventsL(CLogClient& aClient)
  3289 	{
  3290 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0945 "));
  3291 	TestUtils::DeleteDatabaseL();
  3292 
  3293 	CLogEvent* event = CLogEvent::NewL();
  3294 	CleanupStack::PushL(event);
  3295 	event->SetEventType(KLogCallEventTypeUid);
  3296 
  3297 	CTestActive* active = new(ELeave) CTestActive();
  3298 	CleanupStack::PushL(active);
  3299 
  3300 	CLogViewChangeObserver* changeObs = CLogViewChangeObserver::NewLC();
  3301 
  3302 	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs);
  3303 	CleanupStack::PushL(view);
  3304 
  3305 	CLogFilter* filter = CLogFilter::NewL();
  3306 	CleanupStack::PushL(filter);
  3307 	TEST(!view->SetFilterL(*filter, active->iStatus));
  3308 
  3309 	// Add some events and check we receive change notifications
  3310 	TInt count;
  3311 	TLogId logId;
  3312 	TInt viewIndex;
  3313 	//
  3314 	for(count = 0; count < KTestEventNum; count++)
  3315 		{
  3316 		aClient.AddEvent(*event, changeObs->iStatus);
  3317 		CLogChangeDefinition* changes = changeObs->WaitForChangesLC(CLogViewChangeObserver::EStopOnBoth);
  3318 		TEST2(changeObs->iStatus.Int(), KErrNone);
  3319 		TEST(event->Id() == (TLogId) count);
  3320 		//
  3321 		User::After(1);
  3322 		//
  3323 		TEST2(changes->Count(), 1);
  3324 		TEST2(changes->At(0, logId, viewIndex), ELogChangeTypeEventAdded);
  3325 		TEST(logId == (TLogId) count);
  3326 		TEST2(viewIndex, 0);
  3327 		CleanupStack::PopAndDestroy(changes);
  3328 		}
  3329 
  3330 	CleanupStack::PopAndDestroy(5, event); // filter, view, changeObs, active, event
  3331 	}
  3332 
  3333 /**
  3334 @SYMTestCaseID          SYSLIB-LOGENG-CT-0946
  3335 @SYMTestCaseDesc	    Tests for events in the recent view list 
  3336 @SYMTestPriority 	    High
  3337 @SYMTestActions  	    Tests for events in the recent view list after setting the filters for incoming,outgoing and missed calls
  3338 @SYMTestExpectedResults Test must not fail
  3339 @SYMREQ                 REQ0000
  3340 */
  3341 LOCAL_C void TestAltEventsInRecentListL(CLogClient& aClient)
  3342 	{
  3343 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0946 "));
  3344 	CLogEvent* event = CLogEvent::NewL();
  3345 	CleanupStack::PushL(event);
  3346 
  3347 	CTestActive* active = new(ELeave)CTestActive();
  3348 	CleanupStack::PushL(active);
  3349 
  3350 	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  3351 	CleanupStack::PushL(view);
  3352 
  3353 	// Clear recent lists
  3354 	active->StartL();
  3355 	aClient.ClearLog(KLogNullRecentList, active->iStatus);
  3356 	CActiveScheduler::Start();
  3357 	TEST2(active->iStatus.Int(), KErrNone);
  3358 
  3359 	TLogString buf;
  3360 	event->SetEventType(KLogCallEventTypeUid);
  3361 	
  3362 	// Add Incoming events
  3363 	aClient.GetString(buf, R_LOG_DIR_IN);	
  3364 	event->SetDirection(buf);
  3365 	event->SetContact(1);
  3366 	active->StartL();
  3367 	aClient.AddEvent(*event, active->iStatus);
  3368 	CActiveScheduler::Start();
  3369 	TEST2(active->iStatus.Int(), KErrNone);	
  3370 	aClient.GetString(buf, R_LOG_DIR_IN_ALT);
  3371 	event->SetDirection(buf);
  3372 	event->SetContact(2);
  3373 	active->StartL();
  3374 	aClient.AddEvent(*event, active->iStatus);
  3375 	CActiveScheduler::Start();
  3376 	TEST2(active->iStatus.Int(), KErrNone);
  3377 	// Verify both events in recent list
  3378 	active->StartL();
  3379 	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  3380 	CActiveScheduler::Start();
  3381 	TEST2(active->iStatus.Int(), KErrNone);  
  3382 	TEST2(view->CountL(), 2);
  3383 
  3384 	// Add Outgoing events
  3385 	aClient.GetString(buf, R_LOG_DIR_OUT);
  3386 	event->SetDirection(buf);
  3387 	event->SetContact(3);
  3388 	active->StartL();
  3389 	aClient.AddEvent(*event, active->iStatus);
  3390 	CActiveScheduler::Start();
  3391 	TEST2(active->iStatus.Int(), KErrNone);
  3392 	aClient.GetString(buf, R_LOG_DIR_OUT_ALT);
  3393 	event->SetDirection(buf);
  3394 	event->SetContact(4);
  3395 	active->StartL();
  3396 	aClient.AddEvent(*event, active->iStatus);
  3397 	CActiveScheduler::Start();
  3398 	TEST2(active->iStatus.Int(), KErrNone);
  3399 	// Verify both events in recent list
  3400 	active->StartL();
  3401 	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
  3402 	CActiveScheduler::Start();
  3403 	TEST2(active->iStatus.Int(), KErrNone);
  3404 	TEST2(view->CountL(), 2);
  3405 
  3406 	// Add Missed events
  3407 	aClient.GetString(buf, R_LOG_DIR_MISSED);
  3408 	event->SetDirection(buf);
  3409 	event->SetContact(5);
  3410 	active->StartL();
  3411 	aClient.AddEvent(*event, active->iStatus);
  3412 	CActiveScheduler::Start();
  3413 	TEST2(active->iStatus.Int(), KErrNone);
  3414 	aClient.GetString(buf, R_LOG_DIR_MISSED_ALT);
  3415 	event->SetDirection(buf);
  3416 	event->SetContact(6);
  3417 	active->StartL();
  3418 	aClient.AddEvent(*event, active->iStatus);
  3419 	CActiveScheduler::Start();
  3420 	TEST2(active->iStatus.Int(), KErrNone);
  3421 	// Verify both events in recent list
  3422 	active->StartL();
  3423 	TEST(view->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  3424 	CActiveScheduler::Start();
  3425 	TEST2(active->iStatus.Int(), KErrNone);
  3426 	TEST2(view->CountL(), 2);
  3427 
  3428 	CleanupStack::PopAndDestroy(3); // view, active, event, 
  3429 	}
  3430 
  3431 /**
  3432 @SYMTestCaseID          SYSLIB-LOGENG-CT-0947
  3433 @SYMTestCaseDesc	    Tests for view with filter by time 
  3434 @SYMTestPriority 	    High
  3435 @SYMTestActions  	    Tests for view with filters set by different time
  3436 @SYMTestExpectedResults Test must not fail
  3437 @SYMREQ                 REQ0000
  3438 */
  3439 LOCAL_C void TestFilterByTimeL(CLogClient& aClient)
  3440 	{
  3441 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0947 "));
  3442 	CLogEvent* event = CLogEvent::NewL();
  3443 	CleanupStack::PushL(event);
  3444 
  3445 	CTestActive* active = new(ELeave)CTestActive();
  3446 	CleanupStack::PushL(active);
  3447 
  3448 	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  3449 	CleanupStack::PushL(view);
  3450 
  3451 	// Clear recent lists
  3452 	active->StartL();
  3453 	aClient.ClearLog(KLogNullRecentList, active->iStatus);
  3454 	CActiveScheduler::Start();
  3455 	TEST2(active->iStatus.Int(), KErrNone);
  3456 
  3457 	event->SetEventType(KLogCallEventTypeUid);
  3458 	TLogString buf;
  3459 	aClient.GetString(buf, R_LOG_DIR_IN);	
  3460 	event->SetDirection(buf);
  3461 	
  3462 	// add first event (events following are added on successive days)
  3463 	event->SetContact(1);  // ensures events are not duplicates
  3464 	active->StartL();
  3465 	aClient.AddEvent(*event, active->iStatus);
  3466 	CActiveScheduler::Start();
  3467 	TEST2(active->iStatus.Int(), KErrNone);		
  3468 
  3469 	TTime systemTime;
  3470 	systemTime.UniversalTime();
  3471 
  3472 	// set filter startDate
  3473 	TTime startDate = systemTime + (TTimeIntervalHours)+1;
  3474 
  3475 	// add event 2	
  3476 	systemTime += (TTimeIntervalDays)+1;
  3477 	event->SetContact(2);
  3478 	active->StartL();
  3479 	aClient.AddEvent(*event, active->iStatus);
  3480 	CActiveScheduler::Start();
  3481 	TEST2(active->iStatus.Int(), KErrNone);	
  3482 
  3483 	event->SetTime(systemTime);
  3484 	active->StartL();
  3485 	aClient.ChangeEvent(*event, active->iStatus);
  3486 	CActiveScheduler::Start();
  3487 	TEST2(active->iStatus.Int(), KErrNone);
  3488 	
  3489 	// add event 3
  3490 	systemTime += (TTimeIntervalDays)+1;
  3491 	event->SetContact(3);
  3492 	active->StartL();
  3493 	aClient.AddEvent(*event, active->iStatus);
  3494 	CActiveScheduler::Start();
  3495 	TEST2(active->iStatus.Int(), KErrNone);
  3496 
  3497 	event->SetTime(systemTime);
  3498 	active->StartL();
  3499 	aClient.ChangeEvent(*event, active->iStatus);
  3500 	CActiveScheduler::Start();
  3501 	TEST2(active->iStatus.Int(), KErrNone);
  3502 
  3503 	// set filter endDate 
  3504 	TTime endDate = systemTime + (TTimeIntervalHours)+1;
  3505 
  3506 	// add event 4
  3507 	systemTime += (TTimeIntervalDays)+1;
  3508 	event->SetContact(4);
  3509 	active->StartL();
  3510 	aClient.AddEvent(*event, active->iStatus);
  3511 	CActiveScheduler::Start();
  3512 	TEST2(active->iStatus.Int(), KErrNone);
  3513 
  3514 	event->SetTime(systemTime);
  3515 	active->StartL();
  3516 	aClient.ChangeEvent(*event, active->iStatus);
  3517 	CActiveScheduler::Start();
  3518 	TEST2(active->iStatus.Int(), KErrNone);
  3519 
  3520 	CLogFilter* filter = CLogFilter::NewL();
  3521 	CleanupStack::PushL(filter);
  3522 	
  3523 	// check using both start and end
  3524 	filter->SetStartTime(startDate);	
  3525 	filter->SetEndTime(endDate);		
  3526 	active->StartL();
  3527 	TEST(view->SetRecentListL(KLogNullRecentList, *filter, active->iStatus));
  3528 	CActiveScheduler::Start();
  3529 	TEST2(active->iStatus.Int(), KErrNone);  
  3530 	TEST2(view->CountL(), 2); 
  3531 
  3532 	//  only end filter
  3533 	filter->SetStartTime(TTime(0));	// reset	
  3534 	filter->SetEndTime(endDate);		
  3535 	active->StartL();
  3536 	TEST(view->SetRecentListL(KLogNullRecentList, *filter, active->iStatus));
  3537 	CActiveScheduler::Start();
  3538 	TEST2(active->iStatus.Int(), KErrNone);  
  3539 	TEST2(view->CountL(), 3); 
  3540 
  3541 	//  only start filter
  3542 	filter->SetStartTime(startDate); 
  3543 	filter->SetEndTime(TTime(0));		
  3544 	active->StartL();
  3545 	TEST(view->SetRecentListL(KLogNullRecentList, *filter, active->iStatus));
  3546 	CActiveScheduler::Start();
  3547 	TEST2(active->iStatus.Int(), KErrNone);  
  3548 	TEST2(view->CountL(), 3); 	
  3549 
  3550 	//  no time filter
  3551 	filter->SetStartTime(TTime(0)); 
  3552 	filter->SetEndTime(TTime(0));		
  3553 	active->StartL();
  3554 	TEST(view->SetRecentListL(KLogNullRecentList, *filter, active->iStatus));
  3555 	CActiveScheduler::Start();
  3556 	TEST2(active->iStatus.Int(), KErrNone);  
  3557 	TEST2(view->CountL(), 4); 	
  3558 
  3559 	CleanupStack::PopAndDestroy(4); // view, active, event, filter 
  3560 	}
  3561 
  3562 /**
  3563 @SYMTestCaseID          SYSLIB-LOGENG-CT-0948
  3564 @SYMTestCaseDesc	    Tests for log view change observer
  3565 @SYMTestPriority 	    High
  3566 @SYMTestActions  	    Check that a view doesn't get change events for duplicates
  3567 @SYMTestExpectedResults Test must not fail
  3568 @SYMREQ                 REQ0000
  3569 */
  3570 LOCAL_C void TestHiddenChangeEvents1L(CLogClient& aClient)
  3571 	{
  3572 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0948 "));
  3573 	TLogId logId;
  3574 	TInt viewIndex;
  3575 	TLogDatabaseChangeType type;
  3576 
  3577 	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  3578 	changeObs1->StartCollectingChanges();
  3579 
  3580 
  3581 	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  3582 	CleanupStack::PushL(view);
  3583 
  3584 	CLogFilter* filter = CLogFilter::NewL();
  3585 	CleanupStack::PushL(filter);
  3586 
  3587 	CLogEvent* event = CLogEvent::NewL();
  3588 	CleanupStack::PushL(event);
  3589 
  3590 	CTestActive* active = new(ELeave)CTestActive();
  3591 	CleanupStack::PushL(active);
  3592 
  3593 	TTime now;
  3594 	now.UniversalTime();
  3595 	now += (TTimeIntervalDays)+1;
  3596 
  3597 	// Get rid of all the events in the log
  3598 	active->StartL();
  3599 	aClient.ClearLog(now, active->iStatus);
  3600 	CActiveScheduler::Start();
  3601 	TEST2(active->iStatus.Int(), KErrNone);
  3602 
  3603 	// Incoming call event
  3604 	event->SetEventType(KLogCallEventTypeUid);
  3605 	TBuf<KLogMaxDirectionLength> buf;
  3606 	aClient.GetString(buf, R_LOG_DIR_IN);
  3607 	event->SetDirection(buf);
  3608 
  3609 	// Add an event
  3610 	active->StartL();
  3611 	aClient.AddEvent(*event, active->iStatus);
  3612 	CActiveScheduler::Start();
  3613 	TEST2(active->iStatus.Int(), KErrNone);
  3614 
  3615 	// Setup normal event view
  3616 	active->StartL();
  3617 	TEST(view->SetFilterL(*filter, active->iStatus));
  3618 	CActiveScheduler::Start();
  3619 	TEST2(active->iStatus.Int(), KErrNone);
  3620 
  3621 	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  3622 	changeObs2->StartCollectingChanges();
  3623 
  3624 	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  3625 	CleanupStack::PushL(recent);
  3626 
  3627 	// Check recent view
  3628 	active->StartL();
  3629 	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  3630 	CActiveScheduler::Start();
  3631 	TEST2(active->iStatus.Int(), KErrNone);
  3632 	TEST2(recent->CountL(), 1);
  3633 
  3634 	// Add a new event
  3635 	active->StartL();
  3636 	aClient.AddEvent(*event, active->iStatus);
  3637 	CActiveScheduler::Start();
  3638 	TEST2(active->iStatus.Int(), KErrNone);
  3639 
  3640 	// Check change events
  3641 	CTestTimer* timer = CTestTimer::NewL();
  3642 	timer->After(100000);
  3643 	CActiveScheduler::Start();
  3644 	delete timer;
  3645 	
  3646 	TEST2(changeObs2->Changes().Count(), 2);
  3647 	type = changeObs2->Changes().At(0, logId, viewIndex);
  3648 	TEST2(type, ELogChangeTypeEventAdded);
  3649 	type = changeObs2->Changes().At(1, logId, viewIndex);
  3650 	TEST2(type, ELogChangeTypeEventDeleted);
  3651 
  3652 	// Check recent view
  3653 	active->StartL();
  3654 	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  3655 	CActiveScheduler::Start();
  3656 	TEST2(active->iStatus.Int(), KErrNone);
  3657 	TEST2(recent->CountL(), 1);
  3658 
  3659 	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  3660 	CleanupStack::PushL(duplicate);
  3661 
  3662 	// Check duplicate count
  3663 	active->StartL();
  3664 	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
  3665 	CActiveScheduler::Start();
  3666 	TEST2(active->iStatus.Int(), KErrNone);
  3667 	TEST2(duplicate->CountL(), 1);
  3668 
  3669 	// Check change events
  3670 	User::After(100000);
  3671 	TEST2(changeObs1->Changes().Count(), 1);
  3672 	type = changeObs1->Changes().At(0, logId, viewIndex);
  3673 	TEST2(type, ELogChangeTypeEventAdded);
  3674 
  3675 	CleanupStack::PopAndDestroy(8); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
  3676 	}
  3677 
  3678 /**
  3679 @SYMTestCaseID          SYSLIB-LOGENG-CT-0949
  3680 @SYMTestCaseDesc	    Tests for log view change observer
  3681 @SYMTestPriority 	    High
  3682 @SYMTestActions  	    Check that a view doesn't get change events when recent list purged
  3683 @SYMTestExpectedResults Test must not fail
  3684 @SYMREQ                 REQ0000
  3685 */
  3686 LOCAL_C void TestHiddenChangeEvents2L(CLogClient& aClient)
  3687 	{
  3688 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0949 "));
  3689 	TLogId logId;
  3690 	TInt viewIndex;
  3691 	TLogDatabaseChangeType type;
  3692 
  3693 	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  3694 	changeObs1->StartCollectingChanges();
  3695 
  3696 	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  3697 	CleanupStack::PushL(view);
  3698 
  3699 	CLogFilter* filter = CLogFilter::NewL();
  3700 	CleanupStack::PushL(filter);
  3701 
  3702 	CLogEvent* event = CLogEvent::NewL();
  3703 	CleanupStack::PushL(event);
  3704 
  3705 	CTestActive* active = new(ELeave)CTestActive();
  3706 	CleanupStack::PushL(active);
  3707 
  3708 	TTime now;
  3709 	now.UniversalTime();
  3710 	now += (TTimeIntervalDays)+1;
  3711 
  3712 	// Get rid of all the events in the log
  3713 	active->StartL();
  3714 	aClient.ClearLog(now, active->iStatus);
  3715 	CActiveScheduler::Start();
  3716 	TEST2(active->iStatus.Int(), KErrNone);
  3717 
  3718 	// Get config
  3719 	TLogConfig config;
  3720 	active->StartL();
  3721 	aClient.GetConfig(config, active->iStatus);
  3722 	CActiveScheduler::Start();
  3723 	TEST2(active->iStatus.Int(), KErrNone);
  3724 
  3725 	// Incoming call event
  3726 	event->SetEventType(KLogCallEventTypeUid);
  3727 	TBuf<KLogMaxDirectionLength> buf;
  3728 	aClient.GetString(buf, R_LOG_DIR_IN);
  3729 	event->SetDirection(buf);
  3730 
  3731 	// Add max allowed events
  3732 	TInt count = config.iMaxRecentLogSize;
  3733 	while(count--)
  3734 		{
  3735 		event->SetContact(count+1);
  3736 		active->StartL();
  3737 		aClient.AddEvent(*event, active->iStatus);
  3738 		CActiveScheduler::Start();
  3739 		TEST2(active->iStatus.Int(), KErrNone);
  3740 		}
  3741 
  3742 	// Setup normal event view
  3743 	active->StartL();
  3744 	TEST(view->SetFilterL(*filter, active->iStatus));
  3745 	CActiveScheduler::Start();
  3746 	TEST2(active->iStatus.Int(), KErrNone);
  3747 
  3748 	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  3749 	changeObs2->StartCollectingChanges();
  3750 
  3751 	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  3752 	CleanupStack::PushL(recent);
  3753 
  3754 	// Check recent view
  3755 	active->StartL();
  3756 	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  3757 	CActiveScheduler::Start();
  3758 	TEST2(active->iStatus.Int(), KErrNone);
  3759 	TEST2(recent->CountL(), config.iMaxRecentLogSize);
  3760 
  3761 	// Add a new event, will cause one to be purged from recent view
  3762 	event->SetContact(1234);
  3763 	active->StartL();
  3764 	aClient.AddEvent(*event, active->iStatus);
  3765 	CActiveScheduler::Start();
  3766 	TEST2(active->iStatus.Int(), KErrNone);
  3767 
  3768 	// Check change events
  3769 	CTestTimer *timer = CTestTimer::NewL();
  3770  	timer->After(100000);
  3771  	CActiveScheduler::Start();
  3772  	delete timer;
  3773 		
  3774 	TEST2(changeObs2->Changes().Count(), 2);
  3775 	type = changeObs2->Changes().At(0, logId, viewIndex);
  3776 	TEST2(type, ELogChangeTypeEventAdded);
  3777 	type = changeObs2->Changes().At(1, logId, viewIndex);
  3778 	TEST2(type, ELogChangeTypeEventDeleted);
  3779 
  3780 	// Check recent view
  3781 	active->StartL();
  3782 	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  3783 	CActiveScheduler::Start();
  3784 	TEST2(active->iStatus.Int(), KErrNone);
  3785 	TEST2(recent->CountL(), config.iMaxRecentLogSize);
  3786 
  3787 	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  3788 	CleanupStack::PushL(duplicate);
  3789 
  3790 	// Check duplicate count
  3791 	TEST(!recent->DuplicatesL(*duplicate, active->iStatus));
  3792 
  3793 	// Check change events
  3794 	User::After(100000);
  3795 	TEST2(changeObs1->Changes().Count(), 1);
  3796 	type = changeObs1->Changes().At(0, logId, viewIndex);
  3797 	TEST2(type, ELogChangeTypeEventAdded);
  3798 
  3799 	CleanupStack::PopAndDestroy(8); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
  3800 	}
  3801 /**
  3802 @SYMTestCaseID          SYSLIB-LOGENG-CT-0950
  3803 @SYMTestCaseDesc	    Tests for log view change observer
  3804 @SYMTestPriority 	    High
  3805 @SYMTestActions  	    Check that a view doesn't get change events when recent list purged after changing config
  3806 @SYMTestExpectedResults Test must not fail
  3807 @SYMREQ                 REQ0000
  3808 */
  3809 LOCAL_C void TestHiddenChangeEvents3L(CLogClient& aClient)
  3810 	{
  3811 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0950 "));
  3812 	TLogId logId;
  3813 	TInt viewIndex;
  3814 	TLogDatabaseChangeType type;
  3815 
  3816 	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  3817 	changeObs1->StartCollectingChanges();
  3818 
  3819 	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  3820 	CleanupStack::PushL(view);
  3821 
  3822 	CLogFilter* filter = CLogFilter::NewL();
  3823 	CleanupStack::PushL(filter);
  3824 
  3825 	CLogEvent* event = CLogEvent::NewL();
  3826 	CleanupStack::PushL(event);
  3827 
  3828 	CTestActive* active = new(ELeave)CTestActive();
  3829 	CleanupStack::PushL(active);
  3830 
  3831 	TTime now;
  3832 	now.UniversalTime();
  3833 	now += (TTimeIntervalDays)+1;
  3834 
  3835 	// Get rid of all the events in the log
  3836 	active->StartL();
  3837 	aClient.ClearLog(now, active->iStatus);
  3838 	CActiveScheduler::Start();
  3839 	TEST2(active->iStatus.Int(), KErrNone);
  3840 
  3841 	// Get and set config
  3842 	TLogConfig config;
  3843 	active->StartL();
  3844 	aClient.GetConfig(config, active->iStatus);
  3845 	CActiveScheduler::Start();
  3846 	TEST2(active->iStatus.Int(), KErrNone);
  3847 	config.iMaxRecentLogSize = 2;
  3848 	active->StartL();
  3849 	aClient.ChangeConfig(config, active->iStatus);
  3850 	CActiveScheduler::Start();
  3851 	TEST2(active->iStatus.Int(), KErrNone);
  3852 
  3853 	// Incoming call event
  3854 	event->SetEventType(KLogCallEventTypeUid);
  3855 	TBuf<KLogMaxDirectionLength> buf;
  3856 	aClient.GetString(buf, R_LOG_DIR_IN);
  3857 	event->SetDirection(buf);
  3858 
  3859 	// Add max allowed events
  3860 	TInt count = config.iMaxRecentLogSize;
  3861 	while(count--)
  3862 		{
  3863 		event->SetContact(count+1);
  3864 		active->StartL();
  3865 		aClient.AddEvent(*event, active->iStatus);
  3866 		CActiveScheduler::Start();
  3867 		TEST2(active->iStatus.Int(), KErrNone);
  3868 		}
  3869 
  3870 	// Setup normal event view
  3871 	active->StartL();
  3872 	TEST(view->SetFilterL(*filter, active->iStatus));
  3873 	CActiveScheduler::Start();
  3874 	TEST2(active->iStatus.Int(), KErrNone);
  3875 
  3876 	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  3877 	changeObs2->StartCollectingChanges();
  3878 
  3879 	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  3880 	CleanupStack::PushL(recent);
  3881 
  3882 	// Check recent view
  3883 	active->StartL();
  3884 	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  3885 	CActiveScheduler::Start();
  3886 	TEST2(active->iStatus.Int(), KErrNone);
  3887 	TEST2(recent->CountL(), config.iMaxRecentLogSize);
  3888 
  3889 	// Change config, will cause one event to be purged from recent view
  3890 	config.iMaxRecentLogSize = 1;
  3891 	active->StartL();
  3892 	aClient.ChangeConfig(config, active->iStatus);
  3893 	CActiveScheduler::Start();
  3894 	TEST2(active->iStatus.Int(), KErrNone);
  3895 
  3896 	// Check change events
  3897 	User::After(100000);
  3898 	TEST2(changeObs2->Changes().Count(), 1);
  3899 	type = changeObs2->Changes().At(0, logId, viewIndex);
  3900 	TEST2(type, ELogChangeTypeEventDeleted);
  3901 
  3902 	// Check recent view
  3903 	active->StartL();
  3904 	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  3905 	CActiveScheduler::Start();
  3906 	TEST2(active->iStatus.Int(), KErrNone);
  3907 	TEST2(recent->CountL(), config.iMaxRecentLogSize);
  3908 
  3909 	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  3910 	CleanupStack::PushL(duplicate);
  3911 
  3912 	// Check duplicate count
  3913 	TEST(!recent->DuplicatesL(*duplicate, active->iStatus));
  3914 
  3915 	// Check change events
  3916 	User::After(100000);
  3917 	TEST(!changeObs1->HaveChanges());
  3918 
  3919 	CleanupStack::PopAndDestroy(8); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
  3920 	}
  3921 
  3922 /**
  3923 @SYMTestCaseID          SYSLIB-LOGENG-CT-0951
  3924 @SYMTestCaseDesc	    Test for log view change observer
  3925 @SYMTestPriority 	    High
  3926 @SYMTestActions  	    Check that when deleting an event causing recent lists to be updated,views don't get unnecessary change events
  3927 @SYMTestExpectedResults Test must not fail
  3928 @SYMREQ                 REQ0000
  3929 */
  3930 LOCAL_C void TestHiddenChangeEvents4L(CLogClient& aClient)
  3931 	{
  3932 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0951 "));
  3933 	TLogId logId;
  3934 	TInt viewIndex;
  3935 	TLogDatabaseChangeType type;
  3936 
  3937 	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  3938 	changeObs1->StartCollectingChanges();
  3939 
  3940 	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  3941 	CleanupStack::PushL(view);
  3942 
  3943 	CLogFilter* filter = CLogFilter::NewL();
  3944 	CleanupStack::PushL(filter);
  3945 	filter->SetFlags(1); // Need to hide an event from the view
  3946 
  3947 	CLogEvent* event = CLogEvent::NewL();
  3948 	CleanupStack::PushL(event);
  3949 
  3950 	CTestActive* active = new(ELeave)CTestActive();
  3951 	CleanupStack::PushL(active);
  3952 
  3953 	TTime now;
  3954 	now.UniversalTime();
  3955 	now += (TTimeIntervalDays)+1;
  3956 
  3957 	// Get rid of all the events in the log
  3958 	active->StartL();
  3959 	aClient.ClearLog(now, active->iStatus);
  3960 	CActiveScheduler::Start();
  3961 	TEST2(active->iStatus.Int(), KErrNone);
  3962 
  3963 	// Incoming call event
  3964 	event->SetEventType(KLogCallEventTypeUid);
  3965 	TBuf<KLogMaxDirectionLength> buf;
  3966 	aClient.GetString(buf, R_LOG_DIR_IN);
  3967 	event->SetDirection(buf);
  3968 
  3969 	event->SetFlags(1);
  3970 
  3971 	// Add an event
  3972 	active->StartL();
  3973 	aClient.AddEvent(*event, active->iStatus);
  3974 	CActiveScheduler::Start();
  3975 	TEST2(active->iStatus.Int(), KErrNone);
  3976 
  3977 	// Add an event
  3978 	active->StartL();
  3979 	aClient.AddEvent(*event, active->iStatus);
  3980 	CActiveScheduler::Start();
  3981 	TEST2(active->iStatus.Int(), KErrNone);
  3982 
  3983 	event->ClearFlags(0xF);
  3984 
  3985 	// Add an event
  3986 	active->StartL();
  3987 	aClient.AddEvent(*event, active->iStatus);
  3988 	CActiveScheduler::Start();
  3989 	TEST2(active->iStatus.Int(), KErrNone);
  3990 
  3991 	// Setup normal event view
  3992 	active->StartL();
  3993 	TEST(view->SetFilterL(*filter, active->iStatus));
  3994 	CActiveScheduler::Start();
  3995 	TEST2(active->iStatus.Int(), KErrNone);
  3996 	TEST2(view->CountL(), 2);
  3997 
  3998 	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  3999 	changeObs2->StartCollectingChanges();
  4000 
  4001 	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  4002 	CleanupStack::PushL(recent);
  4003 
  4004 	// Check recent view
  4005 	active->StartL();
  4006 	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  4007 	CActiveScheduler::Start();
  4008 	TEST2(active->iStatus.Int(), KErrNone);
  4009 	TEST2(recent->CountL(), 1);
  4010 
  4011 	changeObs1->StartCollectingChanges();
  4012 	changeObs2->StartCollectingChanges();
  4013 
  4014 	// Delete the event in recent list
  4015 	active->StartL();
  4016 	aClient.DeleteEvent(event->Id(), active->iStatus);
  4017 	CActiveScheduler::Start();
  4018 	TEST2(active->iStatus.Int(), KErrNone);
  4019 
  4020 	// Check change events
  4021 	User::After(1000000);
  4022 	TEST2(changeObs2->Changes().Count(), 2);
  4023 	type = changeObs2->Changes().At(0, logId, viewIndex);
  4024 	TEST2(type, ELogChangeTypeEventAdded);
  4025 	type = changeObs2->Changes().At(1, logId, viewIndex);
  4026 	TEST2(type, ELogChangeTypeEventDeleted);
  4027 
  4028 	TEST(!changeObs1->HaveChanges());
  4029 
  4030 	CleanupStack::PopAndDestroy(7); // changeObs1, changeObs2, view, filter, event, active, recent
  4031 	}
  4032 
  4033 /**
  4034 @SYMTestCaseID          SYSLIB-LOGENG-CT-0952
  4035 @SYMTestCaseDesc	    Tests for log view change observer
  4036 @SYMTestPriority 	    High
  4037 @SYMTestActions  	    Check that a view doesn't get change events when recent list cleared
  4038 @SYMTestExpectedResults Test must not fail
  4039 @SYMREQ                 REQ0000
  4040 */
  4041 LOCAL_C void TestHiddenChangeEvents5L(CLogClient& aClient)
  4042 	{
  4043 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0952 "));
  4044 	TLogId logId;
  4045 	TInt viewIndex;
  4046 	TLogDatabaseChangeType type;
  4047 
  4048 	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  4049 	changeObs1->StartCollectingChanges();
  4050 
  4051 	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  4052 	CleanupStack::PushL(view);
  4053 
  4054 	CLogFilter* filter = CLogFilter::NewL();
  4055 	CleanupStack::PushL(filter);
  4056 
  4057 	CLogEvent* event = CLogEvent::NewL();
  4058 	CleanupStack::PushL(event);
  4059 
  4060 	CTestActive* active = new(ELeave)CTestActive();
  4061 	CleanupStack::PushL(active);
  4062 
  4063 	TTime now;
  4064 	now.UniversalTime();
  4065 	now += (TTimeIntervalDays)+1;
  4066 
  4067 	// Get rid of all the events in the log
  4068 	active->StartL();
  4069 	aClient.ClearLog(now, active->iStatus);
  4070 	CActiveScheduler::Start();
  4071 	TEST2(active->iStatus.Int(), KErrNone);
  4072 
  4073 	// Get config
  4074 	TLogConfig config;
  4075 	active->StartL();
  4076 	aClient.GetConfig(config, active->iStatus);
  4077 	CActiveScheduler::Start();
  4078 	TEST2(active->iStatus.Int(), KErrNone);
  4079 
  4080 	// Incoming call event
  4081 	event->SetEventType(KLogCallEventTypeUid);
  4082 	TBuf<KLogMaxDirectionLength> buf;
  4083 	aClient.GetString(buf, R_LOG_DIR_IN);
  4084 	event->SetDirection(buf);
  4085 
  4086 	// Add max allowed events
  4087 	TInt count = config.iMaxRecentLogSize;
  4088 	while(count--)
  4089 		{
  4090 		event->SetContact(count+1);
  4091 		active->StartL();
  4092 		aClient.AddEvent(*event, active->iStatus);
  4093 		CActiveScheduler::Start();
  4094 		TEST2(active->iStatus.Int(), KErrNone);
  4095 		}
  4096 
  4097 	// Setup normal event view
  4098 	active->StartL();
  4099 	TEST(view->SetFilterL(*filter, active->iStatus));
  4100 	CActiveScheduler::Start();
  4101 	TEST2(active->iStatus.Int(), KErrNone);
  4102 
  4103 	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  4104 	changeObs2->StartCollectingChanges();
  4105 
  4106 	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  4107 	CleanupStack::PushL(recent);
  4108 
  4109 	// Check recent view
  4110 	active->StartL();
  4111 	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  4112 	CActiveScheduler::Start();
  4113 	TEST2(active->iStatus.Int(), KErrNone);
  4114 	TEST2(recent->CountL(), config.iMaxRecentLogSize);
  4115 
  4116 	// Clear recent view
  4117 	active->StartL();
  4118 	aClient.ClearLog(KLogRecentIncomingCalls, active->iStatus);
  4119 	CActiveScheduler::Start();
  4120 	TEST2(active->iStatus.Int(), KErrNone);
  4121 
  4122 	// Check change events
  4123 	User::After(100000);
  4124 
  4125 	count = config.iMaxRecentLogSize;
  4126 	TEST2(changeObs2->Changes().Count(), count);
  4127 	while(count--)
  4128 		{
  4129 		type = changeObs2->Changes().At(count, logId, viewIndex);
  4130 		TEST2(type, ELogChangeTypeEventDeleted);
  4131 		}
  4132 
  4133 	// Check recent view
  4134 	TEST(!recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  4135 
  4136 	// Check change events
  4137 	User::After(100000);
  4138 	TEST(!changeObs1->HaveChanges());
  4139 
  4140 	CleanupStack::PopAndDestroy(7); // changeObs1, changeObs2, view, filter, event, active, recent
  4141 	}
  4142 
  4143 /**
  4144 @SYMTestCaseID          SYSLIB-LOGENG-CT-0953
  4145 @SYMTestCaseDesc	    Tests for log view change observer
  4146 @SYMTestPriority 	    High
  4147 @SYMTestActions  	    Check that a view doesn't get change events when removing events from a recent or duplicate view
  4148 @SYMTestExpectedResults Test must not fail
  4149 @SYMREQ                 REQ0000
  4150 */
  4151 LOCAL_C void TestHiddenChangeEvents6L(CLogClient& aClient)
  4152 	{
  4153 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0953 "));
  4154 	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  4155 	changeObs1->StartCollectingChanges();
  4156 
  4157 	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  4158 	CleanupStack::PushL(view);
  4159 
  4160 	CLogFilter* filter = CLogFilter::NewL();
  4161 	CleanupStack::PushL(filter);
  4162 
  4163 	CLogEvent* event = CLogEvent::NewL();
  4164 	CleanupStack::PushL(event);
  4165 
  4166 	CTestActive* active = new(ELeave)CTestActive();
  4167 	CleanupStack::PushL(active);
  4168 
  4169 	TTime now;
  4170 	now.UniversalTime();
  4171 	now += (TTimeIntervalDays)+1;
  4172 
  4173 	// Get rid of all the events in the log
  4174 	active->StartL();
  4175 	aClient.ClearLog(now, active->iStatus);
  4176 	CActiveScheduler::Start();
  4177 	TEST2(active->iStatus.Int(), KErrNone);
  4178 
  4179 	// Incoming call event
  4180 	event->SetEventType(KLogCallEventTypeUid);
  4181 	TBuf<KLogMaxDirectionLength> buf;
  4182 	aClient.GetString(buf, R_LOG_DIR_IN);
  4183 	event->SetDirection(buf);
  4184 
  4185 	// Add an event
  4186 	active->StartL();
  4187 	aClient.AddEvent(*event, active->iStatus);
  4188 	CActiveScheduler::Start();
  4189 	TEST2(active->iStatus.Int(), KErrNone);
  4190 
  4191 	// Add a duplicate
  4192 	active->StartL();
  4193 	aClient.AddEvent(*event, active->iStatus);
  4194 	CActiveScheduler::Start();
  4195 	TEST2(active->iStatus.Int(), KErrNone);
  4196 
  4197 	// Setup normal event view
  4198 	active->StartL();
  4199 	TEST(view->SetFilterL(*filter, active->iStatus));
  4200 	CActiveScheduler::Start();
  4201 	TEST2(active->iStatus.Int(), KErrNone);
  4202 	TEST2(view->CountL(), 2);
  4203 
  4204 	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  4205 	changeObs2->StartCollectingChanges();
  4206 
  4207 	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  4208 	CleanupStack::PushL(recent);
  4209 
  4210 	// Check recent view
  4211 	active->StartL();
  4212 	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  4213 	CActiveScheduler::Start();
  4214 	TEST2(active->iStatus.Int(), KErrNone);
  4215 	TEST2(recent->CountL(), 1);
  4216 
  4217 	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  4218 	CleanupStack::PushL(duplicate);
  4219 
  4220 	// Check duplicate count
  4221 	active->StartL();
  4222 	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
  4223 	CActiveScheduler::Start();
  4224 	TEST2(active->iStatus.Int(), KErrNone);
  4225 	TEST2(recent->CountL(), 1);
  4226 
  4227 	// Remove duplicate
  4228 	duplicate->RemoveL(duplicate->Event().Id());
  4229 
  4230 	CTestTimer* timer = CTestTimer::NewL();
  4231 	CleanupStack::PushL(timer);
  4232 	timer->After(100000);
  4233 	CActiveScheduler::Start();
  4234 
  4235 	// Check change events
  4236 	TEST(!changeObs1->HaveChanges());
  4237 	TEST(!changeObs2->HaveChanges());
  4238 
  4239 	// Remove recent
  4240 	recent->RemoveL(recent->Event().Id());
  4241 
  4242 	// Check change events
  4243 	timer->After(100000);
  4244 	CActiveScheduler::Start();
  4245 
  4246 	TEST(!changeObs1->HaveChanges());
  4247 	TEST(!changeObs2->HaveChanges()); // No event because we should know we called Remove on ourselves
  4248 
  4249 	CleanupStack::PopAndDestroy(9); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate, timer
  4250 	}
  4251 
  4252 /**
  4253 @SYMTestCaseID          SYSLIB-LOGENG-CT-0954
  4254 @SYMTestCaseDesc	    Tests for log view change observer
  4255 @SYMTestPriority 	    High
  4256 @SYMTestActions  	    Check that a view doesn't get change events when clearing duplicates
  4257 @SYMTestExpectedResults Test must not fail
  4258 @SYMREQ                 REQ0000
  4259 */
  4260 LOCAL_C void TestHiddenChangeEvents7L(CLogClient& aClient)
  4261 	{
  4262 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0954 "));
  4263 	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  4264 	changeObs1->StartCollectingChanges();
  4265 
  4266 	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  4267 	CleanupStack::PushL(view);
  4268 
  4269 	CLogFilter* filter = CLogFilter::NewL();
  4270 	CleanupStack::PushL(filter);
  4271 
  4272 	CLogEvent* event = CLogEvent::NewL();
  4273 	CleanupStack::PushL(event);
  4274 
  4275 	CTestActive* active = new(ELeave)CTestActive();
  4276 	CleanupStack::PushL(active);
  4277 
  4278 	TTime now;
  4279 	now.UniversalTime();
  4280 	now += (TTimeIntervalDays)+1;
  4281 
  4282 	// Get rid of all the events in the log
  4283 	active->StartL();
  4284 	aClient.ClearLog(now, active->iStatus);
  4285 	CActiveScheduler::Start();
  4286 	TEST2(active->iStatus.Int(), KErrNone);
  4287 
  4288 	// Incoming call event
  4289 	event->SetEventType(KLogCallEventTypeUid);
  4290 	TBuf<KLogMaxDirectionLength> buf;
  4291 	aClient.GetString(buf, R_LOG_DIR_IN);
  4292 	event->SetDirection(buf);
  4293 
  4294 	// Add an event
  4295 	active->StartL();
  4296 	aClient.AddEvent(*event, active->iStatus);
  4297 	CActiveScheduler::Start();
  4298 	TEST2(active->iStatus.Int(), KErrNone);
  4299 
  4300 	// Add a duplicate
  4301 	active->StartL();
  4302 	aClient.AddEvent(*event, active->iStatus);
  4303 	CActiveScheduler::Start();
  4304 	TEST2(active->iStatus.Int(), KErrNone);
  4305 
  4306 	// Setup normal event view
  4307 	active->StartL();
  4308 	TEST(view->SetFilterL(*filter, active->iStatus));
  4309 	CActiveScheduler::Start();
  4310 	TEST2(active->iStatus.Int(), KErrNone);
  4311 	TEST2(view->CountL(), 2);
  4312 
  4313 	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  4314 	changeObs2->StartCollectingChanges();
  4315 
  4316 	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  4317 	CleanupStack::PushL(recent);
  4318 
  4319 	// Check recent view
  4320 	active->StartL();
  4321 	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  4322 	CActiveScheduler::Start();
  4323 	TEST2(active->iStatus.Int(), KErrNone);
  4324 	TEST2(recent->CountL(), 1);
  4325 
  4326 	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  4327 	CleanupStack::PushL(duplicate);
  4328 
  4329 	// Check duplicate count
  4330 	active->StartL();
  4331 	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
  4332 	CActiveScheduler::Start();
  4333 	TEST2(active->iStatus.Int(), KErrNone);
  4334 	TEST2(recent->CountL(), 1);
  4335 
  4336 	// Remove duplicate
  4337 	recent->ClearDuplicatesL();
  4338 
  4339 	CTestTimer* timer = CTestTimer::NewL();
  4340 	CleanupStack::PushL(timer);
  4341 	timer->After(100000);
  4342 	CActiveScheduler::Start();
  4343 
  4344 	// Check change events
  4345 	TEST(!changeObs1->HaveChanges());
  4346 	TEST(!changeObs2->HaveChanges());
  4347 
  4348 	CleanupStack::PopAndDestroy(9); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate, timer
  4349 	}
  4350 
  4351 /**
  4352 @SYMTestCaseID          SYSLIB-LOGENG-CT-1363
  4353 @SYMTestCaseDesc	    Tests for log view change observer 
  4354 						Making a call from recent call list causes total freeze if log 
  4355 						has been cleared
  4356 @SYMTestPriority 	    High
  4357 @SYMTestActions  	    Test that editing a recent event does not cause a panic if 
  4358 						part of the log has been cleared
  4359 @SYMTestExpectedResults Test must not fail
  4360 @SYMDEF                 DEF066296
  4361 */
  4362 LOCAL_C void DEF066296L(CLogClient& aClient)
  4363 	{
  4364 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1363 "));
  4365 	TBuf<KLogMaxDirectionLength> buf;
  4366 
  4367 	CLogEvent* event = CLogEvent::NewL();
  4368 	CleanupStack::PushL(event);
  4369 
  4370 	CTestActive* active = new(ELeave)CTestActive();
  4371 	CleanupStack::PushL(active);
  4372 
  4373 	// To reproduce this defect, we need a view to be updated
  4374 	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  4375 	CleanupStack::PushL(view);
  4376 
  4377 	// Set up the event and log a call from number 444
  4378 	event->SetEventType(KLogCallEventTypeUid);
  4379 	aClient.GetString(buf, R_LOG_DIR_IN);
  4380 	event->SetDirection(buf);
  4381 	event->SetNumber(_L("444"));
  4382 	active->StartL();
  4383 	aClient.AddEvent(*event, active->iStatus);
  4384 	CActiveScheduler::Start();
  4385 	TEST2(active->iStatus.Int(), KErrNone);
  4386 	
  4387 	// Set up the view to display the recent call list
  4388 	active->StartL();
  4389 	TEST(view->SetRecentListL(-1, active->iStatus));
  4390 	CActiveScheduler::Start();
  4391 	TEST2(active->iStatus.Int(), KErrNone);
  4392 
  4393 	// Get and print current UTC time
  4394 	TTime now;
  4395 	now.UniversalTime();
  4396 	TBuf<0x80> testString;
  4397 	now.FormatL(testString,(_L("%H:%T %1\\%2\\%3 %E")));
  4398 	TheTest.Printf(_L("Current  UTC  time    - %S\n"), &testString);
  4399 
  4400 	// Move the UTC time forward by one day
  4401 	now += TTimeIntervalDays(1);
  4402 	User::SetUTCTime(now);
  4403 
  4404 	now.FormatL(testString,(_L("%H:%T %1\\%2\\%3 %E")));
  4405 	TheTest.Printf(_L("Changed  UTC  time to - %S\n"), &testString);
  4406 	
  4407 	// Set up the event and log a call from number 555
  4408 	event->SetNumber(_L("555"));
  4409 	active->StartL();
  4410 	aClient.AddEvent(*event, active->iStatus);
  4411 	CActiveScheduler::Start();
  4412 	TEST2(active->iStatus.Int(), KErrNone);
  4413 	
  4414 	// Set up the event and log a call from number 611
  4415 	event->SetNumber(_L("611"));
  4416 	active->StartL();
  4417 	aClient.AddEvent(*event, active->iStatus);
  4418 	CActiveScheduler::Start();
  4419 	TEST2(active->iStatus.Int(), KErrNone);
  4420 	
  4421 	//remember this Id - we will try to change this log event later
  4422 	TInt logId = event->Id();
  4423 
  4424 	// Set up the event and log a call from number 777
  4425 	event->SetNumber(_L("777"));
  4426 	active->StartL();
  4427 	aClient.AddEvent(*event, active->iStatus);
  4428 	CActiveScheduler::Start();
  4429 	TEST2(active->iStatus.Int(), KErrNone);
  4430 
  4431 	// Delete all events occurring before today
  4432 	// this should remove only the first call to number 444
  4433 	TDateTime midnight = now.DateTime();
  4434 	midnight.SetHour(0);
  4435 	midnight.SetMinute(0);
  4436 	midnight.SetSecond(0);
  4437 	midnight.SetMicroSecond(0);
  4438 
  4439 	active->StartL();
  4440 	aClient.ClearLog(midnight, active->iStatus);
  4441 	CActiveScheduler::Start();
  4442 	TEST2(active->iStatus.Int(), KErrNone);
  4443 
  4444 	// Attempt to change an entry from the recent list - that for the call to number 611 
  4445 	// without this defect fix, the call to ChangeEvent() will panic with EBadArrayPosition
  4446 	event->SetNumber(_L("555"));
  4447 	event->SetId(logId);
  4448 	active->StartL();
  4449 	aClient.ChangeEvent(*event, active->iStatus);
  4450 	CActiveScheduler::Start();
  4451 	TEST2(active->iStatus.Int(), KErrNone);
  4452 
  4453 	// Restore and print UTC time
  4454 	now.UniversalTime();
  4455 	now -= TTimeIntervalDays(1);
  4456 	User::SetUTCTime(now);
  4457 
  4458 	now.FormatL(testString,(_L("%H:%T %1\\%2\\%3 %E")));
  4459 	TheTest.Printf(_L("Restored UTC  time to - %S\n"), &testString);
  4460 
  4461 	CleanupStack::PopAndDestroy(3, event); //event, active, view
  4462 	}
  4463 
  4464 /**
  4465 @SYMTestCaseID          SYSLIB-LOGENG-CT-1807
  4466 @SYMTestCaseDesc	    Tests that DEF087459 works between 00:00 and 01:00am hometime
  4467 @SYMTestPriority 	    Medium
  4468 @SYMTestActions  	    Change the home time to 00:30 and run DEF066296 test
  4469 @SYMTestExpectedResults Test must not fail
  4470 @SYMDEF                 DEF087459
  4471 */
  4472 LOCAL_C void DEF087459L(CLogClient& aClient)
  4473 	{
  4474 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1807 "));
  4475 	RTz tz;				
  4476 	TInt err = tz.Connect();
  4477 	TEST2(err, KErrNone);
  4478 	CleanupClosePushL(tz);
  4479 	TTime now, saveNow;
  4480 	
  4481 	// Get and print current home time and save it
  4482 	now.HomeTime();
  4483 	saveNow=now;
  4484 	
  4485 	TBuf<0x80> testString;
  4486 	now.FormatL(testString,(_L("%H:%T %1\\%2\\%3 %E")));
  4487 	TheTest.Printf(_L("Current  home time    - %S\n"), &testString);
  4488 
  4489 	// Problem occurred between midnight and 01:00am hometime, so change home time to
  4490 	// be 00:30am
  4491 	TDateTime midnight = now.DateTime();
  4492 	midnight.SetHour(0);
  4493 	midnight.SetMinute(30);
  4494 	midnight.SetSecond(0);
  4495 	midnight.SetMicroSecond(0);
  4496 	
  4497 	TTime newTime=midnight;
  4498 
  4499 	err = tz.SetHomeTime(midnight);
  4500 	TEST2(err, KErrNone);
  4501 
  4502 	// Get and print new home time
  4503 	now.HomeTime();
  4504 	now.FormatL(testString,(_L("%H:%T %1\\%2\\%3 %E")));
  4505 	TheTest.Printf(_L("Changed  home time to - %S\n"), &testString);
  4506 	TheTest.Printf(_L("Re-running DEF066296 test\n"));
  4507 	
  4508 	DEF066296L(aClient);
  4509 	
  4510 	// Restore and print hometime
  4511 	err = tz.SetHomeTime(saveNow);
  4512 	TEST2(err, KErrNone);
  4513 	now.HomeTime();
  4514 	now.FormatL(testString,(_L("%H:%T %1\\%2\\%3 %E")));
  4515 	TheTest.Printf(_L("Restored home time to - %S\n"), &testString);
  4516 	
  4517 	CleanupStack::PopAndDestroy(); //tz
  4518 	}
  4519 
  4520 /**
  4521 @SYMTestCaseID          SYSLIB-LOGENG-CT-0955
  4522 @SYMTestCaseDesc	    Tests that events can be changed to move them between recent lists
  4523 @SYMTestPriority 	    High
  4524 @SYMTestActions  	    Add the events to the view.Move most recent event to another recent list
  4525 @SYMTestExpectedResults Test must not fail
  4526 @SYMREQ                 REQ0000
  4527 */
  4528 LOCAL_C void TestChangeEventRecentView1L(CLogClient& aClient)
  4529 	{
  4530 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0955 "));
  4531 	CTestActive* active = new(ELeave)CTestActive();
  4532 	CleanupStack::PushL(active);
  4533 
  4534 	CLogEvent* event = CLogEvent::NewL();
  4535 	CleanupStack::PushL(event);
  4536 
  4537 	CLogViewRecent* recent1 = CLogViewRecent::NewL(aClient);
  4538 	CleanupStack::PushL(recent1);
  4539 
  4540 	CLogViewDuplicate* duplicate1 = CLogViewDuplicate::NewL(aClient);
  4541 	CleanupStack::PushL(duplicate1);
  4542 
  4543 	CLogViewRecent* recent2 = CLogViewRecent::NewL(aClient);
  4544 	CleanupStack::PushL(recent2);
  4545 
  4546 	CLogViewDuplicate* duplicate2 = CLogViewDuplicate::NewL(aClient);
  4547 	CleanupStack::PushL(duplicate2);
  4548 
  4549 	// Make sure there are no entries in any recent lists
  4550 	active->StartL();
  4551 	aClient.ClearLog(KLogNullRecentList, active->iStatus);
  4552 	CActiveScheduler::Start();
  4553 	TEST2(active->iStatus.Int(), KErrNone);
  4554 
  4555 	// Incoming call event
  4556 	TBuf<KLogMaxDirectionLength> incoming;
  4557 	aClient.GetString(incoming, R_LOG_DIR_IN);
  4558 
  4559 	// Missed call event
  4560 	TBuf<KLogMaxDirectionLength> missed;
  4561 	aClient.GetString(missed, R_LOG_DIR_MISSED);
  4562 
  4563 	event->SetEventType(KLogCallEventTypeUid);
  4564 	event->SetDirection(missed);
  4565 	event->SetContact(1);
  4566 
  4567 	// Add some events
  4568 	active->StartL();
  4569 	aClient.AddEvent(*event, active->iStatus);
  4570 	CActiveScheduler::Start();
  4571 	TEST2(active->iStatus.Int(), KErrNone);
  4572 	TLogId id1 = event->Id();
  4573 
  4574 	User::After(1000000);
  4575 
  4576 	active->StartL();
  4577 	aClient.AddEvent(*event, active->iStatus);
  4578 	CActiveScheduler::Start();
  4579 	TEST2(active->iStatus.Int(), KErrNone);
  4580 	TLogId id2 = event->Id();
  4581 
  4582 	User::After(1000000);
  4583 
  4584 	active->StartL();
  4585 	aClient.AddEvent(*event, active->iStatus);
  4586 	CActiveScheduler::Start();
  4587 	TEST2(active->iStatus.Int(), KErrNone);
  4588 	TLogId id3 = event->Id();
  4589 
  4590 	User::After(1000000);
  4591 
  4592 	// Most recent
  4593 	active->StartL();
  4594 	aClient.AddEvent(*event, active->iStatus);
  4595 	CActiveScheduler::Start();
  4596 	TEST2(active->iStatus.Int(), KErrNone);
  4597 	TLogId id4 = event->Id();
  4598 
  4599 	// Check there's a recent event in the list
  4600 	active->StartL();
  4601 	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  4602 	CActiveScheduler::Start();
  4603 	TEST2(active->iStatus.Int(), KErrNone);
  4604 	TEST2(recent1->CountL(), 1);
  4605 	TEST2(recent1->Event().Id(), id4);
  4606 
  4607 	// Check it has duplicates
  4608 	active->StartL();
  4609 	TEST(recent1->DuplicatesL(*duplicate1, active->iStatus));
  4610 	CActiveScheduler::Start();
  4611 	TEST2(active->iStatus.Int(), KErrNone);
  4612 	TEST2(duplicate1->CountL(), 3);
  4613 	TEST2(duplicate1->Event().Id(), id3);
  4614 
  4615 	// Check id
  4616 	active->StartL();
  4617 	TEST(duplicate1->NextL(active->iStatus));
  4618 	CActiveScheduler::Start();
  4619 	TEST2(active->iStatus.Int(), KErrNone);
  4620 	TEST2(duplicate1->Event().Id(), id2);
  4621 
  4622 	// Check id
  4623 	active->StartL();
  4624 	TEST(duplicate1->NextL(active->iStatus));
  4625 	CActiveScheduler::Start();
  4626 	TEST2(active->iStatus.Int(), KErrNone);
  4627 	TEST2(duplicate1->Event().Id(), id1);
  4628 
  4629 	// Other recent list should be empty
  4630 	TEST(!recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  4631 
  4632 	// Now move most recent event to another recent list
  4633 	event->SetDirection(incoming);
  4634 	active->StartL();
  4635 	aClient.ChangeEvent(*event, active->iStatus);
  4636 	CActiveScheduler::Start();
  4637 	TEST2(active->iStatus.Int(), KErrNone);
  4638 
  4639 	// Most recent duplicate should now be the latest
  4640 	active->StartL();
  4641 	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  4642 	CActiveScheduler::Start();
  4643 	TEST2(active->iStatus.Int(), KErrNone);
  4644 	TEST2(recent1->CountL(), 1);
  4645 	TEST2(recent1->Event().Id(), id3);
  4646 	event->CopyL(recent1->Event()); // for later
  4647 
  4648 	// There should still be some duplicates
  4649 	active->StartL();
  4650 	TEST(recent1->DuplicatesL(*duplicate1, active->iStatus));
  4651 	CActiveScheduler::Start();
  4652 	TEST2(active->iStatus.Int(), KErrNone);
  4653 	TEST2(duplicate1->CountL(), 2);
  4654 	TEST2(duplicate1->Event().Id(), id2);
  4655 
  4656 	// Check id
  4657 	active->StartL();
  4658 	TEST(duplicate1->NextL(active->iStatus));
  4659 	CActiveScheduler::Start();
  4660 	TEST2(active->iStatus.Int(), KErrNone);
  4661 	TEST2(duplicate1->Event().Id(), id1);
  4662 
  4663 	// Now the event should have moved to another recent list
  4664 	active->StartL();
  4665 	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  4666 	CActiveScheduler::Start();
  4667 	TEST2(active->iStatus.Int(), KErrNone);
  4668 	TEST2(recent2->CountL(), 1);
  4669 	TEST2(recent2->Event().Id(), id4);
  4670 
  4671 	// No duplicates yet
  4672 	TEST(!recent2->DuplicatesL(*duplicate2, active->iStatus));
  4673 
  4674 	// Now move most recent event to another recent list
  4675 	event->SetDirection(incoming);
  4676 	active->StartL();
  4677 	aClient.ChangeEvent(*event, active->iStatus);
  4678 	CActiveScheduler::Start();
  4679 	TEST2(active->iStatus.Int(), KErrNone);
  4680 
  4681 	// Most recent duplicate should now be the latest
  4682 	active->StartL();
  4683 	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  4684 	CActiveScheduler::Start();
  4685 	TEST2(active->iStatus.Int(), KErrNone);
  4686 	TEST2(recent1->CountL(), 1);
  4687 	TEST2(recent1->Event().Id(), id2);
  4688 	event->CopyL(recent1->Event()); // for later
  4689 
  4690 	// There should still be some duplicates
  4691 	active->StartL();
  4692 	TEST(recent1->DuplicatesL(*duplicate1, active->iStatus));
  4693 	CActiveScheduler::Start();
  4694 	TEST2(active->iStatus.Int(), KErrNone);
  4695 	TEST2(duplicate1->CountL(), 1);
  4696 	TEST2(duplicate1->Event().Id(), id1);
  4697 
  4698 	// Now the event should have moved to another recent list
  4699 	active->StartL();
  4700 	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  4701 	CActiveScheduler::Start();
  4702 	TEST2(active->iStatus.Int(), KErrNone);
  4703 	TEST2(recent2->CountL(), 1);
  4704 	TEST2(recent2->Event().Id(), id4);
  4705 
  4706 	// There should still be some duplicates
  4707 	active->StartL();
  4708 	TEST(recent2->DuplicatesL(*duplicate2, active->iStatus));
  4709 	CActiveScheduler::Start();
  4710 	TEST2(active->iStatus.Int(), KErrNone);
  4711 	TEST2(duplicate2->CountL(), 1);
  4712 	TEST2(duplicate2->Event().Id(), id3);
  4713 
  4714 	// Now move most recent event to another recent list
  4715 	event->SetDirection(incoming);
  4716 	active->StartL();
  4717 	aClient.ChangeEvent(*event, active->iStatus);
  4718 	CActiveScheduler::Start();
  4719 	TEST2(active->iStatus.Int(), KErrNone);
  4720 
  4721 	// Most recent duplicate should now be the latest
  4722 	active->StartL();
  4723 	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  4724 	CActiveScheduler::Start();
  4725 	TEST2(active->iStatus.Int(), KErrNone);
  4726 	TEST2(recent1->CountL(), 1);
  4727 	TEST2(recent1->Event().Id(), id1);
  4728 	event->CopyL(recent1->Event()); // for later
  4729 
  4730 	// Should be no more duplicates
  4731 	TEST(!recent1->DuplicatesL(*duplicate1, active->iStatus));
  4732 
  4733 	// Now the event should have moved to another recent list
  4734 	active->StartL();
  4735 	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  4736 	CActiveScheduler::Start();
  4737 	TEST2(active->iStatus.Int(), KErrNone);
  4738 	TEST2(recent2->CountL(), 1);
  4739 	TEST2(recent2->Event().Id(), id4);
  4740 
  4741 	// There should still be some duplicates
  4742 	active->StartL();
  4743 	TEST(recent2->DuplicatesL(*duplicate2, active->iStatus));
  4744 	CActiveScheduler::Start();
  4745 	TEST2(active->iStatus.Int(), KErrNone);
  4746 	TEST2(duplicate2->CountL(), 2);
  4747 	TEST2(duplicate2->Event().Id(), id3);
  4748 
  4749 	// Check id
  4750 	active->StartL();
  4751 	TEST(duplicate2->NextL(active->iStatus));
  4752 	CActiveScheduler::Start();
  4753 	TEST2(active->iStatus.Int(), KErrNone);
  4754 	TEST2(duplicate2->Event().Id(), id2);
  4755 
  4756 	// Now move most recent event to another recent list
  4757 	event->SetDirection(incoming);
  4758 	active->StartL();
  4759 	aClient.ChangeEvent(*event, active->iStatus);
  4760 	CActiveScheduler::Start();
  4761 	TEST2(active->iStatus.Int(), KErrNone);
  4762 
  4763 	// No more recent events
  4764 	TEST(!recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  4765 
  4766 	// Now the event should have moved to another recent list
  4767 	active->StartL();
  4768 	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  4769 	CActiveScheduler::Start();
  4770 	TEST2(active->iStatus.Int(), KErrNone);
  4771 	TEST2(recent2->CountL(), 1);
  4772 	TEST2(recent2->Event().Id(), id4);
  4773 
  4774 	// There should still be some duplicates
  4775 	active->StartL();
  4776 	TEST(recent2->DuplicatesL(*duplicate2, active->iStatus));
  4777 	CActiveScheduler::Start();
  4778 	TEST2(active->iStatus.Int(), KErrNone);
  4779 	TEST2(duplicate2->CountL(), 3);
  4780 	TEST2(duplicate2->Event().Id(), id3);
  4781 
  4782 	// Check id
  4783 	active->StartL();
  4784 	TEST(duplicate2->NextL(active->iStatus));
  4785 	CActiveScheduler::Start();
  4786 	TEST2(active->iStatus.Int(), KErrNone);
  4787 	TEST2(duplicate2->Event().Id(), id2);
  4788 
  4789 	// Check id
  4790 	active->StartL();
  4791 	TEST(duplicate2->NextL(active->iStatus));
  4792 	CActiveScheduler::Start();
  4793 	TEST2(active->iStatus.Int(), KErrNone);
  4794 	TEST2(duplicate2->Event().Id(), id1);
  4795 
  4796 	CleanupStack::PopAndDestroy(6); // active, event, recent1, duplicate1, recent2, duplicate2
  4797 	}
  4798 
  4799 /**
  4800 Test that events can be changed to move them between recent lists
  4801 The same as TestChangeEventRecentView1L, but the events are transferred in reverse order
  4802 
  4803 @SYMTestCaseID          SYSLIB-LOGENG-CT-0956
  4804 @SYMTestCaseDesc	    Tests that events can be changed to move them between recent lists
  4805 @SYMTestPriority 	    High
  4806 @SYMTestActions  	    Add the events to the view.Move most recent event to another recent list in reverse order
  4807 @SYMTestExpectedResults Test must not fail
  4808 @SYMREQ                 REQ0000
  4809 */
  4810 LOCAL_C void TestChangeEventRecentView2L(CLogClient& aClient)
  4811 	{
  4812 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0956 "));
  4813 	CTestActive* active = new(ELeave)CTestActive();
  4814 	CleanupStack::PushL(active);
  4815 
  4816 	CLogEvent* event = CLogEvent::NewL();
  4817 	CleanupStack::PushL(event);
  4818 
  4819 	CLogViewRecent* recent1 = CLogViewRecent::NewL(aClient);
  4820 	CleanupStack::PushL(recent1);
  4821 
  4822 	CLogViewDuplicate* duplicate1 = CLogViewDuplicate::NewL(aClient);
  4823 	CleanupStack::PushL(duplicate1);
  4824 
  4825 	CLogViewRecent* recent2 = CLogViewRecent::NewL(aClient);
  4826 	CleanupStack::PushL(recent2);
  4827 
  4828 	CLogViewDuplicate* duplicate2 = CLogViewDuplicate::NewL(aClient);
  4829 	CleanupStack::PushL(duplicate2);
  4830 
  4831 	// Make sure there are no entries in any recent lists
  4832 	active->StartL();
  4833 	aClient.ClearLog(KLogNullRecentList, active->iStatus);
  4834 	CActiveScheduler::Start();
  4835 	TEST2(active->iStatus.Int(), KErrNone);
  4836 
  4837 	// Incoming call event
  4838 	TBuf<KLogMaxDirectionLength> incoming;
  4839 	aClient.GetString(incoming, R_LOG_DIR_IN);
  4840 
  4841 	// Missed call event
  4842 	TBuf<KLogMaxDirectionLength> missed;
  4843 	aClient.GetString(missed, R_LOG_DIR_MISSED);
  4844 
  4845 	event->SetEventType(KLogCallEventTypeUid);
  4846 	event->SetDirection(missed);
  4847 	event->SetContact(1);
  4848 
  4849 	// Add some events
  4850 	active->StartL();
  4851 	aClient.AddEvent(*event, active->iStatus);
  4852 	CActiveScheduler::Start();
  4853 	TEST2(active->iStatus.Int(), KErrNone);
  4854 	TLogId id1 = event->Id();
  4855 
  4856 	User::After(1000000);
  4857 
  4858 	active->StartL();
  4859 	aClient.AddEvent(*event, active->iStatus);
  4860 	CActiveScheduler::Start();
  4861 	TEST2(active->iStatus.Int(), KErrNone);
  4862 	TLogId id2 = event->Id();
  4863 
  4864 	User::After(1000000);
  4865 
  4866 	active->StartL();
  4867 	aClient.AddEvent(*event, active->iStatus);
  4868 	CActiveScheduler::Start();
  4869 	TEST2(active->iStatus.Int(), KErrNone);
  4870 	TLogId id3 = event->Id();
  4871 
  4872 	User::After(1000000);
  4873 
  4874 	// Most recent
  4875 	active->StartL();
  4876 	aClient.AddEvent(*event, active->iStatus);
  4877 	CActiveScheduler::Start();
  4878 	TEST2(active->iStatus.Int(), KErrNone);
  4879 	TLogId id4 = event->Id();
  4880 
  4881 	// Check there's a recent event in the list
  4882 	active->StartL();
  4883 	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  4884 	CActiveScheduler::Start();
  4885 	TEST2(active->iStatus.Int(), KErrNone);
  4886 	TEST2(recent1->CountL(), 1);
  4887 	TEST2(recent1->Event().Id(), id4);
  4888 
  4889 	// Check it has duplicates
  4890 	active->StartL();
  4891 	TEST(recent1->DuplicatesL(*duplicate1, active->iStatus));
  4892 	CActiveScheduler::Start();
  4893 	TEST2(active->iStatus.Int(), KErrNone);
  4894 	TEST2(duplicate1->CountL(), 3);
  4895 	TEST2(duplicate1->Event().Id(), id3);
  4896 
  4897 	// Check id
  4898 	active->StartL();
  4899 	TEST(duplicate1->NextL(active->iStatus));
  4900 	CActiveScheduler::Start();
  4901 	TEST2(active->iStatus.Int(), KErrNone);
  4902 	TEST2(duplicate1->Event().Id(), id2);
  4903 
  4904 	// Check id
  4905 	active->StartL();
  4906 	TEST(duplicate1->NextL(active->iStatus));
  4907 	CActiveScheduler::Start();
  4908 	TEST2(active->iStatus.Int(), KErrNone);
  4909 	TEST2(duplicate1->Event().Id(), id1);
  4910 	event->CopyL(duplicate1->Event()); // for later
  4911 
  4912 	// Other recent list should be empty
  4913 	TEST(!recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  4914 
  4915 	// Now move latest recent event to another recent list
  4916 	event->SetDirection(incoming);
  4917 	active->StartL();
  4918 	aClient.ChangeEvent(*event, active->iStatus);
  4919 	CActiveScheduler::Start();
  4920 	TEST2(active->iStatus.Int(), KErrNone);
  4921 
  4922 	// Most recent duplicate should still be the latest
  4923 	active->StartL();
  4924 	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  4925 	CActiveScheduler::Start();
  4926 	TEST2(active->iStatus.Int(), KErrNone);
  4927 	TEST2(recent1->CountL(), 1);
  4928 	TEST2(recent1->Event().Id(), id4);
  4929 
  4930 	// There should still be some duplicates
  4931 	active->StartL();
  4932 	TEST(recent1->DuplicatesL(*duplicate1, active->iStatus));
  4933 	CActiveScheduler::Start();
  4934 	TEST2(active->iStatus.Int(), KErrNone);
  4935 	TEST2(duplicate1->CountL(), 2);
  4936 	TEST2(duplicate1->Event().Id(), id3);
  4937 
  4938 	// Check id
  4939 	active->StartL();
  4940 	TEST(duplicate1->NextL(active->iStatus));
  4941 	CActiveScheduler::Start();
  4942 	TEST2(active->iStatus.Int(), KErrNone);
  4943 	TEST2(duplicate1->Event().Id(), id2);
  4944 	event->CopyL(duplicate1->Event()); // for later
  4945 
  4946 	// Now the event should have moved to another recent list
  4947 	active->StartL();
  4948 	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  4949 	CActiveScheduler::Start();
  4950 	TEST2(active->iStatus.Int(), KErrNone);
  4951 	TEST2(recent2->CountL(), 1);
  4952 	TEST2(recent2->Event().Id(), id1);
  4953 
  4954 	// No duplicates yet
  4955 	TEST(!recent2->DuplicatesL(*duplicate2, active->iStatus));
  4956 
  4957 	// Now move most recent event to another recent list
  4958 	event->SetDirection(incoming);
  4959 	active->StartL();
  4960 	aClient.ChangeEvent(*event, active->iStatus);
  4961 	CActiveScheduler::Start();
  4962 	TEST2(active->iStatus.Int(), KErrNone);
  4963 
  4964 	// Most recent duplicate should still be the latest
  4965 	active->StartL();
  4966 	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  4967 	CActiveScheduler::Start();
  4968 	TEST2(active->iStatus.Int(), KErrNone);
  4969 	TEST2(recent1->CountL(), 1);
  4970 	TEST2(recent1->Event().Id(), id4);
  4971 
  4972 	// There should still be some duplicates
  4973 	active->StartL();
  4974 	TEST(recent1->DuplicatesL(*duplicate1, active->iStatus));
  4975 	CActiveScheduler::Start();
  4976 	TEST2(active->iStatus.Int(), KErrNone);
  4977 	TEST2(duplicate1->CountL(), 1);
  4978 	TEST2(duplicate1->Event().Id(), id3);
  4979 	event->CopyL(duplicate1->Event()); // for later
  4980 
  4981 	// Now the event should have moved to another recent list
  4982 	active->StartL();
  4983 	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  4984 	CActiveScheduler::Start();
  4985 	TEST2(active->iStatus.Int(), KErrNone);
  4986 	TEST2(recent2->CountL(), 1);
  4987 	TEST2(recent2->Event().Id(), id2);
  4988 
  4989 	// There should still be some duplicates
  4990 	active->StartL();
  4991 	TEST(recent2->DuplicatesL(*duplicate2, active->iStatus));
  4992 	CActiveScheduler::Start();
  4993 	TEST2(active->iStatus.Int(), KErrNone);
  4994 	TEST2(duplicate2->CountL(), 1);
  4995 	TEST2(duplicate2->Event().Id(), id1);
  4996 
  4997 	// Now move most recent event to another recent list
  4998 	event->SetDirection(incoming);
  4999 	active->StartL();
  5000 	aClient.ChangeEvent(*event, active->iStatus);
  5001 	CActiveScheduler::Start();
  5002 	TEST2(active->iStatus.Int(), KErrNone);
  5003 
  5004 	// Most recent duplicate should still be the latest
  5005 	active->StartL();
  5006 	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  5007 	CActiveScheduler::Start();
  5008 	TEST2(active->iStatus.Int(), KErrNone);
  5009 	TEST2(recent1->CountL(), 1);
  5010 	TEST2(recent1->Event().Id(), id4);
  5011 	event->CopyL(recent1->Event()); // for later
  5012 
  5013 	// Should be no more duplicates
  5014 	TEST(!recent1->DuplicatesL(*duplicate1, active->iStatus));
  5015 
  5016 	// Now the event should have moved to another recent list
  5017 	active->StartL();
  5018 	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  5019 	CActiveScheduler::Start();
  5020 	TEST2(active->iStatus.Int(), KErrNone);
  5021 	TEST2(recent2->CountL(), 1);
  5022 	TEST2(recent2->Event().Id(), id3);
  5023 
  5024 	// There should still be some duplicates
  5025 	active->StartL();
  5026 	TEST(recent2->DuplicatesL(*duplicate2, active->iStatus));
  5027 	CActiveScheduler::Start();
  5028 	TEST2(active->iStatus.Int(), KErrNone);
  5029 	TEST2(duplicate2->CountL(), 2);
  5030 	TEST2(duplicate2->Event().Id(), id2);
  5031 
  5032 	// Check id
  5033 	active->StartL();
  5034 	TEST(duplicate2->NextL(active->iStatus));
  5035 	CActiveScheduler::Start();
  5036 	TEST2(active->iStatus.Int(), KErrNone);
  5037 	TEST2(duplicate2->Event().Id(), id1);
  5038 
  5039 	// Now move most recent event to another recent list
  5040 	event->SetDirection(incoming);
  5041 	active->StartL();
  5042 	aClient.ChangeEvent(*event, active->iStatus);
  5043 	CActiveScheduler::Start();
  5044 	TEST2(active->iStatus.Int(), KErrNone);
  5045 
  5046 	// No more recent events
  5047 	TEST(!recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  5048 
  5049 	// Now the event should have moved to another recent list
  5050 	active->StartL();
  5051 	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  5052 	CActiveScheduler::Start();
  5053 	TEST2(active->iStatus.Int(), KErrNone);
  5054 	TEST2(recent2->CountL(), 1);
  5055 	TEST2(recent2->Event().Id(), id4);
  5056 
  5057 	// There should still be some duplicates
  5058 	active->StartL();
  5059 	TEST(recent2->DuplicatesL(*duplicate2, active->iStatus));
  5060 	CActiveScheduler::Start();
  5061 	TEST2(active->iStatus.Int(), KErrNone);
  5062 	TEST2(duplicate2->CountL(), 3);
  5063 	TEST2(duplicate2->Event().Id(), id3);
  5064 
  5065 	// Check id
  5066 	active->StartL();
  5067 	TEST(duplicate2->NextL(active->iStatus));
  5068 	CActiveScheduler::Start();
  5069 	TEST2(active->iStatus.Int(), KErrNone);
  5070 	TEST2(duplicate2->Event().Id(), id2);
  5071 
  5072 	// Check id
  5073 	active->StartL();
  5074 	TEST(duplicate2->NextL(active->iStatus));
  5075 	CActiveScheduler::Start();
  5076 	TEST2(active->iStatus.Int(), KErrNone);
  5077 	TEST2(duplicate2->Event().Id(), id1);
  5078 
  5079 	CleanupStack::PopAndDestroy(6); // active, event, recent1, duplicate1, recent2, duplicate2
  5080 	}
  5081 
  5082 /**
  5083 @SYMTestCaseID          SYSLIB-LOGENG-CT-0957
  5084 @SYMTestCaseDesc	    Tests that change in log view after moving an event
  5085 @SYMTestPriority 	    High
  5086 @SYMTestActions  	    Check recent views are purged if necessary after moving an event
  5087 @SYMTestExpectedResults Test must not fail
  5088 @SYMREQ                 REQ0000
  5089 */
  5090 LOCAL_C void TestChangeEventRecentViewAndPurgeL(CLogClient& aClient)
  5091 	{
  5092 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0957 "));
  5093 	CTestActive* active = new(ELeave)CTestActive();
  5094 	CleanupStack::PushL(active);
  5095 
  5096 	CLogEvent* event = CLogEvent::NewL();
  5097 	CleanupStack::PushL(event);
  5098 
  5099 	CLogViewRecent* recent1 = CLogViewRecent::NewL(aClient);
  5100 	CleanupStack::PushL(recent1);
  5101 
  5102 	CLogViewRecent* recent2 = CLogViewRecent::NewL(aClient);
  5103 	CleanupStack::PushL(recent2);
  5104 
  5105 	// Make sure there are no entries in any recent lists
  5106 	active->StartL();
  5107 	aClient.ClearLog(KLogNullRecentList, active->iStatus);
  5108 	CActiveScheduler::Start();
  5109 	TEST2(active->iStatus.Int(), KErrNone);
  5110 
  5111 	// Get log config
  5112 	TLogConfig config;
  5113 	active->StartL();
  5114 	aClient.GetConfig(config, active->iStatus);
  5115 	CActiveScheduler::Start();
  5116 	TEST2(active->iStatus.Int(), KErrNone);
  5117 
  5118 	// Set the max recent list size to something small
  5119 	config.iMaxRecentLogSize = 3;
  5120 	active->StartL();
  5121 	aClient.ChangeConfig(config, active->iStatus);
  5122 	CActiveScheduler::Start();
  5123 	TEST2(active->iStatus.Int(), KErrNone);
  5124 
  5125 	// Incoming call event
  5126 	TBuf<KLogMaxDirectionLength> incoming;
  5127 	aClient.GetString(incoming, R_LOG_DIR_IN);
  5128 
  5129 	// Missed call event
  5130 	TBuf<KLogMaxDirectionLength> missed;
  5131 	aClient.GetString(missed, R_LOG_DIR_MISSED);
  5132 
  5133 	event->SetEventType(KLogCallEventTypeUid);
  5134 	event->SetDirection(missed);
  5135 
  5136 	// Add an event
  5137 	event->SetContact(1);
  5138 	active->StartL();
  5139 	aClient.AddEvent(*event, active->iStatus);
  5140 	CActiveScheduler::Start();
  5141 	TEST2(active->iStatus.Int(), KErrNone);
  5142 	TLogId id1 = event->Id();
  5143 
  5144 	User::After(1000000);
  5145 	event->SetDirection(incoming);
  5146 
  5147 	// Add an event
  5148 	event->SetContact(2);
  5149 	active->StartL();
  5150 	aClient.AddEvent(*event, active->iStatus);
  5151 	CActiveScheduler::Start();
  5152 	TEST2(active->iStatus.Int(), KErrNone);
  5153 	TLogId id2 = event->Id();
  5154 
  5155 	User::After(1000000);
  5156 
  5157 	// Add an event
  5158 	event->SetContact(3);
  5159 	active->StartL();
  5160 	aClient.AddEvent(*event, active->iStatus);
  5161 	CActiveScheduler::Start();
  5162 	TEST2(active->iStatus.Int(), KErrNone);
  5163 	TLogId id3 = event->Id();
  5164 
  5165 	User::After(1000000);
  5166 
  5167 	// Add an event
  5168 	event->SetContact(4);
  5169 	active->StartL();
  5170 	aClient.AddEvent(*event, active->iStatus);
  5171 	CActiveScheduler::Start();
  5172 	TEST2(active->iStatus.Int(), KErrNone);
  5173 	TLogId id4 = event->Id();
  5174 
  5175 	// Check the views
  5176 	active->StartL();
  5177 	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  5178 	CActiveScheduler::Start();
  5179 	TEST2(active->iStatus.Int(), KErrNone);
  5180 	TEST2(recent1->CountL(), 1);
  5181 
  5182 	active->StartL();
  5183 	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  5184 	CActiveScheduler::Start();
  5185 	TEST2(active->iStatus.Int(), KErrNone);
  5186 	TEST2(recent2->CountL(), 3);
  5187 
  5188 	// Retrieve event
  5189 	event->SetId(id1);
  5190 	active->StartL();
  5191 	aClient.GetEvent(*event, active->iStatus);
  5192 	CActiveScheduler::Start();
  5193 	TEST2(active->iStatus.Int(), KErrNone);
  5194 
  5195 	// Now move the oldest event to another recent list - it should be purged
  5196 	event->SetDirection(incoming);
  5197 	active->StartL();
  5198 	aClient.ChangeEvent(*event, active->iStatus);
  5199 	CActiveScheduler::Start();
  5200 	TEST2(active->iStatus.Int(), KErrNone);
  5201 
  5202 	// Missed call list now empty
  5203 	TEST(!recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  5204 
  5205 	// Incoming view should be unchanged
  5206 	active->StartL();
  5207 	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  5208 	CActiveScheduler::Start();
  5209 	TEST2(active->iStatus.Int(), KErrNone);
  5210 	TEST2(recent2->CountL(), 3);
  5211 	TEST2(recent2->Event().Id(), id4);
  5212 
  5213 	// Check id
  5214 	active->StartL();
  5215 	TEST(recent2->NextL(active->iStatus));
  5216 	CActiveScheduler::Start();
  5217 	TEST2(active->iStatus.Int(), KErrNone);
  5218 	TEST2(recent2->Event().Id(), id3);
  5219 
  5220 	// Check id
  5221 	active->StartL();
  5222 	TEST(recent2->NextL(active->iStatus));
  5223 	CActiveScheduler::Start();
  5224 	TEST2(active->iStatus.Int(), KErrNone);
  5225 	TEST2(recent2->Event().Id(), id2);
  5226 
  5227 	TTime now;
  5228 	now.UniversalTime();
  5229 
  5230 	// This should have no effect
  5231 	event->SetTime(now);
  5232 	active->StartL();
  5233 	aClient.ChangeEvent(*event, active->iStatus);
  5234 	CActiveScheduler::Start();
  5235 	TEST2(active->iStatus.Int(), KErrNone);
  5236 
  5237 	// Incoming view should be unchanged
  5238 	active->StartL();
  5239 	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  5240 	CActiveScheduler::Start();
  5241 	TEST2(active->iStatus.Int(), KErrNone);
  5242 	TEST2(recent2->CountL(), 3);
  5243 	TEST2(recent2->Event().Id(), id4);
  5244 
  5245 	// Check id
  5246 	active->StartL();
  5247 	TEST(recent2->NextL(active->iStatus));
  5248 	CActiveScheduler::Start();
  5249 	TEST2(active->iStatus.Int(), KErrNone);
  5250 	TEST2(recent2->Event().Id(), id3);
  5251 
  5252 	// Check id
  5253 	active->StartL();
  5254 	TEST(recent2->NextL(active->iStatus));
  5255 	CActiveScheduler::Start();
  5256 	TEST2(active->iStatus.Int(), KErrNone);
  5257 	TEST2(recent2->Event().Id(), id2);
  5258 
  5259 	// Now add a new event to missed view (the latest)
  5260 	User::After(1000000);
  5261 	event->SetDirection(missed);
  5262 	active->StartL();
  5263 	aClient.AddEvent(*event, active->iStatus);
  5264 	CActiveScheduler::Start();
  5265 	TEST2(active->iStatus.Int(), KErrNone);
  5266 
  5267 	User::After(1000000);
  5268 	now.UniversalTime();
  5269 
  5270 	// This should have no effect
  5271 	event->SetTime(now);
  5272 	active->StartL();
  5273 	aClient.ChangeEvent(*event, active->iStatus);
  5274 	CActiveScheduler::Start();
  5275 	TEST2(active->iStatus.Int(), KErrNone);
  5276 
  5277 	// Check the views
  5278 	active->StartL();
  5279 	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  5280 	CActiveScheduler::Start();
  5281 	TEST2(active->iStatus.Int(), KErrNone);
  5282 	TEST2(recent1->CountL(), 1);
  5283 
  5284 	active->StartL();
  5285 	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  5286 	CActiveScheduler::Start();
  5287 	TEST2(active->iStatus.Int(), KErrNone);
  5288 	TEST2(recent2->CountL(), 3);
  5289 
  5290 	// Now move the latest event to another recent list - oldest should be purged
  5291 	event->SetDirection(incoming);
  5292 	active->StartL();
  5293 	aClient.ChangeEvent(*event, active->iStatus);
  5294 	CActiveScheduler::Start();
  5295 	TEST2(active->iStatus.Int(), KErrNone);
  5296 
  5297 	TEST(!recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  5298 
  5299 	active->StartL();
  5300 	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  5301 	CActiveScheduler::Start();
  5302 	TEST2(active->iStatus.Int(), KErrNone);
  5303 	TEST2(recent2->CountL(), 3);
  5304 	TEST2(recent2->Event().Id(), event->Id());
  5305 
  5306 	// Check id
  5307 	active->StartL();
  5308 	TEST(recent2->NextL(active->iStatus));
  5309 	CActiveScheduler::Start();
  5310 	TEST2(active->iStatus.Int(), KErrNone);
  5311 	TEST2(recent2->Event().Id(), id4);
  5312 
  5313 	// Check id
  5314 	active->StartL();
  5315 	TEST(recent2->NextL(active->iStatus));
  5316 	CActiveScheduler::Start();
  5317 	TEST2(active->iStatus.Int(), KErrNone);
  5318 	TEST2(recent2->Event().Id(), id3);
  5319 
  5320 	CleanupStack::PopAndDestroy(4); // active, event, recent1, recent2
  5321 	}
  5322 
  5323 /**
  5324 @SYMTestCaseID          SYSLIB-LOGENG-CT-0958
  5325 @SYMTestCaseDesc	    Tests for the log view,on changing an event
  5326 @SYMTestPriority 	    High
  5327 @SYMTestActions  	    Check an event can be removed from recent lists by changing it
  5328 @SYMTestExpectedResults Test must not fail
  5329 @SYMREQ                 REQ0000
  5330 */
  5331 LOCAL_C void TestChangeEventRecentViewRemoveL(CLogClient& aClient)
  5332 	{
  5333 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0958 "));
  5334 	CTestActive* active = new(ELeave)CTestActive();
  5335 	CleanupStack::PushL(active);
  5336 
  5337 	CLogEvent* event = CLogEvent::NewL();
  5338 	CleanupStack::PushL(event);
  5339 
  5340 	CLogViewRecent* recent = CLogViewRecent::NewL(aClient);
  5341 	CleanupStack::PushL(recent);
  5342 
  5343 	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  5344 	CleanupStack::PushL(duplicate);
  5345 
  5346 	// Missed call event
  5347 	TBuf<KLogMaxDirectionLength> missed;
  5348 	aClient.GetString(missed, R_LOG_DIR_MISSED);
  5349 
  5350 	event->SetEventType(KLogCallEventTypeUid);
  5351 	event->SetDirection(missed);
  5352 
  5353 	// Add an event
  5354 	event->SetContact(1);
  5355 	active->StartL();
  5356 	aClient.AddEvent(*event, active->iStatus);
  5357 	CActiveScheduler::Start();
  5358 	TEST2(active->iStatus.Int(), KErrNone);
  5359 	TLogId id1 = event->Id();
  5360 
  5361 	User::After(1000000);
  5362 
  5363 	// Add some duplicates
  5364 	active->StartL();
  5365 	aClient.AddEvent(*event, active->iStatus);
  5366 	CActiveScheduler::Start();
  5367 	TEST2(active->iStatus.Int(), KErrNone);
  5368 	TLogId id2 = event->Id();
  5369 
  5370 	User::After(1000000);
  5371 
  5372 	active->StartL();
  5373 	aClient.AddEvent(*event, active->iStatus);
  5374 	CActiveScheduler::Start();
  5375 	TEST2(active->iStatus.Int(), KErrNone);
  5376 	TLogId id3 = event->Id();
  5377 
  5378 	User::After(1000000);
  5379 
  5380 	active->StartL();
  5381 	aClient.AddEvent(*event, active->iStatus);
  5382 	CActiveScheduler::Start();
  5383 	TEST2(active->iStatus.Int(), KErrNone);
  5384 	TLogId id4 = event->Id();
  5385 
  5386 	// Check views
  5387 	active->StartL();
  5388 	TEST(recent->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  5389 	CActiveScheduler::Start();
  5390 	TEST2(active->iStatus.Int(), KErrNone);
  5391 	TEST2(recent->CountL(), 1);
  5392 	TEST2(recent->Event().Id(), id4);
  5393 
  5394 	active->StartL();
  5395 	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
  5396 	CActiveScheduler::Start();
  5397 	TEST2(active->iStatus.Int(), KErrNone);
  5398 	TEST2(duplicate->CountL(), 3);
  5399 	TEST2(duplicate->Event().Id(), id3);
  5400 
  5401 	// Check id
  5402 	active->StartL();
  5403 	TEST(duplicate->NextL(active->iStatus));
  5404 	CActiveScheduler::Start();
  5405 	TEST2(active->iStatus.Int(), KErrNone);
  5406 	TEST2(duplicate->Event().Id(), id2);
  5407 
  5408 	// Check id
  5409 	active->StartL();
  5410 	TEST(duplicate->NextL(active->iStatus));
  5411 	CActiveScheduler::Start();
  5412 	TEST2(active->iStatus.Int(), KErrNone);
  5413 	TEST2(duplicate->Event().Id(), id1);
  5414 
  5415 	// Fetched call event
  5416 	TBuf<KLogMaxDirectionLength> fetched;
  5417 	aClient.GetString(missed, R_LOG_DIR_FETCHED);
  5418 
  5419 	// Now change the event to remove it from recent lists
  5420 	event->SetDirection(fetched);
  5421 	active->StartL();
  5422 	aClient.ChangeEvent(*event, active->iStatus);
  5423 	CActiveScheduler::Start();
  5424 	TEST2(active->iStatus.Int(), KErrNone);
  5425 
  5426 	// Check views
  5427 	active->StartL();
  5428 	TEST(recent->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  5429 	CActiveScheduler::Start();
  5430 	TEST2(active->iStatus.Int(), KErrNone);
  5431 	TEST2(recent->CountL(), 1);
  5432 	TEST2(recent->Event().Id(), id3);
  5433 
  5434 	active->StartL();
  5435 	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
  5436 	CActiveScheduler::Start();
  5437 	TEST2(active->iStatus.Int(), KErrNone);
  5438 	TEST2(duplicate->CountL(), 2);
  5439 	TEST2(duplicate->Event().Id(), id2);
  5440 	event->CopyL(duplicate->Event()); // For later
  5441 
  5442 	// Check id
  5443 	active->StartL();
  5444 	TEST(duplicate->NextL(active->iStatus));
  5445 	CActiveScheduler::Start();
  5446 	TEST2(active->iStatus.Int(), KErrNone);
  5447 	TEST2(duplicate->Event().Id(), id1);
  5448 
  5449 	// Now change the event to remove it from recent lists
  5450 	event->SetDirection(fetched);
  5451 	active->StartL();
  5452 	aClient.ChangeEvent(*event, active->iStatus);
  5453 	CActiveScheduler::Start();
  5454 	TEST2(active->iStatus.Int(), KErrNone);
  5455 
  5456 	// Check views
  5457 	active->StartL();
  5458 	TEST(recent->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  5459 	CActiveScheduler::Start();
  5460 	TEST2(active->iStatus.Int(), KErrNone);
  5461 	TEST2(recent->CountL(), 1);
  5462 	TEST2(recent->Event().Id(), id3);
  5463 
  5464 	active->StartL();
  5465 	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
  5466 	CActiveScheduler::Start();
  5467 	TEST2(active->iStatus.Int(), KErrNone);
  5468 	TEST2(duplicate->CountL(), 1);
  5469 	TEST2(duplicate->Event().Id(), id1);
  5470 	event->CopyL(duplicate->Event()); // For later
  5471 
  5472 	// Now change the event to remove it from recent lists
  5473 	event->SetDirection(fetched);
  5474 	active->StartL();
  5475 	aClient.ChangeEvent(*event, active->iStatus);
  5476 	CActiveScheduler::Start();
  5477 	TEST2(active->iStatus.Int(), KErrNone);
  5478 
  5479 	// Check views
  5480 	active->StartL();
  5481 	TEST(recent->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  5482 	CActiveScheduler::Start();
  5483 	TEST2(active->iStatus.Int(), KErrNone);
  5484 	TEST2(recent->CountL(), 1);
  5485 	TEST2(recent->Event().Id(), id3);
  5486 	event->CopyL(recent->Event()); // For later
  5487 
  5488 	// No more duplicates
  5489 	TEST(!recent->DuplicatesL(*duplicate, active->iStatus));
  5490 
  5491 	// Now change the event to remove it from recent lists
  5492 	event->SetDirection(fetched);
  5493 	active->StartL();
  5494 	aClient.ChangeEvent(*event, active->iStatus);
  5495 	CActiveScheduler::Start();
  5496 	TEST2(active->iStatus.Int(), KErrNone);
  5497 
  5498 	TEST(!recent->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  5499 
  5500 	CleanupStack::PopAndDestroy(4); // active, event, recent, duplicate
  5501 	}
  5502 
  5503 CBaBackupSessionWrapper* theBackup = NULL;
  5504 
  5505 LOCAL_C TBool IsLogOpenL()
  5506 	{
  5507 	return TestUtils::IsDatabaseOpenL();
  5508 	}
  5509 
  5510 LOCAL_C void TestLogOpenL()
  5511 	{
  5512 	TEST(IsLogOpenL());
  5513 	}
  5514 
  5515 LOCAL_C void TestLogClosedL()
  5516 	{
  5517 	TEST(!IsLogOpenL());
  5518 	}
  5519 
  5520 LOCAL_C void StartBackupL()
  5521 	{
  5522 	User::InfoPrint(_L("Backup"));
  5523 
  5524 	TDriveUnit driveUnit(EDriveC);
  5525 	TDriveName name = driveUnit.Name();
  5526 
  5527 	TParse parse;
  5528 	LEAVE_IF_ERROR(parse.Set(KLogDatabaseName, &name, NULL));
  5529 
  5530 	delete theBackup;
  5531 	theBackup = NULL;
  5532 	theBackup = CBaBackupSessionWrapper::NewL();
  5533 
  5534 	theBackup->CloseFileL(parse.FullName(), MBackupObserver::EReleaseLockNoAccess);
  5535 	User::After(1000000);
  5536 	}
  5537 
  5538 LOCAL_C void EndBackupL()
  5539 	{
  5540 	delete theBackup;
  5541 	theBackup = NULL;
  5542 	User::After(1000000);
  5543 	}
  5544 
  5545 LOCAL_C void DelayL(TInt aDelay)
  5546 	{
  5547 	CTestTimer* timer = CTestTimer::NewL();
  5548 	timer->After(aDelay);
  5549 	CActiveScheduler::Start();
  5550 	delete timer;
  5551 	}
  5552 
  5553 /**
  5554 @SYMTestCaseID          SYSLIB-LOGENG-CT-0959
  5555 @SYMTestCaseDesc	    Tests for log view change observer
  5556 						Test change stuff with backup
  5557 @SYMTestPriority 	    High
  5558 @SYMTestActions  	    Check that a view doesn't get change events when clearing duplicates even after backup
  5559 @SYMTestExpectedResults Test must not fail
  5560 @SYMREQ                 REQ0000
  5561 */
  5562 LOCAL_C void TestHiddenChangeEvents1aL(CLogClient& aClient)
  5563 	{
  5564 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0959 "));
  5565 	TLogId logId;
  5566 	TInt viewIndex;
  5567 	TLogDatabaseChangeType type;
  5568 
  5569 	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  5570 	changeObs1->StartCollectingChanges();
  5571 
  5572 
  5573 	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  5574 	CleanupStack::PushL(view);
  5575 
  5576 	CLogFilter* filter = CLogFilter::NewL();
  5577 	CleanupStack::PushL(filter);
  5578 
  5579 	CLogEvent* event = CLogEvent::NewL();
  5580 	CleanupStack::PushL(event);
  5581 
  5582 	CTestActive* active = new(ELeave)CTestActive();
  5583 	CleanupStack::PushL(active);
  5584 
  5585 	TTime now;
  5586 	now.UniversalTime();
  5587 	now += (TTimeIntervalDays)+1;
  5588 
  5589 	// Get rid of all the events in the log
  5590 	active->StartL();
  5591 	aClient.ClearLog(now, active->iStatus);
  5592 	CActiveScheduler::Start();
  5593 	TEST2(active->iStatus.Int(), KErrNone);
  5594 
  5595 	// Incoming call event
  5596 	event->SetEventType(KLogCallEventTypeUid);
  5597 	TBuf<KLogMaxDirectionLength> buf;
  5598 	aClient.GetString(buf, R_LOG_DIR_IN);
  5599 	event->SetDirection(buf);
  5600 
  5601 	// Add an event
  5602 	active->StartL();
  5603 	aClient.AddEvent(*event, active->iStatus);
  5604 	CActiveScheduler::Start();
  5605 	TEST2(active->iStatus.Int(), KErrNone);
  5606 
  5607 	// Setup normal event view
  5608 	active->StartL();
  5609 	TEST(view->SetFilterL(*filter, active->iStatus));
  5610 	CActiveScheduler::Start();
  5611 	TEST2(active->iStatus.Int(), KErrNone);
  5612 
  5613 	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  5614 	changeObs2->StartCollectingChanges();
  5615 
  5616 	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  5617 	CleanupStack::PushL(recent);
  5618 
  5619 	// Check recent view
  5620 	active->StartL();
  5621 	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  5622 	CActiveScheduler::Start();
  5623 	TEST2(active->iStatus.Int(), KErrNone);
  5624 	TEST2(recent->CountL(), 1);
  5625 
  5626 	// Add a new event
  5627 	active->StartL();
  5628 	aClient.AddEvent(*event, active->iStatus);
  5629 	CActiveScheduler::Start();
  5630 	TEST2(active->iStatus.Int(), KErrNone);
  5631 
  5632 	// Check that changes work after a backup
  5633 	StartBackupL();
  5634 	DelayL(1000000);
  5635 	TestLogClosedL();
  5636 	EndBackupL();
  5637 	DelayL(1000000);
  5638 	TestLogOpenL();
  5639 	
  5640 	TEST2(changeObs2->Changes().Count(), 2);
  5641 	type = changeObs2->Changes().At(0, logId, viewIndex);
  5642 	TEST2(type, ELogChangeTypeEventAdded);
  5643 	type = changeObs2->Changes().At(1, logId, viewIndex);
  5644 	TEST2(type, ELogChangeTypeEventDeleted);
  5645 
  5646 	// Check recent view
  5647 	active->StartL();
  5648 	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  5649 	CActiveScheduler::Start();
  5650 	TEST2(active->iStatus.Int(), KErrNone);
  5651 	TEST2(recent->CountL(), 1);
  5652 
  5653 	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  5654 	CleanupStack::PushL(duplicate);
  5655 
  5656 	// Check duplicate count
  5657 	active->StartL();
  5658 	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
  5659 	CActiveScheduler::Start();
  5660 	TEST2(active->iStatus.Int(), KErrNone);
  5661 	TEST2(duplicate->CountL(), 1);
  5662 
  5663 	// Check that changes work after a backup
  5664 	StartBackupL();
  5665 	DelayL(1000000);
  5666 	TestLogClosedL();
  5667 	EndBackupL();
  5668 	TestLogOpenL();
  5669 
  5670 	// Check change events
  5671 	User::After(100000);
  5672 	TEST2(changeObs1->Changes().Count(), 1);
  5673 	type = changeObs1->Changes().At(0, logId, viewIndex);
  5674 	TEST2(type, ELogChangeTypeEventAdded);
  5675 
  5676 	CleanupStack::PopAndDestroy(8, changeObs1); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
  5677 	}
  5678 
  5679 /**
  5680 Check that a view doesn't get change events when recent list purged
  5681 
  5682 @SYMTestCaseID          SYSLIB-LOGENG-CT-0960
  5683 @SYMTestCaseDesc	    Tests for log view change observer
  5684 @SYMTestPriority 	    High
  5685 @SYMTestActions  	    Check that a view doesn't get change events when recent list purged,even after backup
  5686 @SYMTestExpectedResults Test must not fail
  5687 @SYMREQ                 REQ0000
  5688 */
  5689 LOCAL_C void TestHiddenChangeEvents2aL(CLogClient& aClient)
  5690 	{
  5691 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0960 "));
  5692 	TLogId logId;
  5693 	TInt viewIndex;
  5694 	TLogDatabaseChangeType type;
  5695 
  5696 	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  5697 	changeObs1->StartCollectingChanges();
  5698 
  5699 	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  5700 	CleanupStack::PushL(view);
  5701 
  5702 	CLogFilter* filter = CLogFilter::NewL();
  5703 	CleanupStack::PushL(filter);
  5704 
  5705 	CLogEvent* event = CLogEvent::NewL();
  5706 	CleanupStack::PushL(event);
  5707 
  5708 	CTestActive* active = new(ELeave)CTestActive();
  5709 	CleanupStack::PushL(active);
  5710 
  5711 	TTime now;
  5712 	now.UniversalTime();
  5713 	now += (TTimeIntervalDays)+1;
  5714 
  5715 	// Get rid of all the events in the log
  5716 	active->StartL();
  5717 	aClient.ClearLog(now, active->iStatus);
  5718 	CActiveScheduler::Start();
  5719 	TEST2(active->iStatus.Int(), KErrNone);
  5720 
  5721 	// Get config
  5722 	TLogConfig config;
  5723 	active->StartL();
  5724 	aClient.GetConfig(config, active->iStatus);
  5725 	CActiveScheduler::Start();
  5726 	TEST2(active->iStatus.Int(), KErrNone);
  5727 
  5728 	// Incoming call event
  5729 	event->SetEventType(KLogCallEventTypeUid);
  5730 	TBuf<KLogMaxDirectionLength> buf;
  5731 	aClient.GetString(buf, R_LOG_DIR_IN);
  5732 	event->SetDirection(buf);
  5733 
  5734 	// Add max allowed events
  5735 	TInt count = config.iMaxRecentLogSize;
  5736 	while(count--)
  5737 		{
  5738 		event->SetContact(count+1);
  5739 		active->StartL();
  5740 		aClient.AddEvent(*event, active->iStatus);
  5741 		CActiveScheduler::Start();
  5742 		TEST2(active->iStatus.Int(), KErrNone);
  5743 		}
  5744 
  5745 	// Setup normal event view
  5746 	active->StartL();
  5747 	TEST(view->SetFilterL(*filter, active->iStatus));
  5748 	CActiveScheduler::Start();
  5749 	TEST2(active->iStatus.Int(), KErrNone);
  5750 
  5751 	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  5752 	changeObs2->StartCollectingChanges();
  5753 
  5754 	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  5755 	CleanupStack::PushL(recent);
  5756 
  5757 	// Check recent view
  5758 	active->StartL();
  5759 	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  5760 	CActiveScheduler::Start();
  5761 	TEST2(active->iStatus.Int(), KErrNone);
  5762 	TEST2(recent->CountL(), config.iMaxRecentLogSize);
  5763 
  5764 	// Add a new event, will cause one to be purged from recent view
  5765 	event->SetContact(1234);
  5766 	active->StartL();
  5767 	aClient.AddEvent(*event, active->iStatus);
  5768 	CActiveScheduler::Start();
  5769 	TEST2(active->iStatus.Int(), KErrNone);
  5770 
  5771 	// Check that changes work after a backup
  5772 	StartBackupL();
  5773 	DelayL(1000000);
  5774 	TestLogClosedL();
  5775 	EndBackupL();
  5776 	TestLogOpenL();
  5777 	DelayL(1000000);
  5778 		
  5779 	TEST2(changeObs2->Changes().Count(), 2);
  5780 	type = changeObs2->Changes().At(0, logId, viewIndex);
  5781 	TEST2(type, ELogChangeTypeEventAdded);
  5782 	type = changeObs2->Changes().At(1, logId, viewIndex);
  5783 	TEST2(type, ELogChangeTypeEventDeleted);
  5784 
  5785 	// Check recent view
  5786 	active->StartL();
  5787 	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  5788 	CActiveScheduler::Start();
  5789 	TEST2(active->iStatus.Int(), KErrNone);
  5790 	TEST2(recent->CountL(), config.iMaxRecentLogSize);
  5791 
  5792 	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  5793 	CleanupStack::PushL(duplicate);
  5794 
  5795 	// Check duplicate count
  5796 	TEST(!recent->DuplicatesL(*duplicate, active->iStatus));
  5797 
  5798 	// Check that changes work after a backup
  5799 	StartBackupL();
  5800 	DelayL(1000000);
  5801 	TestLogClosedL();
  5802 	EndBackupL();
  5803 	TestLogOpenL();
  5804 
  5805 	// Check change events
  5806 	User::After(100000);
  5807 	TEST2(changeObs1->Changes().Count(), 1);
  5808 	type = changeObs1->Changes().At(0, logId, viewIndex);
  5809 	TEST2(type, ELogChangeTypeEventAdded);
  5810 
  5811 	CleanupStack::PopAndDestroy(8, changeObs1); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
  5812 	}
  5813 
  5814 /**
  5815 Check that a view doesn't get change events when recent list purged after changing config
  5816 
  5817 @SYMTestCaseID          SYSLIB-LOGENG-CT-0961
  5818 @SYMTestCaseDesc	    Tests for log view change observer
  5819 @SYMTestPriority 	    High
  5820 @SYMTestActions  	    Check that a view doesn't get change events when recent list purged after changing config,even after backup
  5821 @SYMTestExpectedResults Test must not fail
  5822 @SYMREQ                 REQ0000
  5823 */
  5824 LOCAL_C void TestHiddenChangeEvents3aL(CLogClient& aClient)
  5825 	{
  5826 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0961 "));
  5827 	TLogId logId;
  5828 	TInt viewIndex;
  5829 	TLogDatabaseChangeType type;
  5830 
  5831 	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  5832 	changeObs1->StartCollectingChanges();
  5833 
  5834 	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  5835 	CleanupStack::PushL(view);
  5836 
  5837 	CLogFilter* filter = CLogFilter::NewL();
  5838 	CleanupStack::PushL(filter);
  5839 
  5840 	CLogEvent* event = CLogEvent::NewL();
  5841 	CleanupStack::PushL(event);
  5842 
  5843 	CTestActive* active = new(ELeave)CTestActive();
  5844 	CleanupStack::PushL(active);
  5845 
  5846 	TTime now;
  5847 	now.UniversalTime();
  5848 	now += (TTimeIntervalDays)+1;
  5849 
  5850 	// Get rid of all the events in the log
  5851 	active->StartL();
  5852 	aClient.ClearLog(now, active->iStatus);
  5853 	CActiveScheduler::Start();
  5854 	TEST2(active->iStatus.Int(), KErrNone);
  5855 
  5856 	// Get and set config
  5857 	TLogConfig config;
  5858 	active->StartL();
  5859 	aClient.GetConfig(config, active->iStatus);
  5860 	CActiveScheduler::Start();
  5861 	TEST2(active->iStatus.Int(), KErrNone);
  5862 	config.iMaxRecentLogSize = 2;
  5863 	active->StartL();
  5864 	aClient.ChangeConfig(config, active->iStatus);
  5865 	CActiveScheduler::Start();
  5866 	TEST2(active->iStatus.Int(), KErrNone);
  5867 
  5868 	// Incoming call event
  5869 	event->SetEventType(KLogCallEventTypeUid);
  5870 	TBuf<KLogMaxDirectionLength> buf;
  5871 	aClient.GetString(buf, R_LOG_DIR_IN);
  5872 	event->SetDirection(buf);
  5873 
  5874 	// Add max allowed events
  5875 	TInt count = config.iMaxRecentLogSize;
  5876 	while(count--)
  5877 		{
  5878 		event->SetContact(count+1);
  5879 		active->StartL();
  5880 		aClient.AddEvent(*event, active->iStatus);
  5881 		CActiveScheduler::Start();
  5882 		TEST2(active->iStatus.Int(), KErrNone);
  5883 		}
  5884 
  5885 	// Setup normal event view
  5886 	active->StartL();
  5887 	TEST(view->SetFilterL(*filter, active->iStatus));
  5888 	CActiveScheduler::Start();
  5889 	TEST2(active->iStatus.Int(), KErrNone);
  5890 
  5891 	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  5892 	changeObs2->StartCollectingChanges();
  5893 
  5894 	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  5895 	CleanupStack::PushL(recent);
  5896 
  5897 	// Check recent view
  5898 	active->StartL();
  5899 	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  5900 	CActiveScheduler::Start();
  5901 	TEST2(active->iStatus.Int(), KErrNone);
  5902 	TEST2(recent->CountL(), config.iMaxRecentLogSize);
  5903 
  5904 	// Change config, will cause one event to be purged from recent view
  5905 	config.iMaxRecentLogSize = 1;
  5906 	active->StartL();
  5907 	aClient.ChangeConfig(config, active->iStatus);
  5908 	CActiveScheduler::Start();
  5909 	TEST2(active->iStatus.Int(), KErrNone);
  5910 
  5911 	// Check that changes work after a backup
  5912 	StartBackupL();
  5913 	DelayL(1000000);
  5914 	TestLogClosedL();
  5915 	EndBackupL();
  5916 	TestLogOpenL();
  5917 	DelayL(1000000);
  5918 
  5919 	// Check change events
  5920 	User::After(100000);
  5921 	TEST2(changeObs2->Changes().Count(), 1);
  5922 	type = changeObs2->Changes().At(0, logId, viewIndex);
  5923 	TEST2(type, ELogChangeTypeEventDeleted);
  5924 
  5925 	// Check recent view
  5926 	active->StartL();
  5927 	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  5928 	CActiveScheduler::Start();
  5929 	TEST2(active->iStatus.Int(), KErrNone);
  5930 	TEST2(recent->CountL(), config.iMaxRecentLogSize);
  5931 
  5932 	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  5933 	CleanupStack::PushL(duplicate);
  5934 
  5935 	// Check duplicate count
  5936 	TEST(!recent->DuplicatesL(*duplicate, active->iStatus));
  5937 
  5938 	// Check that changes work after a backup
  5939 	StartBackupL();
  5940 	DelayL(1000000);
  5941 	TestLogClosedL();
  5942 	EndBackupL();
  5943 	TestLogOpenL();
  5944 
  5945 	// Check change events
  5946 	User::After(100000);
  5947 	TEST(!changeObs1->HaveChanges());
  5948 
  5949 	CleanupStack::PopAndDestroy(8, changeObs1); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
  5950 	}
  5951 
  5952 /**
  5953 Check that when deleting an event causing recent lists to be updated, views don't get unnecessary change events
  5954 
  5955 @SYMTestCaseID          SYSLIB-LOGENG-CT-0962
  5956 @SYMTestCaseDesc	    Tests for log view change observer
  5957 @SYMTestPriority 	    High
  5958 @SYMTestActions  	    Check that when deleting an event causing recent lists to be updated,views don't get unnecessary change events.
  5959                         Check the test work even after backup operations
  5960 @SYMTestExpectedResults Test must not fail
  5961 @SYMREQ                 REQ0000
  5962 */
  5963 LOCAL_C void TestHiddenChangeEvents4aL(CLogClient& aClient)
  5964 	{
  5965 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0962 "));
  5966 	TLogId logId;
  5967 	TInt viewIndex;
  5968 	TLogDatabaseChangeType type;
  5969 
  5970 	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  5971 	changeObs1->StartCollectingChanges();
  5972 
  5973 	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  5974 	CleanupStack::PushL(view);
  5975 
  5976 	CLogFilter* filter = CLogFilter::NewL();
  5977 	CleanupStack::PushL(filter);
  5978 	filter->SetFlags(1); // Need to hide an event from the view
  5979 
  5980 	CLogEvent* event = CLogEvent::NewL();
  5981 	CleanupStack::PushL(event);
  5982 
  5983 	CTestActive* active = new(ELeave)CTestActive();
  5984 	CleanupStack::PushL(active);
  5985 
  5986 	TTime now;
  5987 	now.UniversalTime();
  5988 	now += (TTimeIntervalDays)+1;
  5989 
  5990 	// Get rid of all the events in the log
  5991 	active->StartL();
  5992 	aClient.ClearLog(now, active->iStatus);
  5993 	CActiveScheduler::Start();
  5994 	TEST2(active->iStatus.Int(), KErrNone);
  5995 
  5996 	// Incoming call event
  5997 	event->SetEventType(KLogCallEventTypeUid);
  5998 	TBuf<KLogMaxDirectionLength> buf;
  5999 	aClient.GetString(buf, R_LOG_DIR_IN);
  6000 	event->SetDirection(buf);
  6001 
  6002 	event->SetFlags(1);
  6003 
  6004 	// Add an event
  6005 	active->StartL();
  6006 	aClient.AddEvent(*event, active->iStatus);
  6007 	CActiveScheduler::Start();
  6008 	TEST2(active->iStatus.Int(), KErrNone);
  6009 
  6010 	// Add an event
  6011 	active->StartL();
  6012 	aClient.AddEvent(*event, active->iStatus);
  6013 	CActiveScheduler::Start();
  6014 	TEST2(active->iStatus.Int(), KErrNone);
  6015 
  6016 	event->ClearFlags(0xF);
  6017 
  6018 	// Add an event
  6019 	active->StartL();
  6020 	aClient.AddEvent(*event, active->iStatus);
  6021 	CActiveScheduler::Start();
  6022 	TEST2(active->iStatus.Int(), KErrNone);
  6023 
  6024 	// Setup normal event view
  6025 	active->StartL();
  6026 	TEST(view->SetFilterL(*filter, active->iStatus));
  6027 	CActiveScheduler::Start();
  6028 	TEST2(active->iStatus.Int(), KErrNone);
  6029 	TEST2(view->CountL(), 2);
  6030 
  6031 	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  6032 	changeObs2->StartCollectingChanges();
  6033 
  6034 	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  6035 	CleanupStack::PushL(recent);
  6036 
  6037 	// Check recent view
  6038 	active->StartL();
  6039 	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  6040 	CActiveScheduler::Start();
  6041 	TEST2(active->iStatus.Int(), KErrNone);
  6042 	TEST2(recent->CountL(), 1);
  6043 
  6044 	changeObs1->StartCollectingChanges();
  6045 	changeObs2->StartCollectingChanges();
  6046 
  6047 	// Delete the event in recent list
  6048 	active->StartL();
  6049 	aClient.DeleteEvent(event->Id(), active->iStatus);
  6050 	CActiveScheduler::Start();
  6051 	TEST2(active->iStatus.Int(), KErrNone);
  6052 
  6053 	// Check that changes work after a backup
  6054 	StartBackupL();
  6055 	DelayL(1000000);
  6056 	TestLogClosedL();
  6057 	EndBackupL();
  6058 	TestLogOpenL();
  6059 
  6060 	// Check change events
  6061 	TEST2(changeObs2->Changes().Count(), 2);
  6062 	type = changeObs2->Changes().At(0, logId, viewIndex);
  6063 	TEST2(type, ELogChangeTypeEventAdded);
  6064 	type = changeObs2->Changes().At(1, logId, viewIndex);
  6065 	TEST2(type, ELogChangeTypeEventDeleted);
  6066 
  6067 	TEST(!changeObs1->HaveChanges());
  6068 
  6069 	CleanupStack::PopAndDestroy(7, changeObs1); // changeObs1, changeObs2, view, filter, event, active, recent
  6070 	}
  6071 
  6072 /**
  6073 @SYMTestCaseID          SYSLIB-LOGENG-CT-0963
  6074 @SYMTestCaseDesc	    Tests for log view change observer
  6075 @SYMTestPriority 	    High
  6076 @SYMTestActions  	    Check that a view doesn't get change events when recent list cleared
  6077                         Check the test work even after backup operations
  6078 @SYMTestExpectedResults Test must not fail
  6079 @SYMREQ                 REQ0000
  6080 */
  6081 LOCAL_C void TestHiddenChangeEvents5aL(CLogClient& aClient)
  6082 	{
  6083 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0963 "));
  6084 	TLogId logId;
  6085 	TInt viewIndex;
  6086 	TLogDatabaseChangeType type;
  6087 
  6088 	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  6089 	changeObs1->StartCollectingChanges();
  6090 
  6091 	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  6092 	CleanupStack::PushL(view);
  6093 
  6094 	CLogFilter* filter = CLogFilter::NewL();
  6095 	CleanupStack::PushL(filter);
  6096 
  6097 	CLogEvent* event = CLogEvent::NewL();
  6098 	CleanupStack::PushL(event);
  6099 
  6100 	CTestActive* active = new(ELeave)CTestActive();
  6101 	CleanupStack::PushL(active);
  6102 
  6103 	TTime now;
  6104 	now.UniversalTime();
  6105 	now += (TTimeIntervalDays)+1;
  6106 
  6107 	// Get rid of all the events in the log
  6108 	active->StartL();
  6109 	aClient.ClearLog(now, active->iStatus);
  6110 	CActiveScheduler::Start();
  6111 	TEST2(active->iStatus.Int(), KErrNone);
  6112 
  6113 	// Get config
  6114 	TLogConfig config;
  6115 	active->StartL();
  6116 	aClient.GetConfig(config, active->iStatus);
  6117 	CActiveScheduler::Start();
  6118 	TEST2(active->iStatus.Int(), KErrNone);
  6119 
  6120 	// Incoming call event
  6121 	event->SetEventType(KLogCallEventTypeUid);
  6122 	TBuf<KLogMaxDirectionLength> buf;
  6123 	aClient.GetString(buf, R_LOG_DIR_IN);
  6124 	event->SetDirection(buf);
  6125 
  6126 	// Add max allowed events
  6127 	TInt count = config.iMaxRecentLogSize;
  6128 	while(count--)
  6129 		{
  6130 		event->SetContact(count+1);
  6131 		active->StartL();
  6132 		aClient.AddEvent(*event, active->iStatus);
  6133 		CActiveScheduler::Start();
  6134 		TEST2(active->iStatus.Int(), KErrNone);
  6135 		}
  6136 
  6137 	// Setup normal event view
  6138 	active->StartL();
  6139 	TEST(view->SetFilterL(*filter, active->iStatus));
  6140 	CActiveScheduler::Start();
  6141 	TEST2(active->iStatus.Int(), KErrNone);
  6142 
  6143 	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  6144 	changeObs2->StartCollectingChanges();
  6145 
  6146 	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  6147 	CleanupStack::PushL(recent);
  6148 
  6149 	// Check recent view
  6150 	active->StartL();
  6151 	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  6152 	CActiveScheduler::Start();
  6153 	TEST2(active->iStatus.Int(), KErrNone);
  6154 	TEST2(recent->CountL(), config.iMaxRecentLogSize);
  6155 
  6156 	// Clear recent view
  6157 	active->StartL();
  6158 	aClient.ClearLog(KLogRecentIncomingCalls, active->iStatus);
  6159 	CActiveScheduler::Start();
  6160 	TEST2(active->iStatus.Int(), KErrNone);
  6161 
  6162 	// Check that changes work after a backup
  6163 	StartBackupL();
  6164 	DelayL(1000000);
  6165 	TestLogClosedL();
  6166 	EndBackupL();
  6167 	TestLogOpenL();
  6168 
  6169 	count = config.iMaxRecentLogSize;
  6170 	TEST2(changeObs2->Changes().Count(), count);
  6171 	while(count--)
  6172 		{
  6173 		type = changeObs2->Changes().At(count, logId, viewIndex);
  6174 		TEST2(type, ELogChangeTypeEventDeleted);
  6175 		}
  6176 
  6177 	// Check recent view
  6178 	TEST(!recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  6179 
  6180 	// Check that changes work after a backup
  6181 	StartBackupL();
  6182 	DelayL(1000000);
  6183 	TestLogClosedL();
  6184 	EndBackupL();
  6185 	TestLogOpenL();
  6186 
  6187 	// Check change events
  6188 	User::After(100000);
  6189 	TEST(!changeObs1->HaveChanges());
  6190 
  6191 	CleanupStack::PopAndDestroy(7, changeObs1); // changeObs1, changeObs2, view, filter, event, active, recent
  6192 	}
  6193 
  6194 /**
  6195 @SYMTestCaseID          SYSLIB-LOGENG-CT-0964
  6196 @SYMTestCaseDesc	    Tests for log view change observer
  6197 @SYMTestPriority 	    High
  6198 @SYMTestActions  	    Check that a view doesn't get change events when removing events from a recent or duplicate view
  6199                         Check the test work even after backup operations
  6200 @SYMTestExpectedResults Test must not fail
  6201 @SYMREQ                 REQ0000
  6202 */
  6203 LOCAL_C void TestHiddenChangeEvents6aL(CLogClient& aClient)
  6204 	{
  6205 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0964 "));
  6206 	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  6207 	changeObs1->StartCollectingChanges();
  6208 
  6209 	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  6210 	CleanupStack::PushL(view);
  6211 
  6212 	CLogFilter* filter = CLogFilter::NewL();
  6213 	CleanupStack::PushL(filter);
  6214 
  6215 	CLogEvent* event = CLogEvent::NewL();
  6216 	CleanupStack::PushL(event);
  6217 
  6218 	CTestActive* active = new(ELeave)CTestActive();
  6219 	CleanupStack::PushL(active);
  6220 
  6221 	TTime now;
  6222 	now.UniversalTime();
  6223 	now += (TTimeIntervalDays)+1;
  6224 
  6225 	// Get rid of all the events in the log
  6226 	active->StartL();
  6227 	aClient.ClearLog(now, active->iStatus);
  6228 	CActiveScheduler::Start();
  6229 	TEST2(active->iStatus.Int(), KErrNone);
  6230 
  6231 	// Incoming call event
  6232 	event->SetEventType(KLogCallEventTypeUid);
  6233 	TBuf<KLogMaxDirectionLength> buf;
  6234 	aClient.GetString(buf, R_LOG_DIR_IN);
  6235 	event->SetDirection(buf);
  6236 
  6237 	// Add an event
  6238 	active->StartL();
  6239 	aClient.AddEvent(*event, active->iStatus);
  6240 	CActiveScheduler::Start();
  6241 	TEST2(active->iStatus.Int(), KErrNone);
  6242 
  6243 	// Add a duplicate
  6244 	active->StartL();
  6245 	aClient.AddEvent(*event, active->iStatus);
  6246 	CActiveScheduler::Start();
  6247 	TEST2(active->iStatus.Int(), KErrNone);
  6248 
  6249 	// Setup normal event view
  6250 	active->StartL();
  6251 	TEST(view->SetFilterL(*filter, active->iStatus));
  6252 	CActiveScheduler::Start();
  6253 	TEST2(active->iStatus.Int(), KErrNone);
  6254 	TEST(view->CountL() == 2);
  6255 
  6256 	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  6257 	changeObs2->StartCollectingChanges();
  6258 
  6259 	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  6260 	CleanupStack::PushL(recent);
  6261 
  6262 	// Check recent view
  6263 	active->StartL();
  6264 	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  6265 	CActiveScheduler::Start();
  6266 	TEST2(active->iStatus.Int(), KErrNone);
  6267 	TEST2(recent->CountL(), 1);
  6268 
  6269 	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  6270 	CleanupStack::PushL(duplicate);
  6271 
  6272 	// Check duplicate count
  6273 	active->StartL();
  6274 	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
  6275 	CActiveScheduler::Start();
  6276 	TEST2(active->iStatus.Int(), KErrNone);
  6277 	TEST2(recent->CountL(), 1);
  6278 
  6279 	// Remove duplicate
  6280 	duplicate->RemoveL(duplicate->Event().Id());
  6281 
  6282 	// Check that changes work after a backup
  6283 	StartBackupL();
  6284 	DelayL(1000000);
  6285 	TestLogClosedL();
  6286 	EndBackupL();
  6287 	TestLogOpenL();
  6288 
  6289 	// Check change events
  6290 	TEST(!changeObs1->HaveChanges());
  6291 	TEST(!changeObs2->HaveChanges());
  6292 
  6293 	// Remove recent
  6294 	recent->RemoveL(recent->Event().Id());
  6295 
  6296 	// Check that changes work after a backup
  6297 	StartBackupL();
  6298 	DelayL(1000000);
  6299 	TestLogClosedL();
  6300 	EndBackupL();
  6301 	TestLogOpenL();
  6302 
  6303 	TEST(!changeObs1->HaveChanges());
  6304 	TEST(!changeObs2->HaveChanges()); // No event because we should know we called Remove on ourselves
  6305 
  6306 	CleanupStack::PopAndDestroy(8, changeObs1); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
  6307 	}
  6308 
  6309 /**
  6310 @SYMTestCaseID          SYSLIB-LOGENG-CT-0965
  6311 @SYMTestCaseDesc	    Tests for log view change observer
  6312 @SYMTestPriority 	    High
  6313 @SYMTestActions  	    Check that a view doesn't get change events when clearing duplicates
  6314                         Check the test work even after backup operations
  6315 @SYMTestExpectedResults Test must not fail
  6316 @SYMREQ                 REQ0000
  6317 */
  6318 LOCAL_C void TestHiddenChangeEvents7aL(CLogClient& aClient)
  6319 	{
  6320 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0965 "));
  6321 	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  6322 	changeObs1->StartCollectingChanges();
  6323 
  6324 	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  6325 	CleanupStack::PushL(view);
  6326 
  6327 	CLogFilter* filter = CLogFilter::NewL();
  6328 	CleanupStack::PushL(filter);
  6329 
  6330 	CLogEvent* event = CLogEvent::NewL();
  6331 	CleanupStack::PushL(event);
  6332 
  6333 	CTestActive* active = new(ELeave)CTestActive();
  6334 	CleanupStack::PushL(active);
  6335 
  6336 	TTime now;
  6337 	now.UniversalTime();
  6338 	now += (TTimeIntervalDays)+1;
  6339 
  6340 	// Get rid of all the events in the log
  6341 	active->StartL();
  6342 	aClient.ClearLog(now, active->iStatus);
  6343 	CActiveScheduler::Start();
  6344 	TEST2(active->iStatus.Int(), KErrNone);
  6345 
  6346 	// Incoming call event
  6347 	event->SetEventType(KLogCallEventTypeUid);
  6348 	TBuf<KLogMaxDirectionLength> buf;
  6349 	aClient.GetString(buf, R_LOG_DIR_IN);
  6350 	event->SetDirection(buf);
  6351 
  6352 	// Add an event
  6353 	active->StartL();
  6354 	aClient.AddEvent(*event, active->iStatus);
  6355 	CActiveScheduler::Start();
  6356 	TEST2(active->iStatus.Int(), KErrNone);
  6357 
  6358 	// Add a duplicate
  6359 	active->StartL();
  6360 	aClient.AddEvent(*event, active->iStatus);
  6361 	CActiveScheduler::Start();
  6362 	TEST2(active->iStatus.Int(), KErrNone);
  6363 
  6364 	// Setup normal event view
  6365 	active->StartL();
  6366 	TEST(view->SetFilterL(*filter, active->iStatus));
  6367 	CActiveScheduler::Start();
  6368 	TEST2(active->iStatus.Int(), KErrNone);
  6369 	TEST2(view->CountL(), 2);
  6370 
  6371 	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  6372 	changeObs2->StartCollectingChanges();
  6373 
  6374 	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  6375 	CleanupStack::PushL(recent);
  6376 
  6377 	// Check recent view
  6378 	active->StartL();
  6379 	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  6380 	CActiveScheduler::Start();
  6381 	TEST2(active->iStatus.Int(), KErrNone);
  6382 	TEST2(recent->CountL(), 1);
  6383 
  6384 	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  6385 	CleanupStack::PushL(duplicate);
  6386 
  6387 	// Check duplicate count
  6388 	active->StartL();
  6389 	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
  6390 	CActiveScheduler::Start();
  6391 	TEST2(active->iStatus.Int(), KErrNone);
  6392 	TEST2(recent->CountL(), 1);
  6393 
  6394 	// Remove duplicate
  6395 	recent->ClearDuplicatesL();
  6396 
  6397 	// Check that changes work after a backup
  6398 	StartBackupL();
  6399 	DelayL(1000000);
  6400 	TestLogClosedL();
  6401 	EndBackupL();
  6402 	TestLogOpenL();
  6403 
  6404 	// Check change events
  6405 	TEST(!changeObs1->HaveChanges());
  6406 	TEST(!changeObs2->HaveChanges());
  6407 
  6408 	CleanupStack::PopAndDestroy(8, changeObs1); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
  6409 	}
  6410 	
  6411 /**
  6412 @SYMTestCaseID          SYSLIB-LOGENG-CT-3511
  6413 @SYMTestCaseDesc	    Tests an error condition for adding an event.                       
  6414 @SYMTestPriority 	    High
  6415 @SYMTestActions  	    A leave will be caused in an observer when a specific event is added. This test 
  6416                         ensures by successful test completion that there are no panics in this 
  6417                         situation.
  6418 @SYMTestExpectedResults Test must not fail
  6419 @SYMDEF                 DEF108741
  6420 */
  6421 LOCAL_C void DEF108741L(CLogClient& aClient)
  6422 	{
  6423 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-3511 "));
  6424 	// Perform clean up
  6425  	TestUtils::DeleteDatabaseL();
  6426 
  6427 	// Create a new event 
  6428 	CLogEvent* event = CLogEvent::NewL();
  6429 	CleanupStack::PushL(event);
  6430 	event->SetEventType(KLogCallEventTypeUid);
  6431 
  6432 	CTestActive* active = new(ELeave) CTestActive();
  6433 	CleanupStack::PushL(active);
  6434 
  6435 	// Create a change observer. This observer will cause errors in order to verify that 
  6436 	// the system handles them properly.
  6437 	CLogViewChangeObserverErrorTest* changeObs = CLogViewChangeObserverErrorTest::NewLC();
  6438 
  6439 	// Create a view for the event log  
  6440 	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs);
  6441 	CleanupStack::PushL(view);
  6442 	
  6443 	// Create a filter to specify what events appear in the view
  6444 	CLogFilter* filter = CLogFilter::NewL();
  6445 	CleanupStack::PushL(filter);
  6446 	TEST(!view->SetFilterL(*filter, active->iStatus));
  6447 	 
  6448 	TInt count;
  6449 	TLogId logId;
  6450 	TInt viewIndex;
  6451  
  6452  	// This code adds 3 events with ids 0,1 and 2.
  6453  	// The observer add event handler :
  6454  	// CLogViewChangeObserverErrorTest::HandleLogViewChangeEventAddedL
  6455  	// has been written so that it will leave if an event with log id 1 is added.
  6456  	// The test completion proves that the leave is dealt with gracefully without 
  6457  	// any panics.
  6458 	for(count = 0; count < KTestErrorEventNum; count++)
  6459 		{
  6460 		// Add an event to the log database
  6461 		aClient.AddEvent(*event, changeObs->iStatus);
  6462 		CLogChangeDefinition* changes = changeObs->WaitForChangesLC(CLogViewChangeObserver::EStopOnBoth);
  6463 		
  6464 		// Check the results/notifications are as expected
  6465 		TEST2(changeObs->iStatus.Int(), KErrNone);
  6466 		TEST(event->Id() == (TLogId) count);
  6467 		User::After(1);
  6468 		TEST2(changes->Count(), 1);
  6469 		TEST2(changes->At(0, logId, viewIndex), ELogChangeTypeEventAdded);
  6470 		TEST(logId == (TLogId) count);
  6471 		TEST2(viewIndex, 0);
  6472 		CleanupStack::PopAndDestroy(changes);
  6473 		}
  6474  
  6475 	CleanupStack::PopAndDestroy(5, event); // filter, view, changeObs, active, event
  6476 	}
  6477 
  6478 /**
  6479 @SYMTestCaseID          SYSLIB-LOGENG-CT-3716
  6480 @SYMTestCaseDesc	    Tests for the defect INC108225 
  6481 @SYMTestPriority 	    High
  6482 @SYMTestActions  	    Tests for the count of out call list & the duplicates for CS & PS calls
  6483 						The fields to be considered while finding duplicates records are set in the resource file named LOGWRAP.RSS
  6484 						i.e. duplicate = ELogRemotePartyField|ELogContactField|ELogNumberField;
  6485 						Considering this duplicate value, the where clause in the query is made to find duplicate records.
  6486 @SYMTestExpectedResults Test must not fail
  6487 @SYMDEF                 INC108225
  6488 */
  6489 LOCAL_C void TestNumberFieldINC108225L(CLogClient& aClient)
  6490 {
  6491     TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-3716 ")); 
  6492 	CLogEvent* event = CLogEvent::NewL();
  6493 	CleanupStack::PushL(event);
  6494 
  6495 	CLogEvent* event1 = CLogEvent::NewL();
  6496 	CleanupStack::PushL(event1);
  6497 
  6498 	CTestActive* active = new(ELeave)CTestActive();
  6499 	CleanupStack::PushL(active);
  6500 
  6501 	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  6502 	CleanupStack::PushL(view);
  6503 
  6504 	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  6505 	CleanupStack::PushL(duplicate);
  6506 
  6507 	// Make sure there are no entries in any recent lists
  6508 	active->StartL();
  6509 	aClient.ClearLog(KLogRecentOutgoingCalls, active->iStatus);
  6510 	CActiveScheduler::Start();
  6511 	TEST2(active->iStatus.Int(), KErrNone);
  6512 	
  6513 	TLogString buf1;
  6514 	aClient.GetString(buf1, R_LOG_DIR_OUT);
  6515 
  6516 	event->SetEventType(KLogCallEventTypeUid);
  6517 	event->SetDirection(buf1);
  6518 	event->SetDurationType(KLogDurationNone);
  6519 	event->SetContact(KTestContact1);
  6520 	event->SetRemoteParty(KTestRemote1);
  6521 	event->SetNumber(KTestNumber1);
  6522 
  6523 	// Add event 1st CS Call with contact as KTestContact & number as KTestNumber1
  6524 	active->StartL();
  6525 	aClient.AddEvent(*event, active->iStatus);
  6526 	CActiveScheduler::Start();
  6527 	TEST2(active->iStatus.Int(), KErrNone);
  6528 
  6529 	active->StartL();
  6530 	TBool res = view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus);
  6531 	CActiveScheduler::Start();
  6532 	TEST2(active->iStatus.Int(), KErrNone);
  6533 	TEST2(view->CountL(), 1);
  6534 		
  6535 	// Set new event with the same contact details (i.e. KTestContact) and 
  6536 	//...event type as KLogCallEventTypeUid & no number field
  6537 	event1->SetEventType(KLogCallEventTypeUid);
  6538 	event1->SetDirection(buf1);
  6539 	event1->SetDurationType(KLogDurationNone);
  6540 	event1->SetContact(KTestContact1);
  6541 	event1->SetRemoteParty(KTestRemote1);
  6542 	
  6543 	// Add event 1st PS Call with contact as KTestContact1 & Number as Null
  6544 	active->StartL();
  6545 	aClient.AddEvent(*event1, active->iStatus);
  6546 	CActiveScheduler::Start();
  6547 	TEST2(active->iStatus.Int(), KErrNone);
  6548 
  6549 	active->StartL();
  6550 	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
  6551 	CActiveScheduler::Start();
  6552 	TEST2(active->iStatus.Int(), KErrNone);
  6553 	TEST2(view->CountL(), 2);
  6554 	
  6555 	// Add event 2nd CS Call
  6556 	active->StartL();
  6557 	aClient.AddEvent(*event, active->iStatus);
  6558 	CActiveScheduler::Start();
  6559 	TEST2(active->iStatus.Int(), KErrNone);
  6560 
  6561 	active->StartL();
  6562 	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
  6563 	CActiveScheduler::Start();
  6564 	TEST2(active->iStatus.Int(), KErrNone);
  6565 	TEST2(view->CountL(), 2);
  6566 	
  6567 	// Check duplicate count for the last call made i.e. CS call
  6568 	active->StartL();
  6569 	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  6570 	CActiveScheduler::Start();
  6571 	TEST2(duplicate->CountL(), 1);
  6572 		
  6573 	// Add event 2nd PS Call
  6574 	active->StartL();
  6575 	aClient.AddEvent(*event1, active->iStatus);
  6576 	CActiveScheduler::Start();
  6577 	TEST2(active->iStatus.Int(), KErrNone);
  6578 	
  6579 	active->StartL();
  6580 	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
  6581 	CActiveScheduler::Start();
  6582 	TEST2(active->iStatus.Int(), KErrNone);
  6583 	TEST2(view->CountL(), 2);
  6584 
  6585 	// Check duplicate count for the last call made i.e. PS call
  6586 	active->StartL();
  6587 	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  6588 	CActiveScheduler::Start();
  6589 	TEST2(duplicate->CountL(), 1);
  6590 	
  6591 	// Add event 3rd CS Call
  6592 	active->StartL();
  6593 	aClient.AddEvent(*event, active->iStatus);
  6594 	CActiveScheduler::Start();
  6595 	TEST2(active->iStatus.Int(), KErrNone);
  6596 	
  6597 	active->StartL();
  6598 	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
  6599 	CActiveScheduler::Start();
  6600 	TEST2(active->iStatus.Int(), KErrNone);
  6601 	TEST2(view->CountL(), 2);
  6602 	
  6603 	// Check duplicate count for the last call made i.e. CS call
  6604 	active->StartL();
  6605 	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  6606 	CActiveScheduler::Start();
  6607 	TEST2(duplicate->CountL(), 2);
  6608 
  6609 	// Add event 3rd PS Call
  6610 	active->StartL();
  6611 	aClient.AddEvent(*event1, active->iStatus);
  6612 	CActiveScheduler::Start();
  6613 	TEST2(active->iStatus.Int(), KErrNone);
  6614 	
  6615 	active->StartL();
  6616 	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
  6617 	CActiveScheduler::Start();
  6618 	TEST2(active->iStatus.Int(), KErrNone);
  6619 	TEST2(view->CountL(), 2);
  6620 
  6621 	// Check duplicate count for the last call made i.e. PS call
  6622 	active->StartL();
  6623 	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  6624 	CActiveScheduler::Start();
  6625 	TEST2(duplicate->CountL(), 2);
  6626 		
  6627 	CleanupStack::PopAndDestroy(5);	
  6628 }
  6629 
  6630 /**
  6631 @SYMTestCaseID          SYSLIB-LOGENG-CT-3755
  6632 @SYMTestCaseDesc	    Tests for the changes made in defect INC108225 for other fields 
  6633 @SYMTestPriority 	    High
  6634 @SYMTestActions  	    Tests for the count of out call list & the duplicates for CS calls referring other fields
  6635 						The fields to be considered while finding duplicates records are set in the resource file named LOGWRAP.RSS
  6636 						i.e. duplicate = ELogRemotePartyField|ELogContactField|ELogNumberField;
  6637 						Considering this duplicate value, the where clause in the query is made to find duplicate records.
  6638 @SYMTestExpectedResults Test must not fail
  6639 @SYMDEF                 INC108225
  6640 */
  6641 LOCAL_C void TestOtherFieldsINC108225L(CLogClient& aClient)
  6642 {
  6643     TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-3755 ")); 
  6644 	CLogEvent* event = CLogEvent::NewL();
  6645 	CleanupStack::PushL(event);
  6646 
  6647 	CTestActive* active = new(ELeave)CTestActive();
  6648 	CleanupStack::PushL(active);
  6649 
  6650 	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  6651 	CleanupStack::PushL(view);
  6652 
  6653 	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  6654 	CleanupStack::PushL(duplicate);
  6655 
  6656 	// Make sure there are no entries in any recent lists
  6657 	active->StartL();
  6658 	aClient.ClearLog(KLogRecentOutgoingCalls, active->iStatus);
  6659 	CActiveScheduler::Start();
  6660 	TEST2(active->iStatus.Int(), KErrNone);
  6661 	
  6662 	TLogString buf1;
  6663 	aClient.GetString(buf1, R_LOG_DIR_OUT);
  6664 
  6665 	event->SetEventType(KLogCallEventTypeUid);
  6666 	event->SetDirection(buf1);
  6667 	event->SetContact(KTestContact1);
  6668 	event->SetRemoteParty(KTestRemote1);
  6669 	event->SetNumber(KTestNumber1);
  6670 	event->SetDurationType(KLogDurationNone);
  6671 
  6672 	// Add event 1st CS Call with contact as KTestContact & number as KTestNumber1 &
  6673 	//.. durationtype as KLogDurationNone
  6674 	active->StartL();
  6675 	aClient.AddEvent(*event, active->iStatus);
  6676 	CActiveScheduler::Start();
  6677 	TEST2(active->iStatus.Int(), KErrNone);
  6678 
  6679 	active->StartL();
  6680 	TBool res = view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus);
  6681 	CActiveScheduler::Start();
  6682 	TEST2(active->iStatus.Int(), KErrNone);
  6683 	TEST2(view->CountL(), 1);
  6684 	
  6685 	// Add event 2nd CS Call with duration type as KLogDurationValid
  6686 	event->SetDurationType(KLogDurationValid);
  6687 	
  6688 	active->StartL();
  6689 	aClient.AddEvent(*event, active->iStatus);
  6690 	CActiveScheduler::Start();
  6691 	TEST2(active->iStatus.Int(), KErrNone);
  6692 
  6693 	active->StartL();
  6694 	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
  6695 	CActiveScheduler::Start();
  6696 	TEST2(active->iStatus.Int(), KErrNone);
  6697 	TEST2(view->CountL(), 1);
  6698 	
  6699 	// Check duplicate count for the last call made 
  6700 	active->StartL();
  6701 	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  6702 	CActiveScheduler::Start();
  6703 	TEST2(duplicate->CountL(), 1);
  6704 	
  6705 	// Add event 3rd CS Call with Flag as KLogNullFlags	
  6706 	event->SetFlags(KLogNullFlags);
  6707 	
  6708 	active->StartL();
  6709 	aClient.AddEvent(*event, active->iStatus);
  6710 	CActiveScheduler::Start();
  6711 	TEST2(active->iStatus.Int(), KErrNone);
  6712 	
  6713 	active->StartL();
  6714 	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
  6715 	CActiveScheduler::Start();
  6716 	TEST2(active->iStatus.Int(), KErrNone);
  6717 	TEST2(view->CountL(), 1);
  6718 	
  6719 	// Check duplicate count for the last call made 
  6720 	active->StartL();
  6721 	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  6722 	CActiveScheduler::Start();
  6723 	TEST2(duplicate->CountL(), 2);
  6724 	
  6725 	// Add event 4th CS Call with Flag as KLogFlagsMask
  6726 	event->SetFlags(KLogFlagsMask);
  6727 	
  6728 	active->StartL();
  6729 	aClient.AddEvent(*event, active->iStatus);
  6730 	CActiveScheduler::Start();
  6731 	TEST2(active->iStatus.Int(), KErrNone);
  6732 	
  6733 	active->StartL();
  6734 	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
  6735 	CActiveScheduler::Start();
  6736 	TEST2(active->iStatus.Int(), KErrNone);
  6737 	TEST2(view->CountL(), 1);
  6738 	
  6739 	// Check duplicate count for the last call made 
  6740 	active->StartL();
  6741 	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  6742 	CActiveScheduler::Start();
  6743 	TEST2(duplicate->CountL(), 3);
  6744 
  6745 	// Add event 5th CS Call with Status as KNullDesC
  6746 	event->SetStatus(KNullDesC);
  6747 	
  6748 	active->StartL();
  6749 	aClient.AddEvent(*event, active->iStatus);
  6750 	CActiveScheduler::Start();
  6751 	TEST2(active->iStatus.Int(), KErrNone);
  6752 	
  6753 	active->StartL();
  6754 	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
  6755 	CActiveScheduler::Start();
  6756 	TEST2(active->iStatus.Int(), KErrNone);
  6757 	TEST2(view->CountL(), 1);
  6758 	
  6759 	// Check duplicate count for the last call made 
  6760 	active->StartL();
  6761 	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  6762 	CActiveScheduler::Start();
  6763 	TEST2(duplicate->CountL(), 4);
  6764 	
  6765 	// Add event 6th CS Call with Status as KTestStatus1
  6766 	event->SetStatus(KTestStatus1);
  6767 	
  6768 	active->StartL();
  6769 	aClient.AddEvent(*event, active->iStatus);
  6770 	CActiveScheduler::Start();
  6771 	TEST2(active->iStatus.Int(), KErrNone);
  6772 	
  6773 	active->StartL();
  6774 	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
  6775 	CActiveScheduler::Start();
  6776 	TEST2(active->iStatus.Int(), KErrNone);
  6777 	TEST2(view->CountL(), 1);
  6778 	
  6779 	// Check duplicate count for the last call made
  6780 	active->StartL();
  6781 	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  6782 	CActiveScheduler::Start();
  6783 	TEST2(duplicate->CountL(), 5);
  6784 	
  6785 	CleanupStack::PopAndDestroy(4);	
  6786 }
  6787 
  6788 /**
  6789 @SYMTestCaseID          PDS-LOGENG-CT-4050
  6790 @SYMTestCaseDesc        Tests for the changes made in defect DEF144552 
  6791 @SYMTestPriority        High
  6792 @SYMTestActions         Tests for the sucessful completion of the following operation - 
  6793                         1)Applying a filter where the event's start time matches the end time.
  6794                         2)Clearing the log where the clear log time is 1 microsecs after the 
  6795                         timestamp of the event.
  6796 @SYMTestExpectedResults Test must not fail
  6797 @SYMREQ                 DEF144552
  6798 */
  6799 LOCAL_C void DEF144552L(CLogClient& aClient)
  6800     {
  6801     TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-CT-4050 ")); 
  6802     TestUtils::DeleteDatabaseL(EFalse);
  6803     
  6804     CTestActive* active = new(ELeave)CTestActive();
  6805     CleanupStack::PushL(active);
  6806 
  6807     //Setup the database by adding a event and changing the timestamp for the event
  6808     //Add 1 event
  6809     CLogEvent* event = CLogEvent::NewL();
  6810     CleanupStack::PushL(event);
  6811     event->SetEventType(KLogCallEventTypeUid);
  6812     event->SetContact(KTestContact1);
  6813     event->SetNumber(KTestNumber2);
  6814     event->SetDuration(0);
  6815     active->StartL();
  6816     aClient.AddEvent(*event, active->iStatus);
  6817     CActiveScheduler::Start();
  6818     TEST2(active->iStatus.Int(), KErrNone);
  6819     
  6820     //Change the event
  6821     TTime now;
  6822     now.UniversalTime();
  6823     event->SetTime(now);
  6824     active->StartL();
  6825     aClient.ChangeEvent(*event, active->iStatus);
  6826     CActiveScheduler::Start();
  6827     TEST2(active->iStatus.Int(), KErrNone);
  6828     
  6829     //Test 1: Setup and apply a filter where the start time matches the end time
  6830     //If the defect is fixed then the view will contain the event previously added,
  6831     //Otherwise the time parameters will be truncated and the event will not be found
  6832     
  6833     //Setup filter so that the start and the end time matches
  6834     CLogFilter* filter = CLogFilter::NewL();
  6835     CleanupStack::PushL(filter);
  6836     filter->SetStartTime(now);
  6837     filter->SetEndTime(now);
  6838     
  6839     //Apply the filter and check that 1 event is in the view
  6840     CLogViewEvent* view = CLogViewEvent::NewL(aClient);
  6841     CleanupStack::PushL(view);
  6842     active->StartL();
  6843     TEST(view->SetFilterL(*filter, active->iStatus));
  6844     CActiveScheduler::Start();
  6845     TEST2(active->iStatus.Int(), KErrNone);
  6846     TEST2(view->CountL(), 1);
  6847     
  6848     //Retrieve and check the event
  6849     active->StartL();
  6850     TEST(view->FirstL(active->iStatus));
  6851     CActiveScheduler::Start();
  6852     TEST2(active->iStatus.Int(), KErrNone);
  6853     const CLogEvent& currentEvent(view->Event());
  6854     TEST2(currentEvent.EventType().iUid, KLogCallEventTypeUid.iUid);
  6855     TEST2(currentEvent.Duration(), 0);
  6856     TEST2(currentEvent.Time().Int64(), now.Int64());
  6857     
  6858     // Test 2: Clearing a log where the time specified in ClearLog() is just
  6859     // after the timestamp of the event by 1 microsecond. If the defect is fixed
  6860     // then the event will be deleted. However if the defect is not fixed then the
  6861     // time specified in ClearLog() will be truncated and the event will not be 
  6862     // deleted
  6863     
  6864     //Clear the log
  6865     active->StartL();
  6866     TTimeIntervalMicroSeconds microsecond(1);
  6867     now += microsecond;
  6868     aClient.ClearLog(now, active->iStatus);
  6869     CActiveScheduler::Start();
  6870     TEST2(active->iStatus.Int(), KErrNone);
  6871     
  6872     //Check that the event has been deleted in the view
  6873     CleanupStack::PopAndDestroy(2);
  6874     view = CLogViewEvent::NewL(aClient);
  6875     CleanupStack::PushL(view);
  6876     filter = CLogFilter::NewL();
  6877     CleanupStack::PushL(filter);
  6878     active->StartL();
  6879     TEST(!view->SetFilterL(*filter, active->iStatus));
  6880 
  6881     CleanupStack::PopAndDestroy(4, active); 
  6882     }
  6883 
  6884 void doTestsL()
  6885 	{
  6886 	TestUtils::Initialize(_L("t_logview2"));
  6887 	TestUtils::DeleteDatabaseL();
  6888 
  6889 	CLogClient* client = CLogClient::NewL(theFs);
  6890 	CleanupStack::PushL(client);
  6891 
  6892 	CLogChangeNotifier* notifier = CLogChangeNotifier::NewL();
  6893 	CleanupStack::PushL(notifier);	
  6894 
  6895 	TheTest.Start(_L("Event View With Filter List"));
  6896 	TestEventViewWithFilterListL(*client);
  6897 	theLog.Write(_L8("Test 1 OK\n"));
  6898 
  6899 	TheTest.Next(_L("View change observer"));
  6900 	TestViewChangeEventsL(*client);
  6901 	theLog.Write(_L8("Test 2 OK\n"));
  6902 
  6903 	TheTest.Next(_L("Recent View With Filter"));
  6904 	TestRecentViewWithFilterL(*client);
  6905 	theLog.Write(_L8("Test 3 OK\n"));
  6906 
  6907 	TheTest.Next(_L("Recent View With Filter List"));
  6908 	TestRecentViewWithFilterListL(*client);
  6909 	theLog.Write(_L8("Test 4 OK\n"));
  6910 
  6911 	TheTest.Next(_L("Duplicate View With Filter"));
  6912 	TestDuplicateViewWithFilterL(*client);
  6913 	theLog.Write(_L8("Test 5 OK\n"));
  6914 
  6915 	TheTest.Next(_L("Duplicate View With Filter List"));
  6916 	TestDuplicateViewWithFilterListL(*client);
  6917 	theLog.Write(_L8("Test 6 OK\n"));
  6918 
  6919 	TheTest.Next(_L("Querying Event View For Null Fields"));
  6920 	TestEventViewForNullFieldsL(*client);
  6921 	theLog.Write(_L8("Test 7 OK\n"));
  6922 
  6923 	TheTest.Next(_L("Querying Recent View For Null Fields"));
  6924 	TestRecentViewForNullFieldsL(*client);
  6925 	theLog.Write(_L8("Test 8 OK\n"));
  6926 
  6927 	TheTest.Next(_L("Querying Duplicate View For Null Fields"));
  6928 	TestDuplicateViewForNullFieldsL(*client);
  6929 	theLog.Write(_L8("Test 9 OK\n"));
  6930 
  6931 	TheTest.Next(_L("Querying Event View For Flags"));
  6932 	TestEventViewForFlagsL(*client);
  6933 	theLog.Write(_L8("Test 10 OK\n"));
  6934 
  6935 	TheTest.Next(_L("Querying Recent View For Flags"));
  6936 	TestRecentViewForFlagsL(*client);
  6937 	theLog.Write(_L8("Test 11 OK\n"));
  6938 
  6939 	TheTest.Next(_L("Querying Duplicate View For Flags"));
  6940 	TestDuplicateViewForFlagsL(*client);
  6941 	theLog.Write(_L8("Test 12 OK\n"));
  6942 
  6943 	TheTest.Next(_L("Removing Recent Events"));
  6944 	TestRemovingRecentEventsL(*client);
  6945 	theLog.Write(_L8("Test 13 OK\n"));
  6946 
  6947 	TheTest.Next(_L("Removing Duplicate Events"));
  6948 	TestRemovingDuplicateEventsL(*client);
  6949 	theLog.Write(_L8("Test 14 OK\n"));
  6950 
  6951 	TheTest.Next(_L("Multiple Views"));
  6952 	TestMultipleViews1L(*client);
  6953 	TestMultipleViews2L(*client);
  6954 	theLog.Write(_L8("Test 15 OK\n"));
  6955 	
  6956 	TheTest.Next(_L("Test _ALT Events In Recent List")); 
  6957 	TestAltEventsInRecentListL(*client);   
  6958 	theLog.Write(_L8("Test 16 OK\n"));
  6959 
  6960 	TheTest.Next(_L("Test filtering Events by time")); 
  6961 	// This TEST sets system's 'Home Time'
  6962 	TestFilterByTimeL(*client);
  6963 	theLog.Write(_L8("Test 17 OK\n"));
  6964 
  6965 	TheTest.Next(_L("Test hidden change events")); 
  6966 	TestUtils::DeleteDatabaseL();
  6967 	TestHiddenChangeEvents1L(*client);
  6968 	TestHiddenChangeEvents1aL(*client);
  6969 	TestHiddenChangeEvents2L(*client);
  6970 	TestHiddenChangeEvents2aL(*client);
  6971 	TestHiddenChangeEvents3L(*client);
  6972 	TestHiddenChangeEvents3aL(*client);
  6973 	TestHiddenChangeEvents4L(*client);
  6974 	TestHiddenChangeEvents4aL(*client);
  6975 	TestHiddenChangeEvents5L(*client);
  6976 	TestHiddenChangeEvents5aL(*client);
  6977 	TestHiddenChangeEvents6L(*client);
  6978 	TestHiddenChangeEvents6aL(*client);
  6979 	TestHiddenChangeEvents7L(*client);
  6980 	TestHiddenChangeEvents7aL(*client);
  6981 	theLog.Write(_L8("Test 18 OK\n"));
  6982 
  6983 	TheTest.Next(_L("Changing events and recent views"));
  6984 	TestChangeEventRecentView1L(*client);
  6985 	TestChangeEventRecentView2L(*client);
  6986 	TestChangeEventRecentViewAndPurgeL(*client);
  6987 	TestChangeEventRecentViewRemoveL(*client);
  6988 	theLog.Write(_L8("Test 19 OK\n"));
  6989 
  6990 	TheTest.Next(_L("Test for DEF066296"));
  6991 	DEF066296L(*client);
  6992 	TheTest.Next(_L("Test for DEF087459"));
  6993 	DEF087459L(*client);
  6994 	theLog.Write(_L8("Test 20 OK\n"));
  6995 
  6996 	TheTest.Next(_L("Event View With Filter List containing StartTime and EndTime"));
  6997 	TestEventViewWithTimestampsInFilterListL(*client);
  6998 	theLog.Write(_L8("Test 21 OK\n"));
  6999 		
  7000 	TheTest.Next(_L("Test for DEF108741 - View change observer, error condition"));
  7001 	DEF108741L(*client);
  7002 	theLog.Write(_L8("Test 22 OK\n"));
  7003 	
  7004 	TheTest.Next(_L("Test Defect INC108225: Call history check for the CS & PS(VOIP) calls "));
  7005 	TestNumberFieldINC108225L(*client);
  7006 	TestOtherFieldsINC108225L(*client);
  7007 	theLog.Write(_L8("Test 23 OK\n"));
  7008 
  7009 	TheTest.Next(_L("Test Defect DEF144552: CLogFilter doesn't work when Starttime is the same as EndTime"));
  7010 	DEF144552L(*client);
  7011 	theLog.Write(_L8("Test 24 OK\n"));
  7012 	
  7013 	CleanupStack::PopAndDestroy(2); // client, notifier
  7014 	}