loggingservices/eventlogger/test/src/t_logviewfail.cpp
branchRCL_3
changeset 9 667e88a979d7
parent 0 08ec8eefde2f
equal deleted inserted replaced
8:fa9941cf3867 9:667e88a979d7
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2002-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".
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 //
    14 //
    15 
    15 
    16 #include <s32file.h>
    16 #include <s32file.h>
    17 #include "TEST.H"
    17 #include "t_logutil2.h"
    18 #include <logview.h>
    18 #include <logview.h>
    19 
    19 
    20 #undef test  //there is a "test" macro which hides "RTest test" declaration.
    20 RTest TheTest(_L("t_logviewfail"));
    21 
       
    22 RTest test(_L("Log View Heap (Client) Failure Test Harness"));
       
    23 
    21 
    24 const TLogContactItemId KTestContact = 0x123;
    22 const TLogContactItemId KTestContact = 0x123;
    25 _LIT(KTestStatus, "Test Status Text");
    23 _LIT(KTestStatus, "Test Status Text");
    26 
    24 
    27 
    25 
    34 @SYMTestExpectedResults Test must not fail
    32 @SYMTestExpectedResults Test must not fail
    35 @SYMREQ                 REQ0000
    33 @SYMREQ                 REQ0000
    36 */
    34 */
    37 LOCAL_C void TestEventViewConstructWithHeapFailL(CLogClient& aClient)
    35 LOCAL_C void TestEventViewConstructWithHeapFailL(CLogClient& aClient)
    38 	{
    36 	{
    39 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0961-0001 "));
    37 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0961-0001 "));
    40 	CTestActive* active = new(ELeave)CTestActive;
    38 	CTestActive* active = new(ELeave)CTestActive;
    41 	CleanupStack::PushL(active);
    39 	CleanupStack::PushL(active);
    42 
    40 
    43 	CLogEvent* event = CLogEvent::NewL();
    41 	CLogEvent* event = CLogEvent::NewL();
    44 	CleanupStack::PushL(event);
    42 	CleanupStack::PushL(event);
   100 @SYMTestExpectedResults Test must not fail
    98 @SYMTestExpectedResults Test must not fail
   101 @SYMREQ                 REQ0000
    99 @SYMREQ                 REQ0000
   102 */
   100 */
   103 LOCAL_C void TestRecentViewConstructWithHeapFailL(CLogClient& aClient)
   101 LOCAL_C void TestRecentViewConstructWithHeapFailL(CLogClient& aClient)
   104 	{
   102 	{
   105 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0962-0001 "));
   103 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0962-0001 "));
   106 	CTestActive* active = new(ELeave)CTestActive;
   104 	CTestActive* active = new(ELeave)CTestActive;
   107 	CleanupStack::PushL(active);
   105 	CleanupStack::PushL(active);
   108 
   106 
   109 	CLogEvent* event = CLogEvent::NewL();
   107 	CLogEvent* event = CLogEvent::NewL();
   110 	CleanupStack::PushL(event);
   108 	CleanupStack::PushL(event);
   170 @SYMTestExpectedResults Test must not fail
   168 @SYMTestExpectedResults Test must not fail
   171 @SYMREQ                 REQ0000
   169 @SYMREQ                 REQ0000
   172 */
   170 */
   173 LOCAL_C void TestDuplicateViewConstructWithHeapFailL(CLogClient& aClient)
   171 LOCAL_C void TestDuplicateViewConstructWithHeapFailL(CLogClient& aClient)
   174 	{
   172 	{
   175 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0963-0001 "));
   173 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0963-0001 "));
   176 	CTestActive* active = new(ELeave)CTestActive;
   174 	CTestActive* active = new(ELeave)CTestActive;
   177 	CleanupStack::PushL(active);
   175 	CleanupStack::PushL(active);
   178 
   176 
   179 	CLogEvent* event = CLogEvent::NewL();
   177 	CLogEvent* event = CLogEvent::NewL();
   180 	CleanupStack::PushL(event);
   178 	CleanupStack::PushL(event);
   252 @SYMTestExpectedResults Test must not fail
   250 @SYMTestExpectedResults Test must not fail
   253 @SYMREQ                 REQ0000
   251 @SYMREQ                 REQ0000
   254 */
   252 */
   255 LOCAL_C void TestEventViewSetupWithHeapFailL(CLogClient& aClient)
   253 LOCAL_C void TestEventViewSetupWithHeapFailL(CLogClient& aClient)
   256 	{
   254 	{
   257 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0964-0001 "));
   255 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0964-0001 "));
   258 	CTestActive* active = new(ELeave)CTestActive;
   256 	CTestActive* active = new(ELeave)CTestActive;
   259 	CleanupStack::PushL(active);
   257 	CleanupStack::PushL(active);
   260 
   258 
   261 	CLogEvent* event = CLogEvent::NewL();
   259 	CLogEvent* event = CLogEvent::NewL();
   262 	CleanupStack::PushL(event);
   260 	CleanupStack::PushL(event);
   371 @SYMTestExpectedResults Test must not fail
   369 @SYMTestExpectedResults Test must not fail
   372 @SYMREQ                 REQ0000
   370 @SYMREQ                 REQ0000
   373 */
   371 */
   374 LOCAL_C void TestRecentViewSetupWithHeapFailL(CLogClient& aClient)
   372 LOCAL_C void TestRecentViewSetupWithHeapFailL(CLogClient& aClient)
   375 	{
   373 	{
   376 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0965-0001 "));
   374 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0965-0001 "));
   377 	CTestActive* active = new(ELeave)CTestActive;
   375 	CTestActive* active = new(ELeave)CTestActive;
   378 	CleanupStack::PushL(active);
   376 	CleanupStack::PushL(active);
   379 
   377 
   380 	CLogEvent* event = CLogEvent::NewL();
   378 	CLogEvent* event = CLogEvent::NewL();
   381 	CleanupStack::PushL(event);
   379 	CleanupStack::PushL(event);
   527 @SYMTestExpectedResults Test must not fail
   525 @SYMTestExpectedResults Test must not fail
   528 @SYMREQ                 REQ0000
   526 @SYMREQ                 REQ0000
   529 */
   527 */
   530 LOCAL_C void TestDuplicateViewSetupWithHeapFailL(CLogClient& aClient)
   528 LOCAL_C void TestDuplicateViewSetupWithHeapFailL(CLogClient& aClient)
   531 	{
   529 	{
   532 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0966 "));
   530 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0966 "));
   533 	CTestActive* active = new(ELeave)CTestActive;
   531 	CTestActive* active = new(ELeave)CTestActive;
   534 	CleanupStack::PushL(active);
   532 	CleanupStack::PushL(active);
   535 
   533 
   536 	CLogEvent* event = CLogEvent::NewL();
   534 	CLogEvent* event = CLogEvent::NewL();
   537 	CleanupStack::PushL(event);
   535 	CleanupStack::PushL(event);
   697 @SYMTestExpectedResults Test must not fail
   695 @SYMTestExpectedResults Test must not fail
   698 @SYMREQ                 REQ0000
   696 @SYMREQ                 REQ0000
   699 */
   697 */
   700 LOCAL_C void TestNavigationWithHeapFailL(CLogClient& aClient)
   698 LOCAL_C void TestNavigationWithHeapFailL(CLogClient& aClient)
   701 	{
   699 	{
   702 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0967 "));
   700 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0967 "));
   703 	CTestActive* active = new(ELeave)CTestActive;
   701 	CTestActive* active = new(ELeave)CTestActive;
   704 	CleanupStack::PushL(active);
   702 	CleanupStack::PushL(active);
   705 
   703 
   706 	CLogEvent* event = CLogEvent::NewL();
   704 	CLogEvent* event = CLogEvent::NewL();
   707 	CleanupStack::PushL(event);
   705 	CleanupStack::PushL(event);
   910 @SYMTestExpectedResults Test must not fail
   908 @SYMTestExpectedResults Test must not fail
   911 @SYMREQ                 REQ0000
   909 @SYMREQ                 REQ0000
   912 */
   910 */
   913 LOCAL_C void TestViewCountWithHeapFailL(CLogClient& aClient)
   911 LOCAL_C void TestViewCountWithHeapFailL(CLogClient& aClient)
   914 	{
   912 	{
   915 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0968 "));
   913 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0968 "));
   916 	CTestActive* active = new(ELeave)CTestActive;
   914 	CTestActive* active = new(ELeave)CTestActive;
   917 	CleanupStack::PushL(active);
   915 	CleanupStack::PushL(active);
   918 
   916 
   919 	CLogEvent* event = CLogEvent::NewL();
   917 	CLogEvent* event = CLogEvent::NewL();
   920 	CleanupStack::PushL(event);
   918 	CleanupStack::PushL(event);
   973 @SYMTestExpectedResults Test must not fail
   971 @SYMTestExpectedResults Test must not fail
   974 @SYMREQ                 REQ0000
   972 @SYMREQ                 REQ0000
   975 */
   973 */
   976 LOCAL_C void TestRecentViewRemoveWithHeapFailL(CLogClient& aClient)
   974 LOCAL_C void TestRecentViewRemoveWithHeapFailL(CLogClient& aClient)
   977 	{
   975 	{
   978 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0969 "));
   976 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0969 "));
   979 	CTestActive* active = new(ELeave)CTestActive;
   977 	CTestActive* active = new(ELeave)CTestActive;
   980 	CleanupStack::PushL(active);
   978 	CleanupStack::PushL(active);
   981 
   979 
   982 	CLogEvent* event = CLogEvent::NewL();
   980 	CLogEvent* event = CLogEvent::NewL();
   983 	CleanupStack::PushL(event);
   981 	CleanupStack::PushL(event);
  1103 @SYMTestExpectedResults Test must not fail
  1101 @SYMTestExpectedResults Test must not fail
  1104 @SYMREQ                 REQ0000
  1102 @SYMREQ                 REQ0000
  1105 */
  1103 */
  1106 LOCAL_C void TestDuplicateViewRemoveWithHeapFailL(CLogClient& aClient)
  1104 LOCAL_C void TestDuplicateViewRemoveWithHeapFailL(CLogClient& aClient)
  1107 	{
  1105 	{
  1108 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0970 "));
  1106 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0970 "));
  1109 	CTestActive* active = new(ELeave)CTestActive;
  1107 	CTestActive* active = new(ELeave)CTestActive;
  1110 	CleanupStack::PushL(active);
  1108 	CleanupStack::PushL(active);
  1111 
  1109 
  1112 	CLogEvent* event = CLogEvent::NewL();
  1110 	CLogEvent* event = CLogEvent::NewL();
  1113 	CleanupStack::PushL(event);
  1111 	CleanupStack::PushL(event);
  1234 	CleanupStack::PopAndDestroy(4); // duplicate, view, event, active
  1232 	CleanupStack::PopAndDestroy(4); // duplicate, view, event, active
  1235 	}
  1233 	}
  1236 
  1234 
  1237 void doTestsL()
  1235 void doTestsL()
  1238 	{
  1236 	{
  1239 	TestUtils::Initialize(_L("T_LOGVIEWFAIL"));
  1237 	TestUtils::Initialize(_L("t_logviewfail"));
  1240 	TestUtils::DeleteDatabaseL();
  1238 	TestUtils::DeleteDatabaseL();
  1241 
  1239 
  1242 	CLogClient* client = CLogClient::NewL(theFs);
  1240 	CLogClient* client = CLogClient::NewL(theFs);
  1243 	CleanupStack::PushL(client);
  1241 	CleanupStack::PushL(client);
  1244 
  1242 
  1245 	test.Start(_L("Heap Failure in Client"));
  1243 	TheTest.Start(_L("Heap Failure in Client"));
  1246 
  1244 
  1247 	test.Next(_L("View Construction"));
  1245 	TheTest.Next(_L("View Construction"));
  1248 	TestEventViewConstructWithHeapFailL(*client);
  1246 	TestEventViewConstructWithHeapFailL(*client);
  1249 	TestRecentViewConstructWithHeapFailL(*client);
  1247 	TestRecentViewConstructWithHeapFailL(*client);
  1250 	TestDuplicateViewConstructWithHeapFailL(*client);
  1248 	TestDuplicateViewConstructWithHeapFailL(*client);
  1251 	theLog.Write(_L8("Test 1 OK\n"));
  1249 	theLog.Write(_L8("Test 1 OK\n"));
  1252 
  1250 
  1253 	test.Next(_L("View Setup"));
  1251 	TheTest.Next(_L("View Setup"));
  1254 	TestEventViewSetupWithHeapFailL(*client);
  1252 	TestEventViewSetupWithHeapFailL(*client);
  1255 	TestRecentViewSetupWithHeapFailL(*client);
  1253 	TestRecentViewSetupWithHeapFailL(*client);
  1256 	TestDuplicateViewSetupWithHeapFailL(*client);
  1254 	TestDuplicateViewSetupWithHeapFailL(*client);
  1257 	theLog.Write(_L8("Test 2 OK\n"));
  1255 	theLog.Write(_L8("Test 2 OK\n"));
  1258 
  1256 
  1259 	test.Next(_L("View Navigation"));
  1257 	TheTest.Next(_L("View Navigation"));
  1260 	TestNavigationWithHeapFailL(*client);
  1258 	TestNavigationWithHeapFailL(*client);
  1261 	theLog.Write(_L8("Test 3 OK\n"));
  1259 	theLog.Write(_L8("Test 3 OK\n"));
  1262 
  1260 
  1263 	test.Next(_L("Other"));
  1261 	TheTest.Next(_L("Other"));
  1264 	TestViewCountWithHeapFailL(*client);
  1262 	TestViewCountWithHeapFailL(*client);
  1265 	TestRecentViewRemoveWithHeapFailL(*client);
  1263 	TestRecentViewRemoveWithHeapFailL(*client);
  1266 	TestDuplicateViewRemoveWithHeapFailL(*client);
  1264 	TestDuplicateViewRemoveWithHeapFailL(*client);
  1267 	theLog.Write(_L8("Test 4 OK\n"));
  1265 	theLog.Write(_L8("Test 4 OK\n"));
  1268 
  1266