idlefw/tsrc/ai_utilities_api/src/mt_apiaiplugintool.cpp
branchRCL_3
changeset 111 053c6c7c14f3
equal deleted inserted replaced
110:2c7f27287390 111:053c6c7c14f3
       
     1 /*
       
     2 * 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 // CLASS UNDER TEST
       
    19 #include <caouserafter.h>
       
    20 #include <aiutility.h>
       
    21 #include <aiplugintool.h>
       
    22 #include <mt_apiaiplugintool.h>
       
    23 
       
    24 #include <aisystemuids.hrh>
       
    25 //#include <aicontentpublisher.h>
       
    26 
       
    27 #include <digia/eunit/eunitmacros.h>
       
    28 
       
    29 
       
    30 // CONSTRUCTION
       
    31 MT_ApiAiplugintool* MT_ApiAiplugintool::NewL()
       
    32     {
       
    33     MT_ApiAiplugintool* self = MT_ApiAiplugintool::NewLC();
       
    34     CleanupStack::Pop( self );
       
    35     return self;
       
    36     }
       
    37 
       
    38 MT_ApiAiplugintool* MT_ApiAiplugintool::NewLC()
       
    39     {
       
    40     MT_ApiAiplugintool* self = new( ELeave ) MT_ApiAiplugintool();
       
    41     CleanupStack::PushL( self );
       
    42     self->ConstructL();
       
    43     return self;
       
    44     }
       
    45 
       
    46 // Destructor (virtual by CBase)
       
    47 MT_ApiAiplugintool::~MT_ApiAiplugintool()
       
    48     {
       
    49 #if _BullseyeCoverage
       
    50     cov_write();
       
    51 #endif
       
    52     }
       
    53 
       
    54 // Default constructor
       
    55 MT_ApiAiplugintool::MT_ApiAiplugintool()
       
    56     {
       
    57     }
       
    58 
       
    59 // Second phase construct
       
    60 void MT_ApiAiplugintool::ConstructL()
       
    61     {
       
    62     // The ConstructL from the base class CEUnitTestSuiteClass must be called.
       
    63     // It generates the test case table.
       
    64     CEUnitTestSuiteClass::ConstructL();
       
    65 
       
    66     //CAOUserAfter::AfterLD( 2 * 1000000 );
       
    67     }
       
    68 
       
    69 //  METHODS
       
    70 
       
    71 void MT_ApiAiplugintool::SetupL(  )
       
    72     {
       
    73     iAiPluginTool = AiUtility::CreatePluginToolL();
       
    74     }
       
    75 
       
    76 void MT_ApiAiplugintool::Teardown(  )
       
    77     {
       
    78     if( iPublisher )
       
    79     {
       
    80     iPublisher->Stop( CHsContentPublisher::ESystemShutdown );
       
    81     delete iPublisher;
       
    82     iPublisher = NULL;        
       
    83     }
       
    84 
       
    85     Release( iAiPluginTool );
       
    86     }
       
    87 
       
    88 void MT_ApiAiplugintool::TestContentItemIteratorLL(  )
       
    89     {
       
    90     TUid uid = { AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_PROFILEPLUGIN };
       
    91     
       
    92     _LIT( KDeviceStatusPluginName, "0x10275101" );
       
    93     _LIT8( KNameSpace, "1" );
       
    94  
       
    95     THsPublisherInfo pubInfo( uid, KDeviceStatusPluginName, KNameSpace );
       
    96     iPublisher = CHsContentPublisher::NewL( pubInfo );
       
    97  
       
    98     MAiContentItemIterator* itemIterator = NULL;
       
    99     itemIterator= iAiPluginTool->ContentItemIterator( *iPublisher );
       
   100 
       
   101     EUNIT_ASSERT( itemIterator);
       
   102     }
       
   103 
       
   104 //  TEST TABLE
       
   105 
       
   106 EUNIT_BEGIN_TEST_TABLE(
       
   107     MT_ApiAiplugintool,
       
   108     "Test MAiPluginTool implementation returned from AiUtility::CreatePluginToolL",
       
   109     "MODULE")
       
   110 
       
   111 EUNIT_TEST(
       
   112     "Test ContentItemIteratorL",
       
   113     "ContentItemIteratorL",
       
   114     "All",
       
   115     "FUNCTIONALITY",
       
   116     SetupL, TestContentItemIteratorLL, Teardown)
       
   117 
       
   118 EUNIT_END_TEST_TABLE
       
   119 
       
   120 //  END OF FILE