1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/themeserverpropertydefine.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,88 @@
1.4 +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// This Process called with the argument KThemeServerPropertyDefineCmdDefine, defines
1.18 +// the theme server RProperty catagory to be the same as the theme servers process ID.
1.19 +// Called with the argument KThemeServerPropertyDefineCmdDelete, it will delete the
1.20 +// theme server RProperty. This is because an RProperty can only be defined and deleted
1.21 +// from within a process with the same UID3 as the RProperty catogory you are trying to
1.22 +// define/delete.
1.23 +//
1.24 +
1.25 +/**
1.26 + @file
1.27 + @test
1.28 + @internalComponent - Internal Nokia test code
1.29 + */
1.30 +
1.31 +#include <BACLINE.H>
1.32 +#include <e32base.h>
1.33 +#include <e32property.h>
1.34 +#include "..\..\nga\server\renderorientationtracker.h" //for KThemeOrientationCatagory and KThemeOrientationKey
1.35 +#include "themeserverpropertydefine.h"
1.36 +
1.37 +void DefineThemeServerPropertyL()
1.38 + {
1.39 + RProperty themeServerOrientationProperty;
1.40 + const TSecurityPolicy KThemeOrientationReadSecurityPolicy(
1.41 + TSecurityPolicy::EAlwaysPass);
1.42 + const TSecurityPolicy KThemeOrientationWriteSecurityPolicy(
1.43 + TSecurityPolicy::EAlwaysPass);
1.44 + User::LeaveIfError(RProperty::Define( KThemeOrientationCategory,
1.45 + KThemeOrientationKey,
1.46 + RProperty::EInt,
1.47 + KThemeOrientationReadSecurityPolicy,
1.48 + KThemeOrientationWriteSecurityPolicy));
1.49 + themeServerOrientationProperty.Close();
1.50 + }
1.51 +
1.52 +void DeleteThemeServerPropertyL()
1.53 + {
1.54 + TInt err = KErrNone;
1.55 + RProperty themeServerOrientationProperty;
1.56 + User::LeaveIfError(themeServerOrientationProperty.Delete(
1.57 + KThemeOrientationCategory, KThemeOrientationKey));
1.58 + themeServerOrientationProperty.Close();
1.59 + }
1.60 +
1.61 +void MainL()
1.62 + {
1.63 + CCommandLineArguments* args = CCommandLineArguments::NewLC();
1.64 + TPtrC argumentPrt(args->Arg(1));
1.65 + if (argumentPrt == KThemeServerPropertyDefineCmdDefine)
1.66 + {
1.67 + DefineThemeServerPropertyL();
1.68 + }
1.69 + else if (argumentPrt == KThemeServerPropertyDefineCmdDelete)
1.70 + {
1.71 + DeleteThemeServerPropertyL();
1.72 + }
1.73 + else
1.74 + {
1.75 + User::Leave(KErrNotSupported);
1.76 + }
1.77 + CleanupStack::PopAndDestroy(args);
1.78 + }
1.79 +
1.80 +GLDEF_C TInt E32Main()
1.81 + {
1.82 + CTrapCleanup* cleanUpStack = CTrapCleanup::New();
1.83 + if (cleanUpStack == NULL)
1.84 + {
1.85 + return KErrNoMemory;
1.86 + }
1.87 + TRAPD(err, MainL());
1.88 + delete cleanUpStack;
1.89 + return (err);
1.90 + }
1.91 +