lowlevellibsandfws/pluginfw/Framework/BackupNotifierTest/BackupNotifierTest.cpp
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 // Copyright (c) 2001-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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Demonstrates a simple set of derived class implementations to
       
    15 // test the CBackupNotifier class using the test bed.
       
    16 // It may be used as a basis to develop a full test bed dll.
       
    17 // For support and comment please contact the authors.
       
    18 // 
       
    19 //
       
    20 
       
    21 #include "BackupNotifierUnitTest.h"
       
    22 #include "ComponentTester.h"
       
    23 
       
    24 // ______________________________________________________________________________
       
    25 //
       
    26 /**
       
    27 	@internalComponent
       
    28 
       
    29 	Comments : Test the CBackupNotifier class.
       
    30  */
       
    31 class CBackupNotifier_ComponentTest : public CComponentTester
       
    32 	{
       
    33 public:
       
    34 	/**
       
    35 		@fn				NewLC(CDataLogger& aDataLogger,
       
    36 							 MComponentTestObserver& aObserver)
       
    37 		Intended Usage	: Standard two-phase construction which leaves nothing on the
       
    38 						cleanup stack.
       
    39 		Error Condition	: Leaves with the error code.
       
    40 		@leave			KErrNoMemory
       
    41 		@since			7.0
       
    42 		@param			aDataLogger The output logging object.
       
    43 		@param			aObserver The observer of this component test.
       
    44 		@return			CBackupNotifier_ComponentTest* The constructed object.
       
    45 		@pre 			None.
       
    46 		@post			CBackupNotifier_ComponentTest is fully constructed.
       
    47 	*/
       
    48 	static CBackupNotifier_ComponentTest* NewLC(CDataLogger& aDataLogger, 
       
    49 							MComponentTestObserver& aObserver);
       
    50 
       
    51 private:
       
    52 	/**
       
    53 		@fn				CBackupNotifier_ComponentTest(CDataLogger& aDataLogger,
       
    54 											MComponentTestObserver& aObserver)
       
    55 		Intended Usage	: Standard c'tor method.
       
    56 		Error Condition	: None.
       
    57 		@since			7.0
       
    58 		@param			aDataLogger The logging object.
       
    59 		@param			aObserver The observer of this component test.
       
    60 		@pre 			None.
       
    61 		@post			CBackupNotifier_ComponentTest is fully constructed.
       
    62 	*/
       
    63 	inline CBackupNotifier_ComponentTest(CDataLogger& aDataLogger,
       
    64 												MComponentTestObserver& aObserver);
       
    65 	/**
       
    66 		@fn				void ConstructL()
       
    67 		Intended Usage	: Second phase of safe two phase construction, 
       
    68 						to complete the object initialisation.
       
    69 		Error Condition	: Leaves with an error code.
       
    70 		@leave			KErrNoMemory.
       
    71 		@since			7.0
       
    72 		@return			None 
       
    73 		@pre 			CBackupNotifier_ComponentTest is fully constructed.
       
    74 		@post			CBackupNotifier_ComponentTest is fully initialised.
       
    75 	*/
       
    76 	inline void ConstructL();
       
    77 
       
    78 	};	// CBackupNotifier_ComponentTest
       
    79 
       
    80 // ______________________________________________________________________________
       
    81 //
       
    82 inline CBackupNotifier_ComponentTest* CBackupNotifier_ComponentTest::NewLC(CDataLogger& aDataLogger, MComponentTestObserver& aObserver)
       
    83 	{
       
    84 	CBackupNotifier_ComponentTest* self = new (ELeave) CBackupNotifier_ComponentTest(aDataLogger, aObserver);
       
    85 	CleanupStack::PushL(self);
       
    86 	self->ConstructL();
       
    87 	return self;
       
    88 	}
       
    89 
       
    90 inline CBackupNotifier_ComponentTest::CBackupNotifier_ComponentTest(CDataLogger& aDataLogger,
       
    91 									MComponentTestObserver& aObserver)
       
    92 : CComponentTester(aDataLogger, aObserver)
       
    93 	{
       
    94 	// Do nothing here.
       
    95 	}
       
    96 
       
    97 inline void CBackupNotifier_ComponentTest::ConstructL()
       
    98 	{
       
    99 	// Perform base class initialization
       
   100 	ComponentTesterConstructL();
       
   101 
       
   102 	AddUnitTestL(CBackupNotifier_CreateAndDestroy_UnitTest::NewL(iDataLogger, *this));
       
   103 	}
       
   104 
       
   105 // ______________________________________________________________________________
       
   106 //
       
   107 EXPORT_C CComponentTester* NewComponentTestLC(CDataLogger& aDataLogger,
       
   108 									MComponentTestObserver&	aComponentTestObserver)
       
   109 	{
       
   110 	return CBackupNotifier_ComponentTest::NewLC(aDataLogger, aComponentTestObserver);
       
   111 	}
       
   112 
       
   113 // ___________________________________________________________________________
       
   114 //
       
   115 // This section of the module simply includes the exported test harness template which 
       
   116 // makes this a "whole" CPP file with a E32Main entry point below. The test MMP 
       
   117 // project file can then produce a EXE for the test project instead of a DLL.
       
   118 
       
   119 #include <ecom/test_bed/testharnesstemplate.h>
       
   120 
       
   121 GLDEF_C TInt E32Main()
       
   122 	{
       
   123 	return E32Main_TestHarness(NewComponentTestLC);
       
   124 	}
       
   125