os/kernelhwsrv/kerneltest/f32test/testestart/main.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 1998-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 the License "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 // f32\estart\estart.cpp
    15 // 
    16 //
    17 
    18 //! @SYMTestCaseID FSBASE/ESTART/PREQ808/001
    19 //! @SYMTestType CT
    20 //! @SYMTestCaseDesc Test start-up mode property's availability and validity
    21 //! @SYMPREQ 808
    22 //! @SYMTestStatus Implemented
    23 //! @SYMTestActions Read and write the property.
    24 //! @SYMTestExpectedResults Pass read operation and fail write operation if no correct permission.
    25 //! @SYMTestPriority Low
    26 //! @SYMAuthor Ying Shi
    27 //! @SYMCreationDate 03/11/2004
    28 //! @See Estart component
    29 
    30 #include <e32test.h>
    31 #include <e32property.h>
    32 #include <e32uid.h>
    33 #include <e32debug.h>
    34 #include <f32file.h>
    35 #include <f32file_private.h>
    36 
    37 RTest gTest(_L("T_StartupMode"));
    38 RFs gRFs;
    39 
    40 void DoTest()
    41     {
    42     TInt r;
    43     gTest.Next(_L("Read startup mode"));
    44     TInt sysStartupMode;
    45     r = RProperty::Get(KUidSystemCategory, KSystemStartupModeKey, sysStartupMode);
    46     gTest(r == KErrNone);       // Read operation should be successful
    47     RDebug::Printf("System startup mode: %d", sysStartupMode);
    48 
    49     gTest.Next(_L("write startup mode"));
    50     r = RProperty::Set(KUidSystemCategory, KSystemStartupModeKey, 1);
    51     if (PlatSec::ConfigSetting(PlatSec::EPlatSecEnforcement))
    52         gTest(r == KErrPermissionDenied);   // Should have no permission to write
    53     else
    54         gTest(r == KErrNone);   // Should have no permission to write
    55     }
    56 
    57 void TestPlatSec()
    58     {
    59     TInt r = gRFs.SetStartupConfiguration(ELoaderPriority, (TAny*)EPriorityNormal, 0);
    60     gTest(r == KErrPermissionDenied);
    61     }
    62 
    63 TInt E32Main()
    64     {
    65     gTest.Title();
    66     gTest.Start(_L("Start-up mode test sets"));
    67     gTest.SetLogged(ETrue);
    68 
    69     TInt r = gRFs.Connect();
    70     gTest(r == KErrNone);
    71 
    72     DoTest();
    73 
    74     TestPlatSec();
    75 
    76     gRFs.Close();
    77 
    78     gTest.End();
    79     gTest.Close();
    80 
    81     return 0;
    82     }