installationservices/swinstallationfw/test/securitytests/source/scrapparccomponentspecific.cpp
branchRCL_3
changeset 25 7333d7932ef7
equal deleted inserted replaced
24:5cc91383ab1e 25:7333d7932ef7
       
     1 /*
       
     2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "scrapparccomponentspecific.h"
       
    20 
       
    21 #include <usif/scr/scr.h>
       
    22 #include <scs/cleanuputils.h>
       
    23 #include <e32def.h>
       
    24 
       
    25 _LIT(KScrCompSecName, "SCR-APPARC Component-specific APIs test");
       
    26 
       
    27 using namespace Usif;
       
    28 
       
    29 CScrApparcComponentSpecificSecTest* CScrApparcComponentSpecificSecTest::NewL()
       
    30     {
       
    31     CScrApparcComponentSpecificSecTest* self=new(ELeave) CScrApparcComponentSpecificSecTest();
       
    32     CleanupStack::PushL(self);
       
    33     self->ConstructL();
       
    34     CleanupStack::Pop(self);
       
    35     return self;
       
    36     }
       
    37 
       
    38 CScrApparcComponentSpecificSecTest::CScrApparcComponentSpecificSecTest()
       
    39     {
       
    40     SetSidRequired(TUid::Uid(0x10003A3F)); // Use tscrapparc SID as the one required for accessinf apparc specific subsession
       
    41     }
       
    42     
       
    43 void CScrApparcComponentSpecificSecTest::ConstructL()
       
    44     {
       
    45     SetNameL(KScrCompSecName);
       
    46     }
       
    47 
       
    48 void CScrApparcComponentSpecificSecTest::RunTestL()
       
    49     {
       
    50     RSoftwareComponentRegistry scrSession;
       
    51     User::LeaveIfError(scrSession.Connect());
       
    52     CleanupClosePushL(scrSession);
       
    53     RApplicationRegistryView subSession;   
       
    54     CleanupClosePushL(subSession);
       
    55     TRAPD(err,subSession.OpenViewL(scrSession));     
       
    56     CheckFailL(err, _L("OpenApplicationRegistrationView"));
       
    57           
       
    58     if(err == NULL)
       
    59         {
       
    60         RPointerArray<CApplicationRegistrationData> actualAppRegData;
       
    61         CleanupClosePushL(actualAppRegData);
       
    62         TRAP(err,subSession.GetNextApplicationRegistrationInfoL(5, actualAppRegData));
       
    63         CheckFailL(err, _L("GetNextApplicationRegistrationInfo"));
       
    64         CleanupStack::PopAndDestroy(&actualAppRegData);
       
    65         }
       
    66     CleanupStack::PopAndDestroy(&subSession);
       
    67     
       
    68     RPointerArray<CLauncherExecutable> launchers;
       
    69     CleanupClosePushL(launchers);
       
    70     TRAP(err,scrSession.GetApplicationLaunchersL(launchers));
       
    71     CheckFailL(err, _L("GetApplicationLaunchersL"));
       
    72     CleanupStack::PopAndDestroy(&launchers);
       
    73     
       
    74     CleanupStack::PopAndDestroy(&scrSession);
       
    75     }
       
    76