applayerpluginsandutils/bookmarksupport/test/Integration/TestBookmarksSuite/TestOpenItemStep.cpp
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2005-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 // Contains implementation of CTestOpenItemStep class
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalTechnology 
       
    21 */
       
    22 
       
    23 // System Include
       
    24 #include <bookmarkdatabase.h>
       
    25 
       
    26 // User Include
       
    27 #include "TestOpenItemStep.h"
       
    28 
       
    29 /**
       
    30 Constructor. Sets the test step name
       
    31 @internalTechnology
       
    32 @test
       
    33 */
       
    34 CTestOpenItemStep::CTestOpenItemStep(CTestBookmarksServer& aTestServer) : CTestBookmarksBaseStep(aTestServer)
       
    35 	{
       
    36 	//Call base class method to set human readable name for test step
       
    37 	SetTestStepName(KTestOpenItemStep);
       
    38 	}
       
    39 
       
    40 
       
    41 /**
       
    42 Base class pure virtual.
       
    43 @internalTechnology
       
    44 @test
       
    45 @param		None
       
    46 @return		EPass or EFail indicating the result of the test step.
       
    47 */
       
    48 TVerdict CTestOpenItemStep::doTestStepL()
       
    49 	{
       
    50 	TPtrC typeOfItem;
       
    51 	TPtrC title;
       
    52 	if(!GetStringFromConfig(ConfigSection(), KIniTypeOfItem, typeOfItem	) ||
       
    53 	   !GetStringFromConfig(ConfigSection(), KIniTitle,		 title		)
       
    54 	  )
       
    55 		{
       
    56 		ERR_PRINTF3(_L("Problem in reading values from ini.			\
       
    57 						\nExpected fields are: \n%S\n%S\n"
       
    58 					  ),&KIniTypeOfItem, &KIniTitle
       
    59 				   );
       
    60 		SetTestStepResult(EFail);
       
    61 		}
       
    62 	else
       
    63 		{
       
    64 		DoTest(typeOfItem, title);
       
    65 		}
       
    66 	return TestStepResult();
       
    67 	}	// doTestStepL
       
    68 
       
    69 /**
       
    70 Opens an item with a particular title
       
    71 @internalTechnology
       
    72 @test
       
    73 @param		Type of item.
       
    74 @param		Title of item to be opened
       
    75 @return		None
       
    76 */
       
    77 void CTestOpenItemStep::DoTest(const TPtrC& aTypeOfItem, const TPtrC& aTitle)
       
    78 	{
       
    79 	TInt error = KErrNone;
       
    80 	RBkNode bkNode;
       
    81 	if((error = GetBkNode(aTitle, aTypeOfItem, bkNode)) != KErrNone)
       
    82 		{
       
    83 		ERR_PRINTF3(_L("Error occured while opening item %S : %D"), &aTitle, error);
       
    84 		SetTestStepError(error);
       
    85 		}
       
    86 	else
       
    87 		{
       
    88 		INFO_PRINTF2(_L("Attempt to open item %S succeeded"), &aTitle);
       
    89 		}
       
    90 	bkNode.Close();
       
    91 	}	// DoTest