applayerpluginsandutils/uripermissionservices/Test/ineturilisttestbase.cpp
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2007-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 "testutils.h"
       
    17 #include "ineturilisttestbase.h"
       
    18 
       
    19 #define __LEAVE_IF_OOM_ERROR 	if ( iError == KErrNoMemory ) \
       
    20 							User::Leave ( iError );
       
    21 
       
    22 
       
    23 CInetUriListTest* CInetUriListTest::NewL ( CTestWrapper& aTest )
       
    24 	{
       
    25 	CInetUriListTest* self = new ( ELeave ) CInetUriListTest( aTest );
       
    26 	CleanupStack::PushL ( self );
       
    27 	self->ConstructL ( );
       
    28 	CleanupStack::Pop (); // self
       
    29 	return self;
       
    30 	}
       
    31 	
       
    32 void CInetUriListTest::ConstructL ()
       
    33 	{
       
    34 	TRAP ( iError, iUriList.OpenL () ); // Open the list.	
       
    35 	__LEAVE_IF_OOM_ERROR
       
    36 	}
       
    37 
       
    38 CInetUriListTest::CInetUriListTest ( CTestWrapper& aTest )
       
    39 : iError ( KErrNone ),
       
    40 iTestWrapper ( aTest )
       
    41 	{
       
    42 		
       
    43 	}
       
    44 
       
    45 CInetUriListTest::~CInetUriListTest ()
       
    46 	{
       
    47 	iUriList.Close ();			
       
    48 	}
       
    49 
       
    50 void CInetUriListTest::TestSuccess ( TInt aError )
       
    51 	{
       
    52 	iTestWrapper.TESTE ( iError == aError, aError );
       
    53 	}
       
    54 	
       
    55 // ----------------------
       
    56 
       
    57 CAddUriTest* CAddUriTest::NewLC ( CTestWrapper& aTest, const TDesC8& aUri, ServiceType aServiceType, ListType aListType, const TDesC8& aFavouriteName )
       
    58 	{
       
    59 	CAddUriTest* self = new ( ELeave )	CAddUriTest ( aTest );
       
    60 	CleanupStack::PushL ( self );
       
    61 	self->ConstructL ( aUri, aServiceType, aListType, aFavouriteName );
       
    62 	return self;
       
    63 	}
       
    64 
       
    65 CAddUriTest::CAddUriTest ( CTestWrapper& aTest )
       
    66 : CInetUriListTest ( aTest )
       
    67 	{
       
    68 		
       
    69 	}
       
    70 
       
    71 CAddUriTest::~CAddUriTest ()
       
    72 	{
       
    73 	iInetUri.Close ();		
       
    74 	}
       
    75 
       
    76 void CAddUriTest::ConstructL ( const TDesC8& aUri, ServiceType aServiceType, ListType aListType, const TDesC8& aFavouriteName )
       
    77 	{
       
    78 	CInetUriListTest::ConstructL ();
       
    79 	iInetUri.CreateL ( aUri, aServiceType, aListType );
       
    80 	iInetUri.SetFavouriteNameL ( aFavouriteName );
       
    81 	}
       
    82 
       
    83 void CAddUriTest::DoOperationL ()
       
    84 	{
       
    85 	TRAP ( iError, iUriList.AddL ( iInetUri ) );
       
    86 	__LEAVE_IF_OOM_ERROR		
       
    87 	}
       
    88 
       
    89 // --------------------
       
    90 
       
    91 CCountUriTest* CCountUriTest::NewLC ( CTestWrapper& aTest, ServiceType aServiceType, ListType aListType )
       
    92 	{
       
    93 	CCountUriTest* self = new ( ELeave ) CCountUriTest ( aTest, aServiceType, aListType );
       
    94 	CleanupStack::PushL ( self );
       
    95 	self->ConstructL ( );
       
    96 	return self;
       
    97 		
       
    98 	}
       
    99 
       
   100 CCountUriTest::~CCountUriTest ()
       
   101 	{		
       
   102 	}
       
   103 
       
   104 void CCountUriTest::DoOperationL ()
       
   105 	{
       
   106 	TRAP ( iError, iExpectedResult = iUriList.Count ( iServiceType, iListType ) );
       
   107 	__LEAVE_IF_OOM_ERROR
       
   108 	}
       
   109 
       
   110 void CCountUriTest::ExpectedResult ( TInt aExpectedResult )
       
   111 	{
       
   112 	iTestWrapper.TEST ( iExpectedResult == aExpectedResult );		
       
   113 	}
       
   114 
       
   115 CCountUriTest::CCountUriTest ( CTestWrapper& aTest, ServiceType aServiceType, ListType aListType )
       
   116 : CInetUriListTest ( aTest ),
       
   117 iServiceType ( aServiceType ),
       
   118 iListType ( aListType ),
       
   119 iExpectedResult (0)
       
   120 	{
       
   121 		
       
   122 	}
       
   123 
       
   124 void CCountUriTest::ConstructL ()
       
   125 	{
       
   126 	CInetUriListTest::ConstructL ();
       
   127 	}