contentctrl_plat/adapter_customization_api/tsrc/ContactAdapter/cnsmldummymodsfetcher_test.h
branchRCL_3
changeset 24 8e7494275d3a
parent 23 2bb96f4ecad8
child 25 4f0867e42d62
equal deleted inserted replaced
23:2bb96f4ecad8 24:8e7494275d3a
     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:  Header file for contact adapter's modfetcher unit tests.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CNSMLDUMMYMODSFETCHER_TEST_H__
       
    19 #define __CNSMLDUMMYMODSFETCHER_TEST_H__
       
    20 
       
    21 // INCLUDES
       
    22 #include <CEUnitTestSuiteClass.h>
       
    23 #include <EUnitDecorators.h>
       
    24 #include <SmlDataSyncDefs.h>
       
    25 #include <S32MEM.H>
       
    26 #include <CNTDEF.H>
       
    27 #include <MVPbkContactStore.h>
       
    28 #include <MVPbkContactStoreObserver.h>
       
    29 #include <MVPbkContactViewObserver.h>
       
    30 #include <MVPbkContactViewBase.h>
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class CNSmlDummyModsFetcher;
       
    34 class CContactDatabase;
       
    35 class CNSmlChangeFinder;
       
    36 class CNSmlAdapterTestUtilities;
       
    37 class CContactItemField;
       
    38 class CVPbkContactManager;
       
    39 
       
    40 
       
    41 // CLASS DEFINITION
       
    42 /**
       
    43  * Generated EUnit test suite class.
       
    44  */
       
    45 NONSHARABLE_CLASS( CNSmlDummyModsFetcher_Test ):
       
    46     public CEUnitTestSuiteClass,
       
    47 	public MSmlSyncRelationship,
       
    48 	public MVPbkContactStoreObserver,
       
    49 	public MVPbkContactViewObserver
       
    50     {
       
    51     public:  // Constructors and destructor
       
    52 
       
    53         static CNSmlDummyModsFetcher_Test* NewL();
       
    54         static CNSmlDummyModsFetcher_Test* NewLC();
       
    55         ~CNSmlDummyModsFetcher_Test();
       
    56 
       
    57     private: // Constructors
       
    58 
       
    59         CNSmlDummyModsFetcher_Test();
       
    60         void ConstructL();
       
    61 
       
    62     private: // New methods
       
    63 
       
    64         void Empty() {};
       
    65 
       
    66         void SetupL();
       
    67         void SetupCreateItemL();
       
    68 
       
    69         void Teardown();
       
    70         
       
    71         void CreateViewL();
       
    72 
       
    73         void RunError();
       
    74         
       
    75         void ContactViewUnavailable();
       
    76         
       
    77         void ContactRemovedFromView();
       
    78         
       
    79         void ContactViewError();
       
    80         
       
    81         void VPbkSingleContactOperationFailed();
       
    82 
       
    83     public: // MSmlSyncRelationship
       
    84 
       
    85         /**
       
    86         Returns the unique identifier for the synchronisation relationship.
       
    87         @return             A unique identifier for the sync relationship.
       
    88         */
       
    89         TSmlSyncTaskKey SyncTaskKey() const;
       
    90 
       
    91         /**
       
    92         Opens a specified stream for reading, and places an item on the cleanup stack to close it.
       
    93         @param               aReadStream    On return, an open read stream
       
    94         @param               aStreamUid     The UID of the stream to open for reading.
       
    95         */
       
    96         void OpenReadStreamLC(RReadStream& aReadStream, TUid aStreamUid);
       
    97 
       
    98         /**
       
    99         Opens the specified stream, or creates a new one if it does not exist, and places an item on the cleanup stack to close it.
       
   100         @param              aWriteStream    On return, an open write stream
       
   101         @param              aStreamUid      The UID of the stream to open or create
       
   102         */
       
   103         void OpenWriteStreamLC(RWriteStream& aWriteStream, TUid aStreamUid);
       
   104 
       
   105         /**
       
   106         Tests if the specified stream identified exists in the store.
       
   107         @param              aStreamUid The stream UID
       
   108         @return             Non-zero if the stream exists, otherwise EFalse.
       
   109         */
       
   110         TBool IsStreamPresentL(TUid aStreamUid) const;
       
   111 
       
   112     private: // from MVPbkContactStoreObserver
       
   113         
       
   114         void StoreReady(MVPbkContactStore& aContactStore);
       
   115         
       
   116         void StoreUnavailable(MVPbkContactStore& aContactStore,
       
   117                 TInt aReason);
       
   118         
       
   119         void HandleStoreEventL(
       
   120                 MVPbkContactStore& aContactStore,
       
   121                 TVPbkContactStoreEvent aStoreEvent);
       
   122 
       
   123          // From MVPbkContactViewObserver  
       
   124         void ContactViewReady( MVPbkContactViewBase& aView ) ;
       
   125        
       
   126         void ContactViewUnavailable(
       
   127                     MVPbkContactViewBase& aView ) ;
       
   128         
       
   129         void ContactAddedToView(
       
   130                     MVPbkContactViewBase& aView, 
       
   131                     TInt aIndex, 
       
   132                     const MVPbkContactLink& aContactLink );
       
   133         
       
   134         void ContactRemovedFromView(
       
   135                     MVPbkContactViewBase& aView, 
       
   136                     TInt aIndex, 
       
   137                     const MVPbkContactLink& aContactLink ) ;
       
   138              
       
   139         void ContactViewError(
       
   140                     MVPbkContactViewBase& aView, 
       
   141                     TInt aError, 
       
   142                     TBool aErrorNotified ) ;
       
   143                     
       
   144         
       
   145     private: // helper
       
   146 
       
   147         CContactItemField* CreateConfidentialLC();
       
   148 
       
   149 
       
   150     private: // Data
       
   151 
       
   152         CNSmlDummyModsFetcher* iCNSmlDummyModsFetcher;
       
   153         CContactDatabase* iContactDatabase;  // Not owned
       
   154         CNSmlChangeFinder* iChangeFinder;
       
   155         TKeyArrayFix iKey;
       
   156         TBool iSyncHistory;
       
   157         TBool iSnapshotRegistered;
       
   158         HBufC8* iTestData;
       
   159         RDesReadStream iReadStream;
       
   160 
       
   161         CNSmlAdapterTestUtilities* iTestUtilities;
       
   162         TContactItemId iCardId;
       
   163         TTime iLastChanged;
       
   164 
       
   165         // VPbk related
       
   166         CVPbkContactManager* iContactManager;
       
   167         MVPbkContactStore* iStore;
       
   168         MVPbkContactViewBase* iContactViewBase;
       
   169 
       
   170         EUNIT_DECLARE_TEST_TABLE;
       
   171 
       
   172     };
       
   173 
       
   174 #endif      //  __CNSMLDUMMYMODSFETCHER_TEST_H__