os/persistentdata/traceservices/tracefw/ulogger/unit_test/te-server/uloggerservertest2step.cpp
Update contrib.
1 // Copyright (c) 2005-2009 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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Example CTestStep derived implementation
19 @file UloggerServerTest2Step.cpp
22 #include "uloggerservertest2step.h"
23 #include "te_uloggerservertestsuitedefs.h"
24 #include "uloggerserver.h"
25 #include "uloggersession.h"
27 using namespace Ulogger;
29 CUloggerServerTest2Step::~CUloggerServerTest2Step()
36 CUloggerServerTest2Step::CUloggerServerTest2Step()
41 // **MUST** call SetTestStepName in the constructor as the controlling
42 // framework uses the test step name immediately following construction to set
43 // up the step's unique logging ID.
44 SetTestStepName(KUloggerServerTest2Step);
47 TVerdict CUloggerServerTest2Step::doTestStepPreambleL()
49 * @return - TVerdict code
50 * Override of base class virtual
53 iScheduler = new (ELeave) CActiveScheduler();
54 CActiveScheduler::Install(iScheduler);
56 SetTestStepResult(EPass);
57 return TestStepResult();
61 TVerdict CUloggerServerTest2Step::doTestStepL()
63 if (TestStepResult()==EPass)
67 errors += Test1L();//CULoggerSession::NewL
68 errors += Test2L();//CULoggerSession::NewLC
73 * Method CULoggerSession::ServiceL cannot be tested here because it require
74 * of passing RMessage2 reference with valid RMessagePtr (IPC)
75 * If we are going to pass empty RMessage2 system will panic our process with
81 res.AppendFormat(_L("%d errors"), errors);
82 INFO_PRINTF1(_L("****Results****"));
85 SetTestStepResult(EPass);
87 SetTestStepResult(EFail);
89 return TestStepResult();
94 TVerdict CUloggerServerTest2Step::doTestStepPostambleL()
96 * @return - TVerdict code
97 * Override of base class virtual
102 return TestStepResult();
105 TInt CUloggerServerTest2Step::Test1L()
106 {//CULoggerSession::NewL
108 INFO_PRINTF1(_L("Testing - CULoggerSession::NewL method"));
109 CULoggerServer *server = NULL;
110 server = CULoggerServer::NewLC(EPriorityBackground);
114 CULoggerSession *serverSession = CULoggerSession::NewL(thread, *server);
115 if(serverSession != NULL)
117 //delete serverSession; //don't need to delete session
121 INFO_PRINTF1(_L("error"));
125 CleanupStack::PopAndDestroy();
129 INFO_PRINTF1(_L("server creation error"));
135 TInt CUloggerServerTest2Step::Test2L()
136 {//CULoggerSession::NewLC
138 INFO_PRINTF1(_L("Testing - CULoggerSession::NewLC method"));
139 CULoggerServer *server = NULL;
140 server = CULoggerServer::NewLC(EPriorityBackground);
144 CULoggerSession *serverSession = CULoggerSession::NewLC(thread, *server);
145 if(serverSession != NULL)
147 CleanupStack::Pop();//serverSession
151 INFO_PRINTF1(_L("error"));
155 CleanupStack::PopAndDestroy();
159 INFO_PRINTF1(_L("server creation error"));