loggingservices/eventlogger/test/src/t_logsecureview.cpp
branchRCL_3
changeset 9 667e88a979d7
parent 0 08ec8eefde2f
equal deleted inserted replaced
8:fa9941cf3867 9:667e88a979d7
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 //
    14 //
    15 
    15 
    16 #include "TEST.H"
    16 #include "t_logutil2.h"
    17 #include <logview.h>
    17 #include <logview.h>
    18 
       
    19 #undef test  //there is a "test" macro which hides "RTest test" declaration.
       
    20 
    18 
    21 #define PRECONDITION_TRUE(x) TEST((x))
    19 #define PRECONDITION_TRUE(x) TEST((x))
    22 #define PRECONDITION_EQ(x,y) TEST2((x),(y))
    20 #define PRECONDITION_EQ(x,y) TEST2((x),(y))
    23 
    21 
    24 // If LOWCAP is defined in the .mmp file 'hiCapabilityTest' will be set to FALSE.
    22 // If LOWCAP is defined in the .mmp file 'hiCapabilityTest' will be set to FALSE.
    25 #ifdef LOWCAP
    23 #ifdef LOWCAP
    26 	TBool hiCapabilityTest = EFalse;
    24 	TBool hiCapabilityTest = EFalse;
    27 	RTest test(_L("Log Client Low Capability Secure View Test"));
    25 	RTest TheTest(_L("t_logsecureview_lowcap"));
    28 	_LIT(KTestTitle, "t_logsecureview (low capability)");
    26 	_LIT(KTestTitle, "t_logsecureview (low capability)");
    29 #else
    27 #else
    30 	TBool hiCapabilityTest = ETrue;
    28 	TBool hiCapabilityTest = ETrue;
    31 	RTest test(_L("Log Client High Capability Secure View Test"));
    29 	RTest TheTest(_L("t_logsecureview_hicap"));
    32 	_LIT(KTestTitle, "t_logsecureview (high capability)");
    30 	_LIT(KTestTitle, "t_logsecureview (high capability)");
    33 #endif
    31 #endif
    34 
    32 
    35 
    33 
    36 /**
    34 /**
    41 @SYMTestExpectedResults Should always succeed
    39 @SYMTestExpectedResults Should always succeed
    42 @SYMREQ REQ3431
    40 @SYMREQ REQ3431
    43 */
    41 */
    44 LOCAL_C void TestDuplicateRemoveIdL(CLogViewDuplicate* aView)
    42 LOCAL_C void TestDuplicateRemoveIdL(CLogViewDuplicate* aView)
    45 	{
    43 	{
    46 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0135 "));
    44 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0135 "));
    47 	TLogId id = aView->Event().Id();
    45 	TLogId id = aView->Event().Id();
    48 	TRAPD(error, aView->RemoveL(id));
    46 	TRAPD(error, aView->RemoveL(id));
    49 	
    47 	
    50 	if(hiCapabilityTest)
    48 	if(hiCapabilityTest)
    51 		{
    49 		{
    67 @SYMTestExpectedResults Should always succeed
    65 @SYMTestExpectedResults Should always succeed
    68 @SYMREQ REQ3431
    66 @SYMREQ REQ3431
    69 */
    67 */
    70 LOCAL_C void TestDuplicateRemoveCurrentL(CLogViewDuplicate* aView, CTestActive* aTestActive)
    68 LOCAL_C void TestDuplicateRemoveCurrentL(CLogViewDuplicate* aView, CTestActive* aTestActive)
    71 	{
    69 	{
    72 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0136 "));
    70 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0136 "));
    73 	aTestActive->StartL();
    71 	aTestActive->StartL();
    74 	PRECONDITION_TRUE(aView->FirstL(aTestActive->iStatus));
    72 	PRECONDITION_TRUE(aView->FirstL(aTestActive->iStatus));
    75 	CActiveScheduler::Start();
    73 	CActiveScheduler::Start();
    76 	PRECONDITION_EQ(aTestActive->iStatus.Int(), KErrNone);
    74 	PRECONDITION_EQ(aTestActive->iStatus.Int(), KErrNone);
    77 
    75 
   101 @SYMTestExpectedResults Should always succeed
    99 @SYMTestExpectedResults Should always succeed
   102 @SYMREQ REQ3431
   100 @SYMREQ REQ3431
   103 */
   101 */
   104 LOCAL_C void TestRecentClearDuplicatesL(CLogViewRecent* aRecentView, CLogViewDuplicate* aDuplicateView)
   102 LOCAL_C void TestRecentClearDuplicatesL(CLogViewRecent* aRecentView, CLogViewDuplicate* aDuplicateView)
   105 	{
   103 	{
   106 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0137 "));
   104 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0137 "));
   107 	TRAPD(error, aRecentView->ClearDuplicatesL());
   105 	TRAPD(error, aRecentView->ClearDuplicatesL());
   108 
   106 
   109 	if(hiCapabilityTest)
   107 	if(hiCapabilityTest)
   110 		{
   108 		{
   111 		TEST2(error, KErrNone);
   109 		TEST2(error, KErrNone);
   126 @SYMTestExpectedResults Should always succeed
   124 @SYMTestExpectedResults Should always succeed
   127 @SYMREQ REQ3431
   125 @SYMREQ REQ3431
   128 */
   126 */
   129 LOCAL_C void TestRecentRemoveIdL(CLogViewRecent* aView)
   127 LOCAL_C void TestRecentRemoveIdL(CLogViewRecent* aView)
   130 	{
   128 	{
   131 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0138 "));
   129 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0138 "));
   132 	TLogId id = aView->Event().Id();
   130 	TLogId id = aView->Event().Id();
   133 	TRAPD(error, aView->RemoveL(id));
   131 	TRAPD(error, aView->RemoveL(id));
   134 	
   132 	
   135 	if(hiCapabilityTest)
   133 	if(hiCapabilityTest)
   136 		{
   134 		{
   152 @SYMTestExpectedResults Should always succeed
   150 @SYMTestExpectedResults Should always succeed
   153 @SYMREQ REQ3431
   151 @SYMREQ REQ3431
   154 */
   152 */
   155 LOCAL_C void TestRecentRemoveCurrentL(CLogViewRecent* aView, CTestActive* aTestActive)
   153 LOCAL_C void TestRecentRemoveCurrentL(CLogViewRecent* aView, CTestActive* aTestActive)
   156 	{
   154 	{
   157 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0139 "));
   155 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0139 "));
   158 	aTestActive->StartL();
   156 	aTestActive->StartL();
   159 	PRECONDITION_TRUE(aView->FirstL(aTestActive->iStatus));
   157 	PRECONDITION_TRUE(aView->FirstL(aTestActive->iStatus));
   160 	CActiveScheduler::Start();
   158 	CActiveScheduler::Start();
   161 	PRECONDITION_EQ(aTestActive->iStatus.Int(), KErrNone);
   159 	PRECONDITION_EQ(aTestActive->iStatus.Int(), KErrNone);
   162 
   160 
   198 	PRECONDITION_TRUE(recentView->DuplicatesL(*duplicateView, testActive->iStatus));
   196 	PRECONDITION_TRUE(recentView->DuplicatesL(*duplicateView, testActive->iStatus));
   199 	CActiveScheduler::Start();
   197 	CActiveScheduler::Start();
   200 	PRECONDITION_EQ(testActive->iStatus.Int(), KErrNone);
   198 	PRECONDITION_EQ(testActive->iStatus.Int(), KErrNone);
   201 	PRECONDITION_EQ(duplicateView->CountL(), 4);
   199 	PRECONDITION_EQ(duplicateView->CountL(), 4);
   202 	
   200 	
   203 	test.Start(_L("RemoveL on duplicate view with id as argument"));
   201 	TheTest.Start(_L("RemoveL on duplicate view with id as argument"));
   204 	TestDuplicateRemoveIdL(duplicateView);
   202 	TestDuplicateRemoveIdL(duplicateView);
   205 
   203 
   206 	test.Next(_L("RemoveL on duplicate view at current cursor position"));
   204 	TheTest.Next(_L("RemoveL on duplicate view at current cursor position"));
   207 	TestDuplicateRemoveCurrentL(duplicateView, testActive);
   205 	TestDuplicateRemoveCurrentL(duplicateView, testActive);
   208 
   206 
   209 	test.Next(_L("ClearDuplicatesL on recent view"));
   207 	TheTest.Next(_L("ClearDuplicatesL on recent view"));
   210 	TestRecentClearDuplicatesL(recentView, duplicateView);
   208 	TestRecentClearDuplicatesL(recentView, duplicateView);
   211 
   209 
   212 	test.Next(_L("RemoveL on recent view with id as argument"));
   210 	TheTest.Next(_L("RemoveL on recent view with id as argument"));
   213 	TestRecentRemoveIdL(recentView);
   211 	TestRecentRemoveIdL(recentView);
   214 	
   212 	
   215 	test.Next(_L("RemoveL on recent view at current cursor position"));
   213 	TheTest.Next(_L("RemoveL on recent view at current cursor position"));
   216 	TestRecentRemoveCurrentL(recentView, testActive);
   214 	TestRecentRemoveCurrentL(recentView, testActive);
   217 
   215 
   218 	CleanupStack::PopAndDestroy(4);
   216 	CleanupStack::PopAndDestroy(4);
   219 	}
   217 	}
   220 
   218