sysresmonitoring/oommonitor/tsrc/public/basic/MT_OomMonitor/MT_COomMonitorPlugin.cpp
branchRCL_3
changeset 1 0fdb7f6b0309
parent 0 2e3d3ce01487
child 2 7645e9ce10dc
equal deleted inserted replaced
0:2e3d3ce01487 1:0fdb7f6b0309
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 //  CLASS HEADER
       
    20 #include "MT_COomMonitorPlugin.h"
       
    21 
       
    22 //  EXTERNAL INCLUDES
       
    23 #include <EUnitMacros.h>
       
    24 #include <EUnitDecorators.h>
       
    25 #include <oommonitorplugin.h>
       
    26 #include <oommonitor.h>
       
    27 
       
    28 
       
    29 
       
    30 MT_COomMonitorPlugin* MT_COomMonitorPlugin::NewL()
       
    31     {
       
    32     MT_COomMonitorPlugin* self = MT_COomMonitorPlugin::NewLC();
       
    33     CleanupStack::Pop();
       
    34 
       
    35     return self;
       
    36     }
       
    37 
       
    38 MT_COomMonitorPlugin* MT_COomMonitorPlugin::NewLC()
       
    39     {
       
    40     MT_COomMonitorPlugin* self = new( ELeave ) MT_COomMonitorPlugin();
       
    41     CleanupStack::PushL( self );
       
    42 
       
    43     self->ConstructL();
       
    44 
       
    45     return self;
       
    46     }
       
    47 
       
    48 // Destructor (virtual by CBase)
       
    49 MT_COomMonitorPlugin::~MT_COomMonitorPlugin()
       
    50     {
       
    51     }
       
    52 
       
    53 // Default constructor
       
    54 MT_COomMonitorPlugin::MT_COomMonitorPlugin()
       
    55     {
       
    56     }
       
    57 
       
    58 // Second phase construct
       
    59 void MT_COomMonitorPlugin::ConstructL()
       
    60     {
       
    61     // The ConstructL from the base class CEUnitTestSuiteClass must be called.
       
    62     // It generates the test case table.
       
    63     CEUnitTestSuiteClass::ConstructL();
       
    64     }
       
    65 
       
    66 //  METHODS
       
    67 
       
    68 void MT_COomMonitorPlugin::BasicSetupL(  )
       
    69     {
       
    70     iMonitor = CMemoryMonitor::NewL();
       
    71     }
       
    72     
       
    73 
       
    74 void MT_COomMonitorPlugin::BasicTeardown(  )
       
    75     {
       
    76     delete iMonitor;
       
    77     iMonitor = NULL; 
       
    78     }
       
    79     
       
    80 void MT_COomMonitorPlugin::SetupL(  )
       
    81     {
       
    82     BasicSetupL();
       
    83     
       
    84     const TUid KMyAppUid = { 0x01234567};
       
    85     iCOomMonitorPlugin = CAppOomMonitorPlugin::NewL( KMyAppUid );
       
    86     }
       
    87     
       
    88 
       
    89 void MT_COomMonitorPlugin::Teardown(  )
       
    90     {
       
    91     BasicTeardown();
       
    92     
       
    93     delete iCOomMonitorPlugin; 
       
    94     iCOomMonitorPlugin = NULL;
       
    95     }
       
    96     
       
    97     
       
    98 void MT_COomMonitorPlugin::T_CAppOomMonitorPlugin_NewLL(  )
       
    99     {
       
   100     const TUid KMyAppUid = { 0x01234567};
       
   101     CAppOomMonitorPlugin* plugin = CAppOomMonitorPlugin::NewL( KMyAppUid );
       
   102     CleanupStack::PushL( plugin );
       
   103     
       
   104     EUNIT_ASSERT_DESC( plugin, "CAppOomMonitorPlugin instance not created!" );
       
   105     CleanupStack::PopAndDestroy( plugin );
       
   106     }
       
   107     
       
   108 void MT_COomMonitorPlugin::T_COomMonitorPlugin_FreeRamL(  )
       
   109     {
       
   110     // private function in CAppOomMonitorPlugin, couldn't be tested
       
   111     //iCOomMonitorPlugin->FreeRam( );
       
   112     }
       
   113     
       
   114 void MT_COomMonitorPlugin::T_COomMonitorPlugin_MemoryGoodL(  )
       
   115     {
       
   116     // private function in CAppOomMonitorPlugin, couldn't be tested
       
   117     //iCOomMonitorPlugin->MemoryGood( );
       
   118     }
       
   119     
       
   120 void MT_COomMonitorPlugin::T_COomMonitorPlugin_FsSessionL(  )
       
   121     {
       
   122     iCOomMonitorPlugin->FsSession( );
       
   123     }
       
   124     
       
   125 void MT_COomMonitorPlugin::T_COomMonitorPlugin_WsSessionL(  )
       
   126     {
       
   127     iCOomMonitorPlugin->WsSession( );
       
   128     }
       
   129 
       
   130 void MT_COomMonitorPlugin::T_COomMonitorPlugin_ExtensionInterfaceL(  )
       
   131     {
       
   132 	CTestOomMonitorPlugin* plugin = new(ELeave) CTestOomMonitorPlugin;
       
   133 	CleanupStack::PushL(plugin);
       
   134 	plugin->ConstructL();
       
   135 	
       
   136 	const TUid KTestUid = { 0x01234567 };      // a nonsense UID for testing
       
   137 	TAny* any = NULL;
       
   138 	plugin->ExtensionInterface( KTestUid, any );
       
   139 	
       
   140 	CleanupStack::PopAndDestroy(plugin);
       
   141     }
       
   142     
       
   143 
       
   144 //  TEST TABLE
       
   145 EUNIT_BEGIN_TEST_TABLE(
       
   146     MT_COomMonitorPlugin,
       
   147     "COomMonitorPlugin test suite",
       
   148     "MODULE" )
       
   149 
       
   150 EUNIT_TEST(
       
   151     "NewL - test",
       
   152     "COomMonitorPlugin",
       
   153     "CAppOomMonitorPlugin NewL and COomMonitorPlugin Constructor, Destructor",
       
   154     "FUNCTIONALITY",
       
   155     BasicSetupL, T_CAppOomMonitorPlugin_NewLL, BasicTeardown)
       
   156     
       
   157 EUNIT_TEST(
       
   158     "FsSession - test",
       
   159     "COomMonitorPlugin",
       
   160     "FsSession",
       
   161     "FUNCTIONALITY",
       
   162     SetupL, T_COomMonitorPlugin_FsSessionL, Teardown)
       
   163     
       
   164 EUNIT_TEST(
       
   165     "WsSession - test",
       
   166     "COomMonitorPlugin",
       
   167     "WsSession",
       
   168     "FUNCTIONALITY",
       
   169     SetupL, T_COomMonitorPlugin_WsSessionL, Teardown)
       
   170     
       
   171 EUNIT_TEST(
       
   172     "ExtensionInterface - test",
       
   173     "COomMonitorPlugin",
       
   174     "ExtensionInterface",
       
   175     "FUNCTIONALITY",
       
   176     SetupL, T_COomMonitorPlugin_ExtensionInterfaceL, Teardown)    
       
   177 
       
   178 EUNIT_END_TEST_TABLE
       
   179 
       
   180 //  END OF FILE