loggingservices/eventlogger/test/src/t_logservercrash.cpp
branchRCL_3
changeset 9 667e88a979d7
parent 6 5ffdb8f2067f
equal deleted inserted replaced
8:fa9941cf3867 9:667e88a979d7
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2004-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".
    21 // will be loaded from that file, not from the LogEng resource file)
    21 // will be loaded from that file, not from the LogEng resource file)
    22 //
    22 //
    23 
    23 
    24 #include <s32file.h>
    24 #include <s32file.h>
    25 #include <e32math.h>
    25 #include <e32math.h>
    26 
    26 #include "t_logutil2.h"
    27 #include "TEST.H"
       
    28 #include <logview.h>
    27 #include <logview.h>
    29 
    28 
    30 #undef test  //there is a "test" macro which hides "RTest test" declaration.
    29 RTest TheTest(_L("t_logservercrash"));
    31 
       
    32 RTest test(_L("Log Event Test Harness"));
       
    33 
    30 
    34 const TInt KTestEventNum = 10;
    31 const TInt KTestEventNum = 10;
    35 const TLogDurationType KTestDurationType1 = 1;
    32 const TLogDurationType KTestDurationType1 = 1;
    36 const TLogDuration KTestDuration1 = 0x1234;
    33 const TLogDuration KTestDuration1 = 0x1234;
    37 const TLogFlags KTestFlags1 = 0x5;
    34 const TLogFlags KTestFlags1 = 0x5;
    58 @SYMTestExpectedResults Test must not fail
    55 @SYMTestExpectedResults Test must not fail
    59 @SYMREQ                 REQ0000
    56 @SYMREQ                 REQ0000
    60 */	
    57 */	
    61 LOCAL_C void TestKillServerL()
    58 LOCAL_C void TestKillServerL()
    62 	{	
    59 	{	
    63 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1021 Before Killing Server "));
    60 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1021 Before Killing Server "));
    64 	User::After(2000000);
    61 	User::After(2000000);
    65 	
    62 	
    66 	// for EKA2 find process and Kill
    63 	// for EKA2 find process and Kill
    67 	// Note: this needs CAPABILITY PowerMgmt
    64 	// Note: this needs CAPABILITY PowerMgmt
    68 	TFindProcess findProcess(SERVER_NAME);
    65 	TFindProcess findProcess(SERVER_NAME);
    71 	
    68 	
    72 	RProcess server;
    69 	RProcess server;
    73 	LEAVE_IF_ERROR( server.Open(findProcess, EOwnerProcess) );
    70 	LEAVE_IF_ERROR( server.Open(findProcess, EOwnerProcess) );
    74 	server.Kill(0);		
    71 	server.Kill(0);		
    75  
    72  
    76 	test.Next(_L("Server is Killed"));
    73 	TheTest.Next(_L("Server is Killed"));
    77 	User::After(2000000);
    74 	User::After(2000000);
    78 	}
    75 	}
    79 
    76 
    80 /**
    77 /**
    81 @SYMTestCaseID          SYSLIB-LOGENG-CT-1022
    78 @SYMTestCaseID          SYSLIB-LOGENG-CT-1022
    85 @SYMTestExpectedResults Test must not fail
    82 @SYMTestExpectedResults Test must not fail
    86 @SYMREQ                 REQ0000
    83 @SYMREQ                 REQ0000
    87 */	
    84 */	
    88 LOCAL_C void TestEventViewL(CLogClient& aClient)
    85 LOCAL_C void TestEventViewL(CLogClient& aClient)
    89 	{
    86 	{
    90 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1022 "));
    87 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1022 "));
    91 	CTestActive* active = new(ELeave)CTestActive();
    88 	CTestActive* active = new(ELeave)CTestActive();
    92 	CleanupStack::PushL(active);
    89 	CleanupStack::PushL(active);
    93 
    90 
    94 	CLogViewChangeObserver* changeObs = CLogViewChangeObserver::NewLC();
    91 	CLogViewChangeObserver* changeObs = CLogViewChangeObserver::NewLC();
    95 	changeObs->SetActive();
    92 	changeObs->SetActive();
   207 void doTestsL() 
   204 void doTestsL() 
   208 	{
   205 	{
   209 	TheMatchingIsEnabled = TestUtils::MatchingEnabledL();
   206 	TheMatchingIsEnabled = TestUtils::MatchingEnabledL();
   210 	
   207 	
   211 	// test 0 adds an event
   208 	// test 0 adds an event
   212 	TestUtils::Initialize(_L("T_LOGSERVERCRASH"));
   209 	TestUtils::Initialize(_L("t_logservercrash"));
   213 	TestUtils::DeleteDatabaseL();
   210 	TestUtils::DeleteDatabaseL();
   214 
   211 
   215 	CLogClient* client = CLogClient::NewL(theFs);
   212 	CLogClient* client = CLogClient::NewL(theFs);
   216 	CleanupStack::PushL(client);
   213 	CleanupStack::PushL(client);
   217 
   214 
   218 	CLogChangeNotifier* notifier = CLogChangeNotifier::NewL();
   215 	CLogChangeNotifier* notifier = CLogChangeNotifier::NewL();
   219 	CleanupStack::PushL(notifier);
   216 	CleanupStack::PushL(notifier);
   220 
   217 
   221 	test.Start(_L("Event View With No Filter: Before Killing Sever"));
   218 	TheTest.Start(_L("Event View With No Filter: Before Killing Sever"));
   222 	test.Next(_L("Test Add Event"));
   219 	TheTest.Next(_L("Test Add Event"));
   223 	TestEventViewL(*client);
   220 	TestEventViewL(*client);
   224 	theLog.Write(_L8("Test 0 OK\n"));
   221 	theLog.Write(_L8("Test 0 OK\n"));
   225 
   222 
   226 	// Test 1 stops the server
   223 	// Test 1 stops the server
   227 	test.Next(_L("Test Kill Server"));
   224 	TheTest.Next(_L("Test Kill Server"));
   228 	TestKillServerL();
   225 	TestKillServerL();
   229 	theLog.Write(_L8("Test 1 OK\n"));
   226 	theLog.Write(_L8("Test 1 OK\n"));
   230 
   227 
   231 	// Test 2 checks the server is going again
   228 	// Test 2 checks the server is going again
   232 	test.Start(_L("Event View With No Filter : After Killing Sever"));
   229 	TheTest.Next(_L("Event View With No Filter : After Killing Sever"));
   233 	test.Next(_L("Test Add Event"));
   230 	TheTest.Next(_L("Test Add Event"));
   234 	TestEventViewL(*client);
   231 	TestEventViewL(*client);
   235 	theLog.Write(_L8("Test 2 OK\n"));
   232 	theLog.Write(_L8("Test 2 OK\n"));
   236 
   233 
   237 	test.End();
       
   238 	CleanupStack::PopAndDestroy(2);
   234 	CleanupStack::PopAndDestroy(2);
   239 	}
   235 	}