Update contrib.
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
18 #include "hcr_debug.h"
22 extern HCR::SRepositoryCompiled CompiledRepository;
23 extern HCR::SRepositoryCompiled CompiledEmptyRepository;
24 extern HCR::SRepositoryCompiled CompiledRepositoryCorrupt1;
25 extern HCR::SRepositoryCompiled CompiledRepositoryCorrupt2;
26 extern HCR::SRepositoryCompiled CompiledRepositoryNullOrderedList;
27 TUint32 PslConfigurationFlags = 0;
29 class HCRTest : public HCR::MVariant
37 TBool IgnoreCoreImgRepository();
38 TInt GetCompiledRepositoryAddress( TAny* & aAddr);
39 TInt GetOverrideRepositoryAddress( TAny* & aAddr);
52 TInt HCRTest::Initialise()
54 HCR_FUNC("HCRTest::Initialise");
55 if (PslConfigurationFlags & ETestInitialisationFail)
57 HCR_TRACE_RETURN(KErrBadPower); // random error code no.1
59 HCR_TRACE_RETURN(KErrNone);
62 TInt HCRTest::GetCompiledRepositoryAddress(TAny*& aAddr)
64 HCR_FUNC("HCRTest::GetCompiledRepositoryAddress");
66 if (PslConfigurationFlags & ETestNullRepository)
71 else if (PslConfigurationFlags & ETestEmptyRepository)
73 aAddr = static_cast<TAny*>(&CompiledEmptyRepository);
75 else if (PslConfigurationFlags & ETestCorruptRepository1)
77 aAddr = static_cast<TAny*>(&CompiledRepositoryCorrupt1);
79 else if (PslConfigurationFlags & ETestCorruptRepository2)
81 aAddr = static_cast<TAny*>(&CompiledRepositoryCorrupt2);
83 else if (PslConfigurationFlags & ETestNullOrderedList)
85 aAddr = static_cast<TAny*>(&CompiledRepositoryNullOrderedList);
87 else if (PslConfigurationFlags & ETestNullRepositoryKErrNone)
90 r = KErrNone; // Invalid error code: should be KErrNotSupported
92 else if (PslConfigurationFlags & ETestBadErrorCode)
94 aAddr = static_cast<TAny*>(&CompiledEmptyRepository);
95 r = KErrCommsParity; // random error code no.2
99 aAddr = static_cast<TAny*>(&CompiledRepository);
104 TBool HCRTest::IgnoreCoreImgRepository()
106 HCR_FUNC("HCRTest::IgnoreCoreImgRepository");
107 HCR_TRACE_RETURN(PslConfigurationFlags & ETestIgnoreCoreImgRepository);
110 TInt HCRTest::GetOverrideRepositoryAddress(TAny*& aAddr)
112 HCR_FUNC("HCRTest::GetRAMRepositoryAddress");
113 // Note: the SMR feature by which we obtain the address of the override
114 // repository is only supported in the ARM bootstrap, not X86 so this test
115 // code may in the future need conditional compilation should it need to
116 // access the SuperPage SMR field to return KErrNotSupported for __X86__
118 TInt r = KErrNotSupported;
119 if (PslConfigurationFlags & ETestEnableOverrideRepository)
121 aAddr = static_cast<TAny*>(&CompiledEmptyRepository);
127 GLDEF_C HCR::MVariant* CreateHCRVariant()
129 HCR_FUNC("CreateHCRTest");
130 if (PslConfigurationFlags & ETestVariantObjectCreateFail)