os/kernelhwsrv/kerneltest/f32test/testestart/main.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// f32\estart\estart.cpp
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
//! @SYMTestCaseID FSBASE/ESTART/PREQ808/001
sl@0
    19
//! @SYMTestType CT
sl@0
    20
//! @SYMTestCaseDesc Test start-up mode property's availability and validity
sl@0
    21
//! @SYMPREQ 808
sl@0
    22
//! @SYMTestStatus Implemented
sl@0
    23
//! @SYMTestActions Read and write the property.
sl@0
    24
//! @SYMTestExpectedResults Pass read operation and fail write operation if no correct permission.
sl@0
    25
//! @SYMTestPriority Low
sl@0
    26
//! @SYMAuthor Ying Shi
sl@0
    27
//! @SYMCreationDate 03/11/2004
sl@0
    28
//! @See Estart component
sl@0
    29
sl@0
    30
#include <e32test.h>
sl@0
    31
#include <e32property.h>
sl@0
    32
#include <e32uid.h>
sl@0
    33
#include <e32debug.h>
sl@0
    34
#include <f32file.h>
sl@0
    35
#include <f32file_private.h>
sl@0
    36
sl@0
    37
RTest gTest(_L("T_StartupMode"));
sl@0
    38
RFs gRFs;
sl@0
    39
sl@0
    40
void DoTest()
sl@0
    41
    {
sl@0
    42
    TInt r;
sl@0
    43
    gTest.Next(_L("Read startup mode"));
sl@0
    44
    TInt sysStartupMode;
sl@0
    45
    r = RProperty::Get(KUidSystemCategory, KSystemStartupModeKey, sysStartupMode);
sl@0
    46
    gTest(r == KErrNone);       // Read operation should be successful
sl@0
    47
    RDebug::Printf("System startup mode: %d", sysStartupMode);
sl@0
    48
sl@0
    49
    gTest.Next(_L("write startup mode"));
sl@0
    50
    r = RProperty::Set(KUidSystemCategory, KSystemStartupModeKey, 1);
sl@0
    51
    if (PlatSec::ConfigSetting(PlatSec::EPlatSecEnforcement))
sl@0
    52
        gTest(r == KErrPermissionDenied);   // Should have no permission to write
sl@0
    53
    else
sl@0
    54
        gTest(r == KErrNone);   // Should have no permission to write
sl@0
    55
    }
sl@0
    56
sl@0
    57
void TestPlatSec()
sl@0
    58
    {
sl@0
    59
    TInt r = gRFs.SetStartupConfiguration(ELoaderPriority, (TAny*)EPriorityNormal, 0);
sl@0
    60
    gTest(r == KErrPermissionDenied);
sl@0
    61
    }
sl@0
    62
sl@0
    63
TInt E32Main()
sl@0
    64
    {
sl@0
    65
    gTest.Title();
sl@0
    66
    gTest.Start(_L("Start-up mode test sets"));
sl@0
    67
    gTest.SetLogged(ETrue);
sl@0
    68
sl@0
    69
    TInt r = gRFs.Connect();
sl@0
    70
    gTest(r == KErrNone);
sl@0
    71
sl@0
    72
    DoTest();
sl@0
    73
sl@0
    74
    TestPlatSec();
sl@0
    75
sl@0
    76
    gRFs.Close();
sl@0
    77
sl@0
    78
    gTest.End();
sl@0
    79
    gTest.Close();
sl@0
    80
sl@0
    81
    return 0;
sl@0
    82
    }