kerneltest/e32test/hcr/d_hcrsim_psl.cpp
changeset 31 56f325a607ea
parent 0 a41df078684a
child 39 5d2844f35677
equal deleted inserted replaced
15:4122176ea935 31:56f325a607ea
    21 
    21 
    22 extern HCR::SRepositoryCompiled CompiledRepository;
    22 extern HCR::SRepositoryCompiled CompiledRepository;
    23 extern HCR::SRepositoryCompiled CompiledEmptyRepository;
    23 extern HCR::SRepositoryCompiled CompiledEmptyRepository;
    24 extern HCR::SRepositoryCompiled CompiledRepositoryCorrupt1;
    24 extern HCR::SRepositoryCompiled CompiledRepositoryCorrupt1;
    25 extern HCR::SRepositoryCompiled CompiledRepositoryCorrupt2;
    25 extern HCR::SRepositoryCompiled CompiledRepositoryCorrupt2;
       
    26 extern HCR::SRepositoryCompiled CompiledRepositoryNullOrderedList;
    26 TUint32 PslConfigurationFlags = 0;
    27 TUint32 PslConfigurationFlags = 0;
    27 
    28 
    28 class HCRTest : public HCR::MVariant
    29 class HCRTest : public HCR::MVariant
    29 	{
    30 	{
    30 public:
    31 public:
    49 	}
    50 	}
    50 
    51 
    51 TInt HCRTest::Initialise()
    52 TInt HCRTest::Initialise()
    52 	{
    53 	{
    53 	HCR_FUNC("HCRTest::Initialise");
    54 	HCR_FUNC("HCRTest::Initialise");
    54 
    55 	if (PslConfigurationFlags & ETestInitialisationFail)
    55 	HCR_LOG_RETURN(KErrNone);
    56 		{
       
    57 		HCR_TRACE_RETURN(KErrBadPower); // random error code no.1
       
    58 		}
       
    59 	HCR_TRACE_RETURN(KErrNone);
    56 	}
    60 	}
    57 
    61 
    58 TInt HCRTest::GetCompiledRepositoryAddress(TAny*& aAddr)
    62 TInt HCRTest::GetCompiledRepositoryAddress(TAny*& aAddr)
    59 	{
    63 	{
    60 	HCR_FUNC("HCRTest::GetCompiledRepositoryAddress");
    64 	HCR_FUNC("HCRTest::GetCompiledRepositoryAddress");
    74 		}
    78 		}
    75 	else if (PslConfigurationFlags & ETestCorruptRepository2)
    79 	else if (PslConfigurationFlags & ETestCorruptRepository2)
    76 		{
    80 		{
    77 		aAddr = static_cast<TAny*>(&CompiledRepositoryCorrupt2);
    81 		aAddr = static_cast<TAny*>(&CompiledRepositoryCorrupt2);
    78 		}
    82 		}
       
    83 	else if (PslConfigurationFlags & ETestNullOrderedList)
       
    84 		{
       
    85 		aAddr = static_cast<TAny*>(&CompiledRepositoryNullOrderedList);
       
    86 		}
       
    87 	else if (PslConfigurationFlags & ETestNullRepositoryKErrNone)
       
    88 		{
       
    89 		aAddr = NULL;
       
    90 		r = KErrNone; // Invalid error code: should be KErrNotSupported
       
    91 		}
       
    92 	else if (PslConfigurationFlags & ETestBadErrorCode)
       
    93 		{
       
    94 		aAddr = static_cast<TAny*>(&CompiledEmptyRepository);
       
    95 		r = KErrCommsParity; // random error code no.2
       
    96 		}
    79 	else
    97 	else
    80 		{
    98 		{
    81 		aAddr = static_cast<TAny*>(&CompiledRepository);
    99 		aAddr = static_cast<TAny*>(&CompiledRepository);
    82 		}
   100 		}
    83 	HCR_LOG_RETURN(r);
   101 	HCR_TRACE_RETURN(r);
    84 	}
   102 	}
    85 
   103 
    86 TBool HCRTest::IgnoreCoreImgRepository()
   104 TBool HCRTest::IgnoreCoreImgRepository()
    87 	{
   105 	{
    88 	HCR_FUNC("HCRTest::IgnoreCoreImgRepository");
   106 	HCR_FUNC("HCRTest::IgnoreCoreImgRepository");
    89 	HCR_LOG_RETURN(PslConfigurationFlags & ETestIgnoreCoreImgRepository);
   107 	HCR_TRACE_RETURN(PslConfigurationFlags & ETestIgnoreCoreImgRepository);
    90 	}
   108 	}
    91 
   109 
    92 TInt HCRTest::GetOverrideRepositoryAddress(TAny*& aAddr)
   110 TInt HCRTest::GetOverrideRepositoryAddress(TAny*& aAddr)
    93 	{
   111 	{
    94 	HCR_FUNC("HCRTest::GetRAMRepositoryAddress");
   112 	HCR_FUNC("HCRTest::GetRAMRepositoryAddress");
    96 	if (PslConfigurationFlags & ETestEnableOverrideRepository)
   114 	if (PslConfigurationFlags & ETestEnableOverrideRepository)
    97 		{
   115 		{
    98 		aAddr = static_cast<TAny*>(&CompiledEmptyRepository);
   116 		aAddr = static_cast<TAny*>(&CompiledEmptyRepository);
    99 		r = KErrNone;
   117 		r = KErrNone;
   100 		}
   118 		}
   101 	HCR_LOG_RETURN(r);
   119 	HCR_TRACE_RETURN(r);
   102 	}
   120 	}
   103 
   121 
   104 GLDEF_C HCR::MVariant* CreateHCRVariant()
   122 GLDEF_C HCR::MVariant* CreateHCRVariant()
   105 	{
   123 	{
   106 	HCR_FUNC("CreateHCRTest");
   124 	HCR_FUNC("CreateHCRTest");
       
   125 	if (PslConfigurationFlags & ETestVariantObjectCreateFail)
       
   126 		{
       
   127 		return NULL;
       
   128 		}
   107 	return new HCRTest;
   129 	return new HCRTest;
   108 	}
   130 	}