commonuisupport/uikon/test/teiksrv/tcapability/TCapability1.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     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 // The following test case is used to test whether uiktestserver has the capability
       
    15 // to access writable apis
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21  @internalComponent - Internal Symbian test code
       
    22 */
       
    23 
       
    24 #include "TCapability1.h"
       
    25 #include <e32def.h>
       
    26 #include "eiksrvc.h"
       
    27 #include <e32test.h>
       
    28 #include <test/appfwk_test.h>
       
    29 
       
    30 
       
    31 
       
    32 
       
    33 /**
       
    34    @SYMTestCaseID		UIF-UIKON-0001
       
    35   
       
    36    @SYMPREQ				Policing server apis		
       
    37   
       
    38    @SYMTestCaseDesc 	Testing whether uiktestserver has the capability to access writable apis
       
    39   
       
    40    @SYMTestPriority 	High
       
    41   
       
    42    @SYMTestStatus 		Implemented
       
    43    
       
    44    @SYMTestActions  
       
    45    To connect to REikAppUiSession and to check whether uiktestserver process
       
    46    has the permission to access the mentioned apis
       
    47    API Calls:\n		
       
    48    REikAppUiSession::Connect();
       
    49    REikAppUiSession::OpenFepAttributes();
       
    50    REikAppUiSession::SetInstalledFepName(const TDesC& aName, TBool aRaiseFileError) const;
       
    51    REikAppUiSession::SetFepAttribute(TUid aAttribUid, const TDesC8& aAttribData) const;
       
    52    REikAppUiSession::CommitFepAttributes() const ;
       
    53    @SYMTestExpectedResults Test should complete without any panic.
       
    54    
       
    55  */
       
    56 void CTCapability1Step::ExecuteL()
       
    57 	{
       
    58 	TInt ret;
       
    59 	REikAppUiSession uiSession;
       
    60 
       
    61 	TEST(uiSession.Connect()==KErrNone);
       
    62 	CleanupClosePushL(uiSession);
       
    63 
       
    64 	TSecurityInfo info;
       
    65 	info.Set(RProcess());
       
    66 	
       
    67 	APPFWK_NEGATIVE_PLATSEC_START;
       
    68 	ret=uiSession.SetInstalledFepName(KNullDesC,FALSE);
       
    69 	APPFWK_NEGATIVE_PLATSEC_FINISH;
       
    70 	INFO_PRINTF1(_L("Capability check of SetInstalledFepName"));
       
    71 	INFO_PRINTF3(_L("Expected return code: %d, Actual return code: %d"), KErrPermissionDenied, ret);
       
    72 	TEST(ret==KErrPermissionDenied);
       
    73 
       
    74 	uiSession.OpenFepAttributes();
       
    75 
       
    76 	APPFWK_NEGATIVE_PLATSEC_START;
       
    77 	ret=uiSession.SetFepAttribute(KNullUid,KNullDesC8);
       
    78 	APPFWK_NEGATIVE_PLATSEC_FINISH;
       
    79 	INFO_PRINTF1(_L("Capability check of SetInstalledFepName"));
       
    80 	INFO_PRINTF3(_L("Expected return code: %d, Actual return code: %d"), KErrPermissionDenied, ret);
       
    81 	TEST(ret==KErrPermissionDenied);
       
    82 
       
    83 	CleanupStack::PopAndDestroy(&uiSession);
       
    84 	}
       
    85 
       
    86 CTCapability1Step::CTCapability1Step()
       
    87 /**
       
    88    Constructor
       
    89  */
       
    90 	{
       
    91 	// Call base class method to set up the human readable name for logging
       
    92 	SetTestStepName(KTCapability1Step);
       
    93 	}
       
    94 
       
    95 CTCapability1Step::~CTCapability1Step()
       
    96 	{
       
    97 	}
       
    98 
       
    99 TVerdict CTCapability1Step::doTestStepL()
       
   100     {
       
   101 	INFO_PRINTF1(_L("UIF-UIKON-0001: Capability1 - Started"));
       
   102 	
       
   103 	__UHEAP_MARK; // mark heap state
       
   104 	SetTestStepID(_L("UIF-UIKON-0001"));
       
   105 
       
   106 	TRAPD(error,ExecuteL()); // do most stuff under cleanup stack
       
   107 	__ASSERT_ALWAYS(!error,User::Panic(_L("TestParse"),error));
       
   108 
       
   109 	RecordTestResultL();
       
   110 	CloseTMSGraphicsStep();
       
   111 	__UHEAP_MARKEND; // check no memory leak
       
   112 
       
   113 	INFO_PRINTF1(_L("UIF-UIKON-0001: Capability1 - Finished"));
       
   114 
       
   115 	return TestStepResult();
       
   116 	}