uiservicetab/vimpstengine/tsrc/vimpstengine_ut/src/t_vimpstenginerequestmapper.cpp
branchRCL_3
changeset 28 3104fc151679
parent 27 2b7283837edb
child 29 9a48e301e94b
equal deleted inserted replaced
27:2b7283837edb 28:3104fc151679
     1 /*
       
     2 * t_vimpstenginerequestmapper.cpp :: Copyright (c) 2009 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: t_vimpstenginerequestmapper.cpp
       
    15 *
       
    16 */
       
    17 #include <EUnitMacros.h>
       
    18 #include <TEUnitAssertionInfo.h>
       
    19 #include <CEUnitAllocTestCaseDecorator.h>
       
    20 #include "t_vimpstenginerequestmapper.h"
       
    21 #include "cvimpstenginerequestmapper.h"
       
    22 #include "cvimpstenginerequest.h"
       
    23 
       
    24 extern TXIMPRequestId gTXIMPRequestId;
       
    25 
       
    26 T_VIMPSTEngineRequestMapper* T_VIMPSTEngineRequestMapper::NewLC()
       
    27     {
       
    28     T_VIMPSTEngineRequestMapper* self = new( ELeave ) T_VIMPSTEngineRequestMapper;
       
    29     CleanupStack::PushL( self );
       
    30     self->ConstructL();
       
    31     return self;
       
    32     }
       
    33 
       
    34 T_VIMPSTEngineRequestMapper::~T_VIMPSTEngineRequestMapper()
       
    35     {
       
    36     }
       
    37 
       
    38 void T_VIMPSTEngineRequestMapper::ConstructL()
       
    39     {
       
    40     CEUnitTestSuiteClass::ConstructL();
       
    41     }
       
    42 
       
    43         
       
    44 void T_VIMPSTEngineRequestMapper::SetupL()
       
    45     {   
       
    46     iRequestMapper = CVIMPSTEngineRequestMapper::NewL() ;
       
    47     }    
       
    48 
       
    49 void T_VIMPSTEngineRequestMapper::Teardown()
       
    50     {
       
    51     delete iRequestMapper;
       
    52     }
       
    53 
       
    54 
       
    55 void T_VIMPSTEngineRequestMapper::TestAllFunctionsL()
       
    56     {
       
    57     
       
    58     //Do all the functions here.. 
       
    59     gTXIMPRequestId.Init(1000);  
       
    60     
       
    61     CVIMPSTEngineRequest* req1 = iRequestMapper->FindRequestId(gTXIMPRequestId);    
       
    62     EUNIT_ASSERT(NULL == req1);
       
    63     req1 = NULL;
       
    64     
       
    65     // remove the request mapper
       
    66     iRequestMapper->RemoveRequestId(gTXIMPRequestId);
       
    67    
       
    68     
       
    69     CVIMPSTEngineRequest* req3 = iRequestMapper->CreateRequestL(gTXIMPRequestId, 
       
    70 										ETrue,
       
    71 										EVIMPSTXimpOperationBind) ;
       
    72 	EUNIT_ASSERT(req3);									
       
    73 	EUNIT_ASSERT(EVIMPSTXimpOperationBind == req3->RequestType());
       
    74 	req3 = NULL;
       
    75 											
       
    76 	iRequestMapper->RemoveRequestId(gTXIMPRequestId) ;	
       
    77 	
       
    78 	gTXIMPRequestId.Init(2000);  
       
    79 	CVIMPSTEngineRequest* req5 = iRequestMapper->CreateRequestL(gTXIMPRequestId, 
       
    80 										EFalse,
       
    81 										EVIMPSTXimpOperationUnBind) ;
       
    82 	EUNIT_ASSERT(req5);									
       
    83 	EUNIT_ASSERT(EVIMPSTXimpOperationUnBind == req5->RequestType());
       
    84 	req5 = NULL;
       
    85 	
       
    86 	CVIMPSTEngineRequest* req7 = iRequestMapper->FindRequestId(gTXIMPRequestId);    
       
    87     EUNIT_ASSERT(req7);
       
    88     EUNIT_ASSERT(EVIMPSTXimpOperationUnBind == req7->RequestType());
       
    89     req7 = NULL;
       
    90     										
       
    91 	iRequestMapper->RemoveRequestId(gTXIMPRequestId) ;	
       
    92     }
       
    93 
       
    94 
       
    95 EUNIT_BEGIN_TEST_TABLE( T_VIMPSTEngineRequestMapper, "T_VIMPSTEngineRequestMapper", "" )
       
    96 
       
    97     EUNIT_TEST( "TestAllFunctionsL ",
       
    98             "T_VIMPSTEngineRequestMapper",
       
    99             "TestAllFunctionsL",
       
   100             "FUNCTIONALITY", SetupL, TestAllFunctionsL, Teardown )
       
   101     
       
   102 EUNIT_END_TESTCASE_TABLE
       
   103 
       
   104 //  END OF FILE