diff -r 000000000000 -r bde4ae8d615e os/persistentdata/featuremgmt/featureregistry/test/helper/testpublish/testpublish.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os/persistentdata/featuremgmt/featureregistry/test/helper/testpublish/testpublish.cpp Fri Jun 15 03:10:57 2012 +0200 @@ -0,0 +1,65 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// For platsec tests: attempts to set the value of the Feature Registry property. +// Feature Registry property must be defined first. +// If run with argument "KErrNone", returns KErrNone if publish is successful, which +// should only happen if this EXE passes the write policy of the feature property. +// If run with argument "KErrPermissionDenied" it returns KErrNone (success) if publish +// failed for reason KErrPermissionDenied, otherwise it will return a different error code. +// Use SETCAP to vary the capabilities of this executable. +// +// + +/** + @file + @internalComponent + @test +*/ + +#include +#include +#include "featregcmn.h" + +_LIT(KTestResultNone, "KErrNone"); +_LIT(KTestResultPermissionDenied, "KErrPermissionDenied"); + +TInt E32Main() + { + TFileName cmdLine; + User::CommandLine(cmdLine); + + TInt result = RProperty::Set(KFeaturePropCat, KFeaturePropKey, KNullDesC8); + + if (cmdLine.Find(KTestResultNone) >= 0) + { + // result should already be KErrNone if succeeded + } + else if (cmdLine.Find(KTestResultPermissionDenied) >= 0) + { + if (result == KErrPermissionDenied) + { + result = KErrNone; + } + else + { + result = KErrGeneral; + } + } + else + { + result = KErrArgument; + } + + return result; + }