mmshplugins/mmshaoplugin/tsrc/ut_aoplugin/src/ut_musconferencecallmonitor.cpp
changeset 22 496ad160a278
equal deleted inserted replaced
15:ccd8e69b5392 22:496ad160a278
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  Monitor that observes the status of the current CS call
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "ut_musconferencecallmonitor.h"
       
    20 #include "musconferencecallmonitor.h"
       
    21 
       
    22 /*
       
    23 #include "muscallmonitor.h"
       
    24 #include "muscalleventmonitor.h"
       
    25 #include "musaoplugin.h"
       
    26 #include "ut_muscalleventmonitor.h"
       
    27 #include "mussesseioninformationapi.h"
       
    28 */
       
    29 
       
    30 #include <etelmm.h>
       
    31 #include <etel.h>
       
    32 #include <digia/eunit/eunitmacros.h>
       
    33 #include <e32property.h>
       
    34 
       
    35 
       
    36 #pragma warn_illtokenpasting off
       
    37 
       
    38 // Constants
       
    39 _LIT( KMusTestCallName , "Voice1");
       
    40 
       
    41 
       
    42 // -----------------------------------------------------------------------------
       
    43 // Symbian two-phase constructor.
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 UT_CMusConferenceCallMonitor* UT_CMusConferenceCallMonitor::NewLC()
       
    47     {    
       
    48     UT_CMusConferenceCallMonitor* self = new (ELeave) UT_CMusConferenceCallMonitor();
       
    49     CleanupStack::PushL( self );
       
    50     self->ConstructL();    
       
    51     return self;
       
    52     }
       
    53 
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // Symbian second-phase constructor.
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 void UT_CMusConferenceCallMonitor::ConstructL()
       
    60     {
       
    61     CEUnitTestSuiteClass::ConstructL();
       
    62     }
       
    63 
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // Observer function
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 void UT_CMusConferenceCallMonitor::StatusChanged()
       
    70     {
       
    71     // Function called flag
       
    72     iStatusChanged = ETrue;
       
    73     }
       
    74 
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // C++ constructor.
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 UT_CMusConferenceCallMonitor::UT_CMusConferenceCallMonitor() 
       
    81     : CEUnitTestSuiteClass()
       
    82     {
       
    83     // nothing
       
    84     }
       
    85 
       
    86 
       
    87 // -----------------------------------------------------------------------------
       
    88 // C++ destructor.
       
    89 // -----------------------------------------------------------------------------
       
    90 //
       
    91 UT_CMusConferenceCallMonitor::~UT_CMusConferenceCallMonitor()
       
    92     {
       
    93     }
       
    94 
       
    95    
       
    96 // -----------------------------------------------------------------------------
       
    97 //
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 void UT_CMusConferenceCallMonitor::UT_RunL()
       
   101     {    
       
   102     iStatusChanged = EFalse;
       
   103     iMonitor->RunL();
       
   104     iMonitor->Cancel();
       
   105     EUNIT_ASSERT( iStatusChanged );
       
   106     }
       
   107 
       
   108 
       
   109 // -----------------------------------------------------------------------------
       
   110 //
       
   111 // -----------------------------------------------------------------------------
       
   112 //
       
   113 void UT_CMusConferenceCallMonitor::UT_DoCancel()
       
   114     {
       
   115     iMonitor->DoCancel();
       
   116     EUNIT_ASSERT(RTelHelper::GetCalledFunction() ==
       
   117                          RTelSubSessionBase::ECancelAsyncRequest )
       
   118     }
       
   119 
       
   120 
       
   121 // -----------------------------------------------------------------------------
       
   122 //
       
   123 // -----------------------------------------------------------------------------
       
   124 //
       
   125 void UT_CMusConferenceCallMonitor::UT_RunError()
       
   126     {
       
   127     EUNIT_ASSERT_EQUALS( iMonitor->RunError( KErrNone ),
       
   128                          KErrNone )
       
   129     }
       
   130 
       
   131 // -----------------------------------------------------------------------------
       
   132 //
       
   133 // -----------------------------------------------------------------------------
       
   134 //
       
   135 void UT_CMusConferenceCallMonitor::SetupL()
       
   136     {    
       
   137     RMobilePhone phone;
       
   138     iMonitor = CMusConferenceCallMonitor::NewL( phone, *this );
       
   139     iMonitor->Cancel();
       
   140     }
       
   141 
       
   142 
       
   143 // -----------------------------------------------------------------------------
       
   144 //
       
   145 // -----------------------------------------------------------------------------
       
   146 //
       
   147 void UT_CMusConferenceCallMonitor::Teardown()
       
   148     {    
       
   149     delete iMonitor;    
       
   150     
       
   151     }
       
   152 
       
   153 // test table
       
   154 
       
   155 EUNIT_BEGIN_TEST_TABLE(
       
   156     UT_CMusConferenceCallMonitor,
       
   157     "UT_CMusConferenceCallMonitor",
       
   158     "UNIT" )
       
   159 
       
   160 EUNIT_TEST(
       
   161     "UT_RunL",
       
   162     "CMusCallEventMonitor",
       
   163     "RunL",
       
   164     "FUNCTIONALITY",
       
   165     SetupL, UT_RunL, Teardown)
       
   166 
       
   167 EUNIT_TEST(
       
   168     "UT_DoCancel",
       
   169     "CMusCallEventMonitor",
       
   170     "DoCancel",
       
   171     "FUNCTIONALITY",
       
   172     SetupL, UT_DoCancel, Teardown)
       
   173 
       
   174 EUNIT_TEST(
       
   175     "UT_RunError",
       
   176     "CMusCallEventMonitor",
       
   177     "RunError",
       
   178     "FUNCTIONALITY",
       
   179     SetupL, UT_RunError, Teardown)
       
   180 
       
   181 
       
   182 EUNIT_END_TEST_TABLE