kerneltest/e32test/hcr/d_hcrsim_psl.cpp
changeset 0 a41df078684a
child 31 56f325a607ea
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 /*
       
     2 * Copyright (c) 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 *
       
    16 */
       
    17 
       
    18 #include "hcr_debug.h"
       
    19 #include "hcr_hai.h"
       
    20 #include "d_hcrsim.h"
       
    21 
       
    22 extern HCR::SRepositoryCompiled CompiledRepository;
       
    23 extern HCR::SRepositoryCompiled CompiledEmptyRepository;
       
    24 extern HCR::SRepositoryCompiled CompiledRepositoryCorrupt1;
       
    25 extern HCR::SRepositoryCompiled CompiledRepositoryCorrupt2;
       
    26 TUint32 PslConfigurationFlags = 0;
       
    27 
       
    28 class HCRTest : public HCR::MVariant
       
    29 	{
       
    30 public:
       
    31 	HCRTest();
       
    32 	virtual ~HCRTest();
       
    33 	
       
    34 public:	
       
    35 	TInt Initialise(); 
       
    36 	TBool IgnoreCoreImgRepository();
       
    37 	TInt GetCompiledRepositoryAddress( TAny* & aAddr);
       
    38 	TInt GetOverrideRepositoryAddress( TAny* & aAddr);
       
    39 	};
       
    40 
       
    41 HCRTest::HCRTest()
       
    42 	{
       
    43 	HCR_FUNC("HCRTest");
       
    44 	}
       
    45 
       
    46 HCRTest::~HCRTest()
       
    47 	{
       
    48 	HCR_FUNC("~HCRTest");
       
    49 	}
       
    50 
       
    51 TInt HCRTest::Initialise()
       
    52 	{
       
    53 	HCR_FUNC("HCRTest::Initialise");
       
    54 
       
    55 	HCR_LOG_RETURN(KErrNone);
       
    56 	}
       
    57 
       
    58 TInt HCRTest::GetCompiledRepositoryAddress(TAny*& aAddr)
       
    59 	{
       
    60 	HCR_FUNC("HCRTest::GetCompiledRepositoryAddress");
       
    61 	TInt r = KErrNone;
       
    62 	if (PslConfigurationFlags & ETestNullRepository)
       
    63 		{
       
    64 		aAddr = NULL;
       
    65 		r = KErrNotSupported;
       
    66 		}
       
    67 	else if (PslConfigurationFlags & ETestEmptyRepository)
       
    68 		{
       
    69 		aAddr = static_cast<TAny*>(&CompiledEmptyRepository);
       
    70 		}
       
    71 	else if (PslConfigurationFlags & ETestCorruptRepository1)
       
    72 		{
       
    73 		aAddr = static_cast<TAny*>(&CompiledRepositoryCorrupt1);
       
    74 		}
       
    75 	else if (PslConfigurationFlags & ETestCorruptRepository2)
       
    76 		{
       
    77 		aAddr = static_cast<TAny*>(&CompiledRepositoryCorrupt2);
       
    78 		}
       
    79 	else
       
    80 		{
       
    81 		aAddr = static_cast<TAny*>(&CompiledRepository);
       
    82 		}
       
    83 	HCR_LOG_RETURN(r);
       
    84 	}
       
    85 
       
    86 TBool HCRTest::IgnoreCoreImgRepository()
       
    87 	{
       
    88 	HCR_FUNC("HCRTest::IgnoreCoreImgRepository");
       
    89 	HCR_LOG_RETURN(PslConfigurationFlags & ETestIgnoreCoreImgRepository);
       
    90 	}
       
    91 
       
    92 TInt HCRTest::GetOverrideRepositoryAddress(TAny*& aAddr)
       
    93 	{
       
    94 	HCR_FUNC("HCRTest::GetRAMRepositoryAddress");
       
    95 	TInt r = KErrNotSupported;
       
    96 	if (PslConfigurationFlags & ETestEnableOverrideRepository)
       
    97 		{
       
    98 		aAddr = static_cast<TAny*>(&CompiledEmptyRepository);
       
    99 		r = KErrNone;
       
   100 		}
       
   101 	HCR_LOG_RETURN(r);
       
   102 	}
       
   103 
       
   104 GLDEF_C HCR::MVariant* CreateHCRVariant()
       
   105 	{
       
   106 	HCR_FUNC("CreateHCRTest");
       
   107 	return new HCRTest;
       
   108 	}