1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/lowlevellibsandfws/pluginfw/Framework/DiscovererTest/DiscovererTest.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,131 @@
1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Test the CDiscoverer class using the test bed.
1.18 +//
1.19 +//
1.20 +
1.21 +#include "DiscovererUnitTest.h"
1.22 +#include "ComponentTester.h"
1.23 +
1.24 +// ______________________________________________________________________________
1.25 +//
1.26 +/**
1.27 + @internalComponent
1.28 +
1.29 + Comments : Test the CDiscoverer class.
1.30 + */
1.31 +class CDiscoverer_ComponentTest : public CComponentTester
1.32 + {
1.33 +public:
1.34 + /**
1.35 + @fn NewLC(CDataLogger& aDataLogger,
1.36 + MComponentTestObserver& aObserver)
1.37 + Intended Usage : Standard two-phase construction which leaves nothing on the
1.38 + cleanup stack.
1.39 + Error Condition : Leaves with the error code.
1.40 + @leave KErrNoMemory
1.41 + @since 7.0
1.42 + @param aDataLogger The output logging object.
1.43 + @param aObserver The observer of this component test.
1.44 + @return CDiscoverer_CreateAndDestroy_UnitTest* The constructed object.
1.45 + @pre None.
1.46 + @post CDiscoverer_ComponentTest is fully constructed.
1.47 + */
1.48 + static CDiscoverer_ComponentTest* NewLC(CDataLogger& aDataLogger,
1.49 + MComponentTestObserver& aObserver);
1.50 +
1.51 +private:
1.52 + /**
1.53 + @fn CDiscoverer_ComponentTest(CDataLogger& aDataLogger,
1.54 + MComponentTestObserver& aObserver)
1.55 + Intended Usage : Standard c'tor method.
1.56 + Error Condition : None.
1.57 + @since 7.0
1.58 + @param aDataLogger The logging object.
1.59 + @param aObserver The observer of this component test.
1.60 + @pre None.
1.61 + @post CDiscoverer_ComponentTest is fully constructed.
1.62 + */
1.63 + inline CDiscoverer_ComponentTest(CDataLogger& aDataLogger,
1.64 + MComponentTestObserver& aObserver);
1.65 + /**
1.66 + @fn void ConstructL()
1.67 + Intended Usage : Second phase of safe two phase construction,
1.68 + to complete the object initialisation.
1.69 + Error Condition : Leaves with an error code.
1.70 + @leave KErrNoMemory.
1.71 + @since 7.0
1.72 + @return None
1.73 + @pre CDiscoverer_ComponentTest is fully constructed.
1.74 + @post CDiscoverer_ComponentTest is fully initialised.
1.75 + */
1.76 + inline void ConstructL();
1.77 +
1.78 + }; // CDiscoverer_ComponentTest
1.79 +
1.80 +// ______________________________________________________________________________
1.81 +//
1.82 +inline CDiscoverer_ComponentTest* CDiscoverer_ComponentTest::NewLC(CDataLogger& aDataLogger, MComponentTestObserver& aObserver)
1.83 + {
1.84 + CDiscoverer_ComponentTest* self = new (ELeave) CDiscoverer_ComponentTest(aDataLogger, aObserver);
1.85 + CleanupStack::PushL(self);
1.86 + self->ConstructL();
1.87 + return self;
1.88 + }
1.89 +
1.90 +inline CDiscoverer_ComponentTest::CDiscoverer_ComponentTest(CDataLogger& aDataLogger,
1.91 + MComponentTestObserver& aObserver)
1.92 +: CComponentTester(aDataLogger, aObserver)
1.93 + {
1.94 + // Do nothing here.
1.95 + }
1.96 +
1.97 +inline void CDiscoverer_ComponentTest::ConstructL()
1.98 + {
1.99 + ComponentTesterConstructL();
1.100 + AddUnitTestL(CDiscoverer_CreateAndDestroy_UnitTest::NewL(iDataLogger, *this));
1.101 + AddUnitTestL(CDiscoverer_UnmountDrive_UnitTest::NewL(iDataLogger, *this));
1.102 + AddUnitTestL(CDiscoverer_MountDrive_UnitTest::NewL(iDataLogger, *this));
1.103 + AddUnitTestL(CDiscoverer_IsValidEntryL_UnitTest::NewL(iDataLogger, *this));
1.104 + AddUnitTestL(CDiscoverer_ProcessEntryL_UnitTest::NewL(iDataLogger, *this));
1.105 + AddUnitTestL(CDiscoverer_ScanDirectory_UnitTest::NewL(iDataLogger, *this));
1.106 + AddUnitTestL(CDiscoverer_ScanDirectoryCancel_UnitTest::NewL(iDataLogger, *this));
1.107 + AddUnitTestL(CDiscoverer_ScanDirectoryIncrement_UnitTest::NewL(iDataLogger, *this));
1.108 +
1.109 + AddUnitTestL(CDiscoverer_CompleteNotificationProcessing_UnitTest::NewL(iDataLogger, *this));
1.110 + AddUnitTestL(CDiscoverer_Notification_UnitTest::NewL(iDataLogger, *this));
1.111 + AddUnitTestL(CDiscoverer_SuspendResume_UnitTest::NewL(iDataLogger, *this));
1.112 + }
1.113 +
1.114 +// ______________________________________________________________________________
1.115 +//
1.116 +EXPORT_C CComponentTester* NewComponentTestLC(CDataLogger& aDataLogger,
1.117 + MComponentTestObserver& aComponentTestObserver)
1.118 + {
1.119 + return CDiscoverer_ComponentTest::NewLC(aDataLogger, aComponentTestObserver);
1.120 + }
1.121 +
1.122 +// ___________________________________________________________________________
1.123 +//
1.124 +// This section of the module simply includes the exported test harness template which
1.125 +// makes this a "whole" CPP file with a E32Main entry point below. The test MMP
1.126 +// project file can then produce a EXE for the test project instead of a DLL.
1.127 +
1.128 +#include <ecom/test_bed/testharnesstemplate.h>
1.129 +
1.130 +GLDEF_C TInt E32Main()
1.131 + {
1.132 + return E32Main_TestHarness(NewComponentTestLC);
1.133 + }
1.134 +