web_pub/favourites_engine_api/tsrc/src/FavouritesDbTestObserver.cpp
changeset 1 7c90e6132015
child 25 0ed94ceaa377
equal deleted inserted replaced
0:dd21522fd290 1:7c90e6132015
       
     1 /*
       
     2 * Copyright (c) 2000 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 the License "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 class CFavouritesDbTestObserver
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 
       
    21 #include <FavouritesDb.h>
       
    22 #include "FavouritesDbTestObserver.h"
       
    23 //#include "FavouritesDbTester.h"
       
    24 #include "ActiveFavouritesDbNotifier.h"
       
    25 
       
    26 // CONSTANTS
       
    27 
       
    28 // ================= MEMBER FUNCTIONS =======================
       
    29 
       
    30 // ---------------------------------------------------------
       
    31 // CFavouritesDbTestObserver::CFavouritesDbTestObserver
       
    32 // ---------------------------------------------------------
       
    33 //
       
    34 CFavouritesDbTestObserver::CFavouritesDbTestObserver
       
    35 ( CFavouritesEngineTest& aTester )
       
    36 : CActive( EPriorityLow ), iTester( &aTester )
       
    37     {
       
    38     // Observer has lower priority than the notifier; to make sure we don't
       
    39     // miss notification.
       
    40     CActiveScheduler::Add( this );
       
    41     }
       
    42 
       
    43 // ---------------------------------------------------------
       
    44 // CFavouritesDbTestObserver::~CFavouritesDbTestObserver
       
    45 // ---------------------------------------------------------
       
    46 //
       
    47 CFavouritesDbTestObserver::~CFavouritesDbTestObserver()
       
    48     {
       
    49     Cancel();
       
    50     delete iNotifier;
       
    51 //    iTester->iDb.Close();
       
    52     }
       
    53 
       
    54 // ---------------------------------------------------------
       
    55 // CFavouritesDbTestObserver::RunL
       
    56 // ---------------------------------------------------------
       
    57 //
       
    58 void CFavouritesDbTestObserver::RunL()
       
    59     {
       
    60     CActiveScheduler::Stop();
       
    61     }
       
    62 
       
    63 // ---------------------------------------------------------
       
    64 // CFavouritesDbTestObserver::DoCancel
       
    65 // ---------------------------------------------------------
       
    66 //
       
    67 void CFavouritesDbTestObserver::DoCancel()
       
    68     {
       
    69     if ( iNotifier )
       
    70         {
       
    71         iNotifier->Cancel();
       
    72         }
       
    73     }
       
    74 
       
    75 // ---------------------------------------------------------
       
    76 // CFavouritesDbTestObserver::HandleFavouritesDbEventL
       
    77 // ---------------------------------------------------------
       
    78 //
       
    79 void CFavouritesDbTestObserver::HandleFavouritesDbEventL
       
    80 ( RDbNotifier::TEvent aEvent )
       
    81     {
       
    82     iLastEvent = aEvent;
       
    83     iEventCount++;
       
    84     }
       
    85 
       
    86 // ---------------------------------------------------------
       
    87 // CFavouritesDbTestObserver::Start
       
    88 // ---------------------------------------------------------
       
    89 //
       
    90 void CFavouritesDbTestObserver::Start()
       
    91     {
       
    92     iStep = -1; // First call to Next will increment it to 1.
       
    93     iLastEvent = 666;
       
    94     iEventCount = 0;
       
    95     Next();
       
    96     }
       
    97 
       
    98 // ---------------------------------------------------------
       
    99 // CFavouritesDbTestObserver::Next
       
   100 // ---------------------------------------------------------
       
   101 //
       
   102 void CFavouritesDbTestObserver::Next()
       
   103     {
       
   104     iStep++;
       
   105     iStatus = KRequestPending;
       
   106     SetActive();
       
   107 	TRequestStatus *status = &iStatus;
       
   108 	User::RequestComplete( status, KErrNone );  // Invoke RunL()
       
   109     }
       
   110