Exemple #1
0
static void LogFilterL(TUint16 memtype)
{
	CLogFilter *filter;
	TLogString direction;
	TRequestStatus status;

	filter = CLogFilter::NewL();
	CleanupStack::PushL(filter);
	switch (memtype) {
	case GN_MT_DC:	// dialled calls
		User::LeaveIfError(g->logclient->GetString(direction, R_LOG_DIR_OUT));
		break;
	case GN_MT_RC:	// received calls
		User::LeaveIfError(g->logclient->GetString(direction, R_LOG_DIR_IN));
		break;
	case GN_MT_MC:	// missed calls
		User::LeaveIfError(g->logclient->GetString(direction, R_LOG_DIR_MISSED));
		break;
	default:
		User::Invariant();
	}
	filter->SetDirection(direction);

	WaitIfReqL(g->logview->SetFilterL(*filter, status), status);
	CleanupStack::PopAndDestroy(filter);
}
/**
@SYMTestCaseID SYSLIB-LOGENG-CT-0129
@SYMTestCaseDesc Test that a view only contains events that are suitable for a clients cabability
@SYMTestPriority High
@SYMTestActions See comments in the trest code below for further info.
@SYMTestExpectedResults Should always succeed
@SYMREQ REQ3431
*/
LOCAL_C void TestEventViewWithFilterL(CLogClient& aClient)
	{
	// TestUtils::AddTestEventsL() --> should be called before this function.
	// It deletes the database, then...
	// adds 8 events - 2 are visible to clients with no capabilities
	// and 6 are of type KLogCallEventTypeUid, which is protected.
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0129 "));
	CTestActive* active = new(ELeave)CTestActive;
	CleanupStack::PushL(active);

	CLogFilterList* list = new(ELeave)CLogFilterList;
	CleanupStack::PushL(list);

	CLogViewEvent* view = CLogViewEvent::NewL(aClient);
	CleanupStack::PushL(view);

	CLogFilter* filter = CLogFilter::NewL();
	CleanupStack::PushL(filter);
	
	TLogString direction;
	aClient.GetString(direction, R_LOG_DIR_IN);
	
	// Test 1.
	// Of the 8 new events, 2 have KTestContact1 as the contact field
	// One of them is a secure type and the other isn't.
	// So, if running at hi capability, expect 2 events, else 1
	TInt expectedEventCount = (TheHiCapability) ? 2 : 1;
	filter->SetContact(KTestContact1);
	list->AppendL(filter);
	active->StartL();
	TEST(view->SetFilterL(*list, active->iStatus));
	CActiveScheduler::Start();
	TEST(view->CountL() == expectedEventCount);
	
	// Test 2.
	// Of the 8 new events, 6 have KTestContact2 as the contact field
	// One of them is a secure type and the other isn't.
	// The filters will be combined in the query, so expect
	// 8 events if running at hi capability, else 2
	expectedEventCount = (TheHiCapability) ? 8 : 2;
	CleanupStack::Pop(); // filter
	filter = CLogFilter::NewL();
	CleanupStack::PushL(filter);
	filter->SetContact(KTestContact2);
	list->AppendL(filter);
	active->StartL();
	TEST(view->SetFilterL(*list, active->iStatus));
	CActiveScheduler::Start();
	TEST(view->CountL() == expectedEventCount);
		
	// Test 3.
	// Of the 8 new events, 7 have R_LOG_DIR_IN as the direction field.
	// Two of these are only visible for hi capability clients, the other one
	// can be viewed by all clients.
	expectedEventCount = (TheHiCapability) ? 7 : 1;
	CleanupStack::Pop(); // filter
	filter = CLogFilter::NewL();
	CleanupStack::PushL(filter);
	filter->SetDirection(direction);
	list->AppendL(filter);
	active->StartL();
	TEST(view->SetFilterL(*list, active->iStatus));
	CActiveScheduler::Start();
	TEST(view->CountL() == expectedEventCount);
	
	// clear up...
	list->ResetAndDestroy();
	CleanupStack::Pop(); // filter
	CleanupStack::PopAndDestroy(3);  // view, list, active
	}