author | hgs |
Fri, 23 Apr 2010 22:08:41 +0100 | |
changeset 121 | 661475905584 |
parent 39 | 5d2844f35677 |
permissions | -rw-r--r-- |
0 | 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; |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
26 |
extern HCR::SRepositoryCompiled CompiledRepositoryNullOrderedList; |
0 | 27 |
TUint32 PslConfigurationFlags = 0; |
28 |
||
29 |
class HCRTest : public HCR::MVariant |
|
30 |
{ |
|
31 |
public: |
|
32 |
HCRTest(); |
|
33 |
virtual ~HCRTest(); |
|
34 |
||
35 |
public: |
|
36 |
TInt Initialise(); |
|
37 |
TBool IgnoreCoreImgRepository(); |
|
38 |
TInt GetCompiledRepositoryAddress( TAny* & aAddr); |
|
39 |
TInt GetOverrideRepositoryAddress( TAny* & aAddr); |
|
40 |
}; |
|
41 |
||
42 |
HCRTest::HCRTest() |
|
43 |
{ |
|
44 |
HCR_FUNC("HCRTest"); |
|
45 |
} |
|
46 |
||
47 |
HCRTest::~HCRTest() |
|
48 |
{ |
|
49 |
HCR_FUNC("~HCRTest"); |
|
50 |
} |
|
51 |
||
52 |
TInt HCRTest::Initialise() |
|
53 |
{ |
|
54 |
HCR_FUNC("HCRTest::Initialise"); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
55 |
if (PslConfigurationFlags & ETestInitialisationFail) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
56 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
57 |
HCR_TRACE_RETURN(KErrBadPower); // random error code no.1 |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
58 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
59 |
HCR_TRACE_RETURN(KErrNone); |
0 | 60 |
} |
61 |
||
62 |
TInt HCRTest::GetCompiledRepositoryAddress(TAny*& aAddr) |
|
63 |
{ |
|
64 |
HCR_FUNC("HCRTest::GetCompiledRepositoryAddress"); |
|
65 |
TInt r = KErrNone; |
|
66 |
if (PslConfigurationFlags & ETestNullRepository) |
|
67 |
{ |
|
68 |
aAddr = NULL; |
|
69 |
r = KErrNotSupported; |
|
70 |
} |
|
71 |
else if (PslConfigurationFlags & ETestEmptyRepository) |
|
72 |
{ |
|
73 |
aAddr = static_cast<TAny*>(&CompiledEmptyRepository); |
|
74 |
} |
|
75 |
else if (PslConfigurationFlags & ETestCorruptRepository1) |
|
76 |
{ |
|
77 |
aAddr = static_cast<TAny*>(&CompiledRepositoryCorrupt1); |
|
78 |
} |
|
79 |
else if (PslConfigurationFlags & ETestCorruptRepository2) |
|
80 |
{ |
|
81 |
aAddr = static_cast<TAny*>(&CompiledRepositoryCorrupt2); |
|
82 |
} |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
83 |
else if (PslConfigurationFlags & ETestNullOrderedList) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
84 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
85 |
aAddr = static_cast<TAny*>(&CompiledRepositoryNullOrderedList); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
86 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
87 |
else if (PslConfigurationFlags & ETestNullRepositoryKErrNone) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
88 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
89 |
aAddr = NULL; |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
90 |
r = KErrNone; // Invalid error code: should be KErrNotSupported |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
91 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
92 |
else if (PslConfigurationFlags & ETestBadErrorCode) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
93 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
94 |
aAddr = static_cast<TAny*>(&CompiledEmptyRepository); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
95 |
r = KErrCommsParity; // random error code no.2 |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
96 |
} |
0 | 97 |
else |
98 |
{ |
|
99 |
aAddr = static_cast<TAny*>(&CompiledRepository); |
|
100 |
} |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
101 |
HCR_TRACE_RETURN(r); |
0 | 102 |
} |
103 |
||
104 |
TBool HCRTest::IgnoreCoreImgRepository() |
|
105 |
{ |
|
106 |
HCR_FUNC("HCRTest::IgnoreCoreImgRepository"); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
107 |
HCR_TRACE_RETURN(PslConfigurationFlags & ETestIgnoreCoreImgRepository); |
0 | 108 |
} |
109 |
||
110 |
TInt HCRTest::GetOverrideRepositoryAddress(TAny*& aAddr) |
|
111 |
{ |
|
112 |
HCR_FUNC("HCRTest::GetRAMRepositoryAddress"); |
|
39
5d2844f35677
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
113 |
// Note: the SMR feature by which we obtain the address of the override |
5d2844f35677
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
114 |
// repository is only supported in the ARM bootstrap, not X86 so this test |
5d2844f35677
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
115 |
// code may in the future need conditional compilation should it need to |
5d2844f35677
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
116 |
// access the SuperPage SMR field to return KErrNotSupported for __X86__ |
5d2844f35677
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
117 |
// compilations. |
0 | 118 |
TInt r = KErrNotSupported; |
119 |
if (PslConfigurationFlags & ETestEnableOverrideRepository) |
|
120 |
{ |
|
121 |
aAddr = static_cast<TAny*>(&CompiledEmptyRepository); |
|
122 |
r = KErrNone; |
|
123 |
} |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
124 |
HCR_TRACE_RETURN(r); |
0 | 125 |
} |
126 |
||
127 |
GLDEF_C HCR::MVariant* CreateHCRVariant() |
|
128 |
{ |
|
129 |
HCR_FUNC("CreateHCRTest"); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
130 |
if (PslConfigurationFlags & ETestVariantObjectCreateFail) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
131 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
132 |
return NULL; |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
133 |
} |
0 | 134 |
return new HCRTest; |
135 |
} |