installationservices/swcomponentregistry/test/tscr/source/sifsteps.cpp
branchRCL_3
changeset 66 8b7f4e561641
parent 65 7333d7932ef7
child 70 e8965914fac7
equal deleted inserted replaced
65:7333d7932ef7 66:8b7f4e561641
     1 /*
       
     2 * Copyright (c) 2008-2009 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 * Implements the test steps for SIF-oriented APIs in the SCR
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include "sifsteps.h"
       
    21 #include <scs/cleanuputils.h>
       
    22 #include "tscrdefs.h"
       
    23 
       
    24 using namespace Usif;
       
    25 
       
    26 // -----------CScrGetPluginStep-----------------
       
    27 
       
    28 CScrGetPluginStep::CScrGetPluginStep(CScrTestServer& aParent)	: CScrTestStep(aParent)
       
    29 	{
       
    30 	}
       
    31 
       
    32 void CScrGetPluginStep::ImplTestStepPreambleL()
       
    33 	{
       
    34 	CScrTestStep::ImplTestStepPreambleL();
       
    35 	}
       
    36 
       
    37 
       
    38 void CScrGetPluginStep::ImplTestStepL()
       
    39 	{
       
    40 	TUid expectedPluginUid = GetPluginUidFromConfigL();
       
    41 	TUid retPluginUid = TUid::Null();
       
    42 	
       
    43 	TPtrC mimeType;
       
    44 	if(GetMimeTypeFromConfigL(mimeType))
       
    45 		{
       
    46 		retPluginUid = iScrSession.GetPluginUidL(mimeType);
       
    47 		}
       
    48 	else
       
    49 		{
       
    50 		TComponentId componentId = GetComponentIdL();
       
    51 		retPluginUid = iScrSession.GetPluginUidL(componentId);
       
    52 		}
       
    53 	
       
    54 	if(retPluginUid != expectedPluginUid)
       
    55 		{
       
    56 		ERR_PRINTF3(_L("Returned plugin Uid (%d) doesn't match with the expected one(%d)."), retPluginUid.iUid, expectedPluginUid.iUid);
       
    57 		SetTestStepResult(EFail);
       
    58 		}
       
    59 	}
       
    60 
       
    61 void CScrGetPluginStep::ImplTestStepPostambleL()
       
    62 	{
       
    63 	CScrTestStep::ImplTestStepPostambleL();
       
    64 	}
       
    65 
       
    66 TUid CScrGetPluginStep::GetPluginUidFromConfigL()
       
    67 	{
       
    68 	TInt pluginUid;
       
    69 	if (!GetIntFromConfig(ConfigSection(), KPluginUidName, pluginUid))
       
    70 			PrintErrorL(_L("Plugin UID was not found!"), KErrNotFound);	
       
    71 	return TUid::Uid(pluginUid);
       
    72 	}
       
    73 
       
    74 TBool CScrGetPluginStep::GetMimeTypeFromConfigL(TPtrC& aMimeType)
       
    75 	{
       
    76 	return GetStringFromConfig(ConfigSection(), KMimeTypeName, aMimeType);
       
    77 	}
       
    78 
       
    79 // -----------CScrSetScomoStateStep-----------------
       
    80 
       
    81 CScrSetScomoStateStep::CScrSetScomoStateStep(CScrTestServer& aParent)	: CScrTestStep(aParent)
       
    82 	{
       
    83 	}
       
    84 
       
    85 void CScrSetScomoStateStep::ImplTestStepPreambleL()
       
    86 	{
       
    87 	CScrTestStep::ImplTestStepPreambleL();
       
    88 	}
       
    89 
       
    90 void CScrSetScomoStateStep::ImplTestStepL()
       
    91 	{
       
    92 	TInt componentId = GetComponentIdL();
       
    93 	
       
    94 	TScomoState scomoState;
       
    95 	if (!GetScomoStateFromConfigL(scomoState, _L("ScomoState")))
       
    96 		PrintErrorL(_L("ScomoState attribute not found"), KErrNotFound);
       
    97 	
       
    98 	iScrSession.SetScomoStateL(componentId, scomoState);
       
    99 	}
       
   100 
       
   101 void CScrSetScomoStateStep::ImplTestStepPostambleL()
       
   102 	{
       
   103 	CScrTestStep::ImplTestStepPostambleL();
       
   104 	}