mmsharing/mmshmanagercli/tsrc/ut_managercli/src/ut_cmusmanagerimpl.cpp
changeset 0 f0cf47e981f9
equal deleted inserted replaced
-1:000000000000 0:f0cf47e981f9
       
     1 /*
       
     2 * Copyright (c) 2006-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 unit tests for CMusManagerImpl class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "musmanager.h"
       
    21 #include "musmanagerimpl.h"
       
    22 #include "ut_cmusmanagerimpl.h"
       
    23 #include "musmanagerserverstarter.h"
       
    24 
       
    25 // To avoid warning about "invalid token pasting" when generating test table
       
    26 #pragma warn_illtokenpasting off
       
    27 
       
    28 
       
    29 // ======== MEMBER FUNCTIONS ========
       
    30 
       
    31 
       
    32 UT_CMusManagerImpl::UT_CMusManagerImpl()
       
    33     : CEUnitTestSuiteClass()
       
    34     {
       
    35     }
       
    36 
       
    37 
       
    38 // ---------------------------------------------------------------------------
       
    39 // The ConstructL from the base class CEUnitTestSuiteClass must be called.
       
    40 // It generates the test case table.
       
    41 // ---------------------------------------------------------------------------
       
    42 //
       
    43 void UT_CMusManagerImpl::ConstructL()
       
    44     {
       
    45     CEUnitTestSuiteClass::ConstructL();
       
    46     }
       
    47 
       
    48 
       
    49 UT_CMusManagerImpl* UT_CMusManagerImpl::NewL()
       
    50     {
       
    51     UT_CMusManagerImpl* self = UT_CMusManagerImpl::NewLC();
       
    52     CleanupStack::Pop( self );
       
    53     return self;
       
    54     }
       
    55 
       
    56 
       
    57 UT_CMusManagerImpl* UT_CMusManagerImpl::NewLC()
       
    58     {
       
    59     UT_CMusManagerImpl* self = new( ELeave ) UT_CMusManagerImpl;
       
    60     CleanupStack::PushL( self );
       
    61     self->ConstructL();
       
    62     return self;
       
    63     }
       
    64 
       
    65 
       
    66 UT_CMusManagerImpl::~UT_CMusManagerImpl()
       
    67     {
       
    68     }
       
    69 
       
    70 
       
    71 // ---------------------------------------------------------------------------
       
    72 // Sets up a test case by instantiating tested class.
       
    73 // ---------------------------------------------------------------------------
       
    74 //
       
    75 void UT_CMusManagerImpl::SetupL(  )
       
    76     {
       
    77     iImpl = CMusManagerImpl::NewL();
       
    78     }
       
    79 
       
    80 
       
    81 // ---------------------------------------------------------------------------
       
    82 // Finalizes a test case by freeing resources.
       
    83 // ---------------------------------------------------------------------------
       
    84 //
       
    85 void UT_CMusManagerImpl::Teardown(  )
       
    86     {
       
    87     delete iImpl;
       
    88     }
       
    89 
       
    90 
       
    91 // ======== UNIT TEST METHODS ========
       
    92 
       
    93 
       
    94 // ---------------------------------------------------------------------------
       
    95 // Dummy test to increase execution coverage.
       
    96 // ---------------------------------------------------------------------------
       
    97 //
       
    98 void UT_CMusManagerImpl::UT_CMusManagerImpl_StartServerL()
       
    99     {
       
   100     iImpl->StartServer();
       
   101     }
       
   102 
       
   103 
       
   104 // ---------------------------------------------------------------------------
       
   105 // Dummy test to increase execution coverage.
       
   106 // ---------------------------------------------------------------------------
       
   107 //
       
   108 void UT_CMusManagerImpl::UT_CMusManagerImpl_ServerStartedL()
       
   109     {
       
   110     iImpl->ServerStarted();
       
   111     }
       
   112 
       
   113 
       
   114 // ---------------------------------------------------------------------------
       
   115 // Dummy test to increase execution coverage.
       
   116 // ---------------------------------------------------------------------------
       
   117 //
       
   118 void UT_CMusManagerImpl::UT_CMusManagerImpl_ExamineAvailabilityLL()
       
   119     {
       
   120     iImpl->ExamineAvailabilityL();
       
   121     } 
       
   122 
       
   123 
       
   124 // ---------------------------------------------------------------------------
       
   125 // Dummy test to increase execution coverage.
       
   126 // ---------------------------------------------------------------------------
       
   127 //
       
   128 void UT_CMusManagerImpl::UT_CMusManagerImpl_AvailabilityLL()
       
   129     {
       
   130     iImpl->AvailabilityL();
       
   131     }
       
   132 
       
   133 
       
   134 // ---------------------------------------------------------------------------
       
   135 // Dummy test to increase execution coverage.
       
   136 // ---------------------------------------------------------------------------
       
   137 //
       
   138 void UT_CMusManagerImpl::UT_CMusManagerImpl_HandleSipRequestLL()
       
   139     {
       
   140     iImpl->HandleSipRequestL( 1 );
       
   141     }
       
   142 
       
   143 
       
   144 // ---------------------------------------------------------------------------
       
   145 // Dummy test to increase execution coverage.
       
   146 // ---------------------------------------------------------------------------
       
   147 //
       
   148 void UT_CMusManagerImpl::UT_CMusManagerImpl_StartApplicationLL()
       
   149     {
       
   150     iImpl->StartApplicationL( MultimediaSharing::EMusLiveVideo );
       
   151     iImpl->StartApplicationL( MultimediaSharing::EMusClipVideo );
       
   152     iImpl->StartApplicationL( MultimediaSharing::EMusStillImage );
       
   153     }
       
   154 
       
   155 
       
   156 // ---------------------------------------------------------------------------
       
   157 // Dummy test to increase execution coverage.
       
   158 // ---------------------------------------------------------------------------
       
   159 //
       
   160 void UT_CMusManagerImpl::UT_CMusManagerImpl_StopApplicationLL()
       
   161     {
       
   162     iImpl->StopApplicationL();
       
   163     }
       
   164 
       
   165 
       
   166 // ---------------------------------------------------------------------------
       
   167 // Dummy test to increase execution coverage.
       
   168 // ---------------------------------------------------------------------------
       
   169 //
       
   170 void UT_CMusManagerImpl::UT_CMusManagerImpl_QueryAvailabilityLL()
       
   171     {
       
   172     iImpl->QueryAvailabilityL();
       
   173     }
       
   174 
       
   175 
       
   176 // ---------------------------------------------------------------------------
       
   177 // Dummy test to increase execution coverage.
       
   178 // ---------------------------------------------------------------------------
       
   179 //
       
   180 void UT_CMusManagerImpl::UT_CMusManagerImpl_InitSessionLL()
       
   181     {
       
   182     iImpl->InitSessionL();
       
   183     }
       
   184 
       
   185 
       
   186 // ---------------------------------------------------------------------------
       
   187 // Dummy test to increase execution coverage.
       
   188 // ---------------------------------------------------------------------------
       
   189 //
       
   190 void UT_CMusManagerImpl::UT_CMusManagerImpl_ConnectLL()
       
   191     {
       
   192     iImpl->ConnectL();
       
   193     }
       
   194 
       
   195 void UT_CMusManagerImpl::UT_CMusManagerImpl_HandleCommandLL()
       
   196     {
       
   197     MultimediaSharing::TCommandType commandType = MultimediaSharing::ECommandNotDefined;
       
   198     iImpl->HandleCommandL( commandType );
       
   199     commandType = MultimediaSharing::ECommandManualActivation;
       
   200     iImpl->HandleCommandL( commandType );
       
   201     
       
   202     }
       
   203 
       
   204 
       
   205 // ======== EUNIT TEST TABLE ========
       
   206 
       
   207 
       
   208 EUNIT_BEGIN_TEST_TABLE(
       
   209     UT_CMusManagerImpl,
       
   210     "CMusManagerImpl",
       
   211     "CMusManagerImpl" )
       
   212 
       
   213 EUNIT_TEST(
       
   214     "ConnectL - test",
       
   215     "CMusManagerImpl",
       
   216     "ConnectL",
       
   217     "FUNCTIONALITY",
       
   218     SetupL, UT_CMusManagerImpl_ConnectLL, Teardown )
       
   219 
       
   220 EUNIT_TEST(
       
   221     "InitSessionL - test",
       
   222     "CMusManagerImpl",
       
   223     "InitSessionL",
       
   224     "FUNCTIONALITY",
       
   225     SetupL, UT_CMusManagerImpl_InitSessionLL, Teardown )
       
   226 
       
   227 EUNIT_TEST(
       
   228     "QueryAvailabilityL - test",
       
   229     "CMusManagerImpl",
       
   230     "QueryAvailabilityL",
       
   231     "FUNCTIONALITY",
       
   232     SetupL, UT_CMusManagerImpl_QueryAvailabilityLL, Teardown )
       
   233 
       
   234 EUNIT_TEST(
       
   235     "StopApplicationL - test",
       
   236     "CMusManagerImpl",
       
   237     "StopApplicationL",
       
   238     "FUNCTIONALITY",
       
   239     SetupL, UT_CMusManagerImpl_StopApplicationLL, Teardown )
       
   240 
       
   241 EUNIT_TEST(
       
   242     "StartApplicationL - test",
       
   243     "CMusManagerImpl",
       
   244     "StartApplicationL",
       
   245     "FUNCTIONALITY",
       
   246     SetupL, UT_CMusManagerImpl_StartApplicationLL, Teardown )
       
   247 
       
   248 EUNIT_TEST(
       
   249     "HandleSipRequestL - test",
       
   250     "CMusManagerImpl",
       
   251     "HandleSipRequestL",
       
   252     "FUNCTIONALITY",
       
   253     SetupL, UT_CMusManagerImpl_HandleSipRequestLL, Teardown )
       
   254 
       
   255 EUNIT_TEST(
       
   256     "AvailabilityL - test",
       
   257     "CMusManagerImpl",
       
   258     "AvailabilityL",
       
   259     "FUNCTIONALITY",
       
   260     SetupL, UT_CMusManagerImpl_AvailabilityLL, Teardown )
       
   261 
       
   262 EUNIT_TEST(
       
   263     "ExamineAvailabilityL - test",
       
   264     "CMusManagerImpl",
       
   265     "ExamineAvailabilityL",
       
   266     "FUNCTIONALITY",
       
   267     SetupL, UT_CMusManagerImpl_ExamineAvailabilityLL, Teardown )
       
   268 
       
   269 EUNIT_TEST(
       
   270     "ServerStarted - test",
       
   271     "CMusManagerImpl",
       
   272     "ServerStarted",
       
   273     "FUNCTIONALITY",
       
   274     SetupL, UT_CMusManagerImpl_ServerStartedL, Teardown )
       
   275 
       
   276 EUNIT_TEST(
       
   277     "StartServer - test",
       
   278     "CMusManagerImpl",
       
   279     "StartServer",
       
   280     "FUNCTIONALITY",
       
   281     SetupL, UT_CMusManagerImpl_StartServerL, Teardown )
       
   282 
       
   283 EUNIT_TEST(
       
   284     "HandleCommandL - test",
       
   285     "CMusManager",
       
   286     "HandleCommandL",
       
   287     "FUNCTIONALITY",
       
   288     SetupL, UT_CMusManagerImpl_HandleCommandLL, Teardown )    
       
   289 
       
   290 EUNIT_END_TEST_TABLE