featuremgmt/featureregistry/test/helper/testpublish/testpublish.cpp
changeset 0 08ec8eefde2f
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     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 // For platsec tests: attempts to set the value of the Feature Registry property.
       
    15 // Feature Registry property must be defined first.
       
    16 // If run with argument "KErrNone", returns KErrNone if publish is successful, which
       
    17 // should only happen if this EXE passes the write policy of the feature property.
       
    18 // If run with argument "KErrPermissionDenied" it returns KErrNone (success) if publish
       
    19 // failed for reason KErrPermissionDenied, otherwise it will return a different error code.
       
    20 // Use SETCAP to vary the capabilities of this executable.
       
    21 // 
       
    22 //
       
    23 
       
    24 /**
       
    25  @file
       
    26  @internalComponent
       
    27  @test
       
    28 */
       
    29 
       
    30 #include <e32base.h>
       
    31 #include <e32property.h>
       
    32 #include "featregcmn.h"
       
    33 
       
    34 _LIT(KTestResultNone,				"KErrNone");
       
    35 _LIT(KTestResultPermissionDenied,	"KErrPermissionDenied");
       
    36 
       
    37 TInt E32Main()
       
    38 	{
       
    39 	TFileName cmdLine;
       
    40 	User::CommandLine(cmdLine);
       
    41 
       
    42 	TInt result = RProperty::Set(KFeaturePropCat, KFeaturePropKey, KNullDesC8);
       
    43 
       
    44 	if (cmdLine.Find(KTestResultNone) >= 0)
       
    45 		{
       
    46 		// result should already be KErrNone if succeeded
       
    47 		}
       
    48 	else if (cmdLine.Find(KTestResultPermissionDenied) >= 0)
       
    49 		{
       
    50 		if (result == KErrPermissionDenied)
       
    51 			{
       
    52 			result = KErrNone;
       
    53 			}
       
    54 		else
       
    55 			{
       
    56 			result = KErrGeneral;
       
    57 			}
       
    58 		}
       
    59 	else
       
    60 		{
       
    61 		result = KErrArgument;
       
    62 		}
       
    63 
       
    64 	return result;
       
    65 	}