profilesservices/ProfileEngine/tsrc/public/basic/WrapperMdlTest/src/MT_ProEngFactory.cpp
changeset 0 8c5d936e5675
equal deleted inserted replaced
-1:000000000000 0:8c5d936e5675
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Implementation of the MT_ProEngFactory test class.
       
    15 *
       
    16 */
       
    17 ////////////////////////////////////////////////////////////////////////
       
    18 // MT_ProEngFactory.cpp
       
    19 //
       
    20 
       
    21 //  CLASS HEADER
       
    22 #include "MT_ProEngFactory.h"
       
    23 
       
    24 //  EXTERNAL INCLUDES
       
    25 #include <EUnitMacros.h>
       
    26 #include <ProEngFactory.h>
       
    27 #include <MProEngEngine.h>
       
    28 #include <MProEngAlertToneSeeker.h>
       
    29 #include <MProEngNotifyHandler.h>
       
    30 
       
    31 //  INTERNAL INCLUDES
       
    32 
       
    33 
       
    34 // CONSTRUCTION
       
    35 MT_ProEngFactory* MT_ProEngFactory::NewL()
       
    36     {
       
    37     MT_ProEngFactory* self = MT_ProEngFactory::NewLC(); 
       
    38     CleanupStack::Pop();
       
    39 
       
    40     return self;
       
    41     }
       
    42 
       
    43 MT_ProEngFactory* MT_ProEngFactory::NewLC()
       
    44     {
       
    45     MT_ProEngFactory* self = new( ELeave ) MT_ProEngFactory();
       
    46     CleanupStack::PushL( self );
       
    47 
       
    48 	self->ConstructL(); 
       
    49 
       
    50     return self;
       
    51     }
       
    52 
       
    53 // Destructor (virtual by CBase)
       
    54 MT_ProEngFactory::~MT_ProEngFactory()
       
    55     {
       
    56     iFs.Close();
       
    57     }
       
    58 
       
    59 // Default constructor
       
    60 MT_ProEngFactory::MT_ProEngFactory()
       
    61     {
       
    62     }
       
    63 
       
    64 // Second phase construct
       
    65 void MT_ProEngFactory::ConstructL()
       
    66     {
       
    67     // The ConstructL from the base class CEUnitTestSuiteClass must be called.
       
    68     // It generates the test case table.
       
    69     CEUnitTestSuiteClass::ConstructL();
       
    70     User::LeaveIfError( iFs.Connect() );
       
    71     }
       
    72 
       
    73 //  METHODS
       
    74 
       
    75 
       
    76 
       
    77 void MT_ProEngFactory::SetupL(  )
       
    78     {
       
    79 
       
    80     } 
       
    81 
       
    82 void MT_ProEngFactory::Teardown(  )
       
    83     {
       
    84 
       
    85     }
       
    86 
       
    87 void MT_ProEngFactory::MT_ProEngFactory_NewEngineLL(  )
       
    88     {
       
    89     MProEngEngine* engine = ProEngFactory::NewEngineL();
       
    90     EUNIT_ASSERT( engine );
       
    91     engine->Release();
       
    92     engine = NULL;
       
    93 
       
    94     // Test deletion through destructor:
       
    95     engine = ProEngFactory::NewEngineL();
       
    96     EUNIT_ASSERT( engine );
       
    97     delete engine;
       
    98     }
       
    99 
       
   100 void MT_ProEngFactory::MT_ProEngFactory_NewEngineLCL(  )
       
   101     {
       
   102     MProEngEngine* engine = ProEngFactory::NewEngineLC();
       
   103     CleanupStack::Pop(); // engine
       
   104     EUNIT_ASSERT( engine );
       
   105     engine->Release();
       
   106     }
       
   107 
       
   108 void MT_ProEngFactory::MT_ProEngFactory_NewEngineL_1L(  )
       
   109     {
       
   110     MProEngEngine* engine = ProEngFactory::NewEngineL( iFs );
       
   111     EUNIT_ASSERT( engine );
       
   112     engine->Release();
       
   113     }
       
   114 
       
   115 void MT_ProEngFactory::MT_ProEngFactory_NewEngineLC_1L(  )
       
   116     {
       
   117     MProEngEngine* engine = ProEngFactory::NewEngineLC( iFs );
       
   118     CleanupStack::Pop(); // engine
       
   119     EUNIT_ASSERT( engine );
       
   120     engine->Release();
       
   121     }
       
   122 
       
   123 void MT_ProEngFactory::MT_ProEngFactory_NewNotifyHandlerLL(  )
       
   124     {
       
   125     MProEngNotifyHandler* handler = ProEngFactory::NewNotifyHandlerL();
       
   126     EUNIT_ASSERT( handler );
       
   127     delete handler;
       
   128     }
       
   129 
       
   130 void MT_ProEngFactory::MT_ProEngFactory_NewAlertToneSeekerLL(  )
       
   131     {
       
   132     MProEngAlertToneSeeker* seeker = ProEngFactory::NewAlertToneSeekerL();
       
   133     EUNIT_ASSERT( seeker );
       
   134     delete seeker;
       
   135     }
       
   136 
       
   137 //  TEST TABLE
       
   138 
       
   139 EUNIT_BEGIN_TEST_TABLE( 
       
   140     MT_ProEngFactory,
       
   141     "Profiles Wrapper Factory test cases.",
       
   142     "MODULE" )
       
   143 
       
   144 EUNIT_TEST(
       
   145     "NewEngineL - test ",
       
   146     "ProEngFactory",
       
   147     "NewEngineL",
       
   148     "FUNCTIONALITY",
       
   149     SetupL, MT_ProEngFactory_NewEngineLL, Teardown)
       
   150 
       
   151 EUNIT_TEST(
       
   152     "NewEngineLC - test ",
       
   153     "ProEngFactory",
       
   154     "NewEngineLC",
       
   155     "FUNCTIONALITY",
       
   156     SetupL, MT_ProEngFactory_NewEngineLCL, Teardown)
       
   157 
       
   158 EUNIT_TEST(
       
   159     "NewEngineL - test ",
       
   160     "ProEngFactory",
       
   161     "NewEngineL",
       
   162     "FUNCTIONALITY",
       
   163     SetupL, MT_ProEngFactory_NewEngineL_1L, Teardown)
       
   164 
       
   165 EUNIT_TEST(
       
   166     "NewEngineLC - test ",
       
   167     "ProEngFactory",
       
   168     "NewEngineLC",
       
   169     "FUNCTIONALITY",
       
   170     SetupL, MT_ProEngFactory_NewEngineLC_1L, Teardown)
       
   171 
       
   172 EUNIT_TEST(
       
   173     "NewNotifyHandlerL - test ",
       
   174     "ProEngFactory",
       
   175     "NewNotifyHandlerL",
       
   176     "FUNCTIONALITY",
       
   177     SetupL, MT_ProEngFactory_NewNotifyHandlerLL, Teardown)
       
   178 
       
   179 EUNIT_TEST(
       
   180     "NewAlertToneSeekerL - test ",
       
   181     "ProEngFactory",
       
   182     "NewAlertToneSeekerL",
       
   183     "FUNCTIONALITY",
       
   184     SetupL, MT_ProEngFactory_NewAlertToneSeekerLL, Teardown)
       
   185 
       
   186 
       
   187 EUNIT_END_TEST_TABLE
       
   188 
       
   189 //  END OF FILE