applayerpluginsandutils/bookmarksupport/test/tbmoomtester.cpp
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "tbmoomtester.h"
       
    17 #include "tbmtests.h"
       
    18 #include "testutils.h"
       
    19 #include <e32test.h>
       
    20 #include <centralrepository.h>
       
    21 
       
    22 const TUid KUidBookmarkDatabaseRepository   = { 0x10205AF8 };
       
    23 const TUid KUidFolderRepository             = { 0x10205AF9 };
       
    24 const TUid KUidBookmarkRepository           = { 0x10205AFA };
       
    25 const TUid KUidIconRepository               = { 0x10205AFB };
       
    26 
       
    27 
       
    28 CBmOomTester* CBmOomTester::NewL ( CTestWrapper& aTest )
       
    29 	{
       
    30 	CBmOomTester* self = new (ELeave) CBmOomTester ( aTest );
       
    31 	CleanupStack::PushL ( self );
       
    32 	self->ConstructL ();
       
    33 	CleanupStack::Pop ( self );
       
    34 	return self;
       
    35 	}
       
    36 
       
    37 CBmOomTester::CBmOomTester ( CTestWrapper& aTest ) 
       
    38 : iTestWrapper ( aTest )
       
    39 	{
       
    40 	
       
    41 	}
       
    42 	
       
    43 CBmOomTester::~CBmOomTester ()
       
    44 	{
       
    45 	delete iBmTester;
       
    46 	}
       
    47 
       
    48 void CBmOomTester::TestL ()
       
    49 	{
       
    50 	iBmTester->OpenDbL ();
       
    51 	iBmTester->SetBkmrkDbPropertiesL ();
       
    52 	iBmTester->CreateCustomPropertiesL ();
       
    53 	iBmTester->CreateTreeL ();
       
    54 	iBmTester->CommitDbL  ();
       
    55 	iBmTester->CloseDb ();	
       
    56 	iBmTester->OpenDbL ();
       
    57 	iBmTester->SetCustomPropertiesValueL ();
       
    58 	iBmTester->UpdateBkmrkDbPropertiesL ();	
       
    59 	iBmTester->ModifyTreeL ();
       
    60 	iBmTester->CommitDbL  ();
       
    61 	iBmTester->CloseDb ();
       
    62 	iBmTester->OpenDbL ();
       
    63 	iBmTester->ReadCustomPropertiesValueL ();
       
    64 	iBmTester->UpdateTreeL ();	
       
    65 	iBmTester->DeleteAllL ();
       
    66 	iBmTester->CommitDbL  ();
       
    67 	iBmTester->UpdateTreeL ();	
       
    68 	iBmTester->CloseDb ();
       
    69 	}
       
    70 
       
    71 void CBmOomTester::ResetBkmrkDbL ()
       
    72 	{
       
    73 	ResetRepositoryL ( KUidBookmarkDatabaseRepository );
       
    74 	ResetRepositoryL ( KUidFolderRepository );
       
    75 	ResetRepositoryL ( KUidBookmarkRepository );
       
    76 	ResetRepositoryL ( KUidIconRepository );
       
    77 	}
       
    78 	
       
    79 void CBmOomTester::ConstructL ()
       
    80 	{
       
    81 	ResetBkmrkDbL ();
       
    82 	iBmTester = CBmTests::NewL ( iTestWrapper );
       
    83 	}
       
    84 
       
    85 void CBmOomTester::ResetRepositoryL ( TUid aUid )
       
    86 	{
       
    87 	CRepository* repository = CRepository::NewL ( aUid );
       
    88 	CleanupStack::PushL ( repository );
       
    89 	User::LeaveIfError ( repository->Reset() );	
       
    90 	CleanupStack::PopAndDestroy ( repository );
       
    91 	}
       
    92