mds_plat/context_engine_plugin_api/tsrc/inc/ContextEnginePluginTest.h
changeset 58 fe894bb075c2
parent 51 87e65c44ff3a
child 60 79f826a55db2
equal deleted inserted replaced
51:87e65c44ff3a 58:fe894bb075c2
     1 /*
       
     2 * Copyright (c) 2008-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 
       
    19 #ifndef CONTEXTENGINEPLUGINTEST_H
       
    20 #define CONTEXTENGINEPLUGINTEST_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <StifLogger.h>
       
    24 #include <TestScripterInternal.h>
       
    25 #include <StifTestModule.h>
       
    26 
       
    27 #include <mdesession.h>
       
    28 #include <contextengine.h>
       
    29 #include <contextplugin.h>
       
    30 
       
    31 // Logging path
       
    32 _LIT( KContextEnginePluginTestLogPath, "\\logs\\testframework\\ContextEnginePluginTest\\" ); 
       
    33 // Log file
       
    34 _LIT( KContextEnginePluginTestLogFile, "ContextEnginePluginTest.txt" ); 
       
    35 _LIT( KContextEnginePluginTestLogFileWithTitle, "ContextEnginePluginTest_[%S].txt" );
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 class CContextEnginePluginTest;
       
    39 
       
    40 // CLASS DECLARATION
       
    41 NONSHARABLE_CLASS(CContextEnginePluginTest) : public CScriptBase,
       
    42 											  public MMdESessionObserver,
       
    43 				                              public MContextInitializationObserver,
       
    44 				                              public MContextSnapshotObserver,
       
    45 				                              public MContextPluginObserver
       
    46 				                              
       
    47     {
       
    48     public:  // Constructors and destructor
       
    49 
       
    50         /**
       
    51         * Two-phased constructor.
       
    52         */
       
    53         static CContextEnginePluginTest* NewL( CTestModuleIf& aTestModuleIf );
       
    54 
       
    55         /**
       
    56         * Destructor.
       
    57         */
       
    58         virtual ~CContextEnginePluginTest();
       
    59 
       
    60     public: // Functions from base classes
       
    61 
       
    62         virtual TInt RunMethodL( CStifItemParser& aItem );
       
    63 
       
    64     private: // Functions from base classes
       
    65     	
       
    66     	void HandleSessionOpened(CMdESession& aSession, TInt aError);
       
    67     	void HandleSessionError(CMdESession& aSession, TInt aError);
       
    68         void ContextInitializationStatus( TInt aError );
       
    69         void ContextSnapshotStatus( CHarvesterData* aHD );        
       
    70         void PluginInitializationStatus( TInt aError );
       
    71         void PluginSnapshotStatus( CHarvesterData* aHD );
       
    72 
       
    73     private:
       
    74 
       
    75         /**
       
    76         * C++ default constructor.
       
    77         */
       
    78         CContextEnginePluginTest( CTestModuleIf& aTestModuleIf );
       
    79 
       
    80         /**
       
    81         * By default Symbian 2nd phase constructor is private.
       
    82         */
       
    83         void ConstructL();
       
    84 
       
    85         /**
       
    86         * Frees all resources allocated from test methods.
       
    87         */
       
    88         void Delete();
       
    89 
       
    90         void ActiveWait( TInt aTimeout );
       
    91         
       
    92         /**
       
    93         * Test methods are listed below. 
       
    94         */
       
    95 
       
    96         // engine
       
    97         virtual TInt BeginTestSessionL( CStifItemParser& aItem );
       
    98         virtual TInt EndTestSession( CStifItemParser& aItem );
       
    99         virtual TInt CreateObjectsL( CStifItemParser& aItem );
       
   100         virtual TInt DeleteObjectsL( CStifItemParser& aItem );
       
   101         virtual TInt CreateContextEngine1L( CStifItemParser& aItem );
       
   102         virtual TInt CreateContextEngine2L( CStifItemParser& aItem );
       
   103         virtual TInt ReleaseInstanceL( CStifItemParser& aItem );
       
   104         virtual TInt SetMdeSessionL( CStifItemParser& aItem );
       
   105         virtual TInt ContextSnapshotsL( CStifItemParser& aItem );
       
   106         virtual TInt MultipleSnapshotsL( CStifItemParser& aItem );
       
   107         virtual TInt PluginCount( CStifItemParser& aItem );
       
   108         virtual TInt Destroy( CStifItemParser& aItem );
       
   109         virtual TInt ContextEngineStaticData( CStifItemParser& aItem );
       
   110         
       
   111         // plugin
       
   112         virtual TInt LoadPluginL( CStifItemParser& aItem );
       
   113 
       
   114     private:    // Data
       
   115         
       
   116         CMdESession* iMdEClient;
       
   117         CContextEngine* iContextEngine;
       
   118         CHarvesterData* iHD;
       
   119         
       
   120         RPointerArray<CHarvesterData> iObjectArray;
       
   121         RArray<TInt> iIds;
       
   122         
       
   123         CContextPlugin* iPlugin;
       
   124         CContextPlugin* iLocationPlugin;
       
   125         CContextPlugin* iCalendarPlugin;
       
   126 
       
   127         TInt iErrorCode;
       
   128         
       
   129         TInt iInitCount;
       
   130         TInt iSnapshotCount;
       
   131         TInt iInitTarget;
       
   132         TInt iSnapshotTarget;
       
   133         
       
   134         TBool iPluginSet;
       
   135 
       
   136     };
       
   137 
       
   138 #endif      // CONTEXTENGINEPLUGINTEST_H
       
   139 
       
   140 // End of File