|
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // The definition of the accessor class upon the CComponentInfo |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __COMPONENTINFOSTATEACCESSOR_H__ |
|
19 #define __COMPONENTINFOSTATEACCESSOR_H__ |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <f32file.h> |
|
23 #include <s32stor.h> |
|
24 #include <s32file.h> |
|
25 |
|
26 #include "TestUtilities.h" |
|
27 #include <ecom/test_bed/testbeddefinitions.h> |
|
28 #include "StateAccessor.h" |
|
29 #include "ComponentInfo.h" |
|
30 |
|
31 // ______________________________________________________________________________ |
|
32 // |
|
33 /** |
|
34 @internalComponent |
|
35 |
|
36 Comments : State accessor for the CComponentInfo object under test. |
|
37 */ |
|
38 class TComponentInfo_StateAccessor : public MStateAccessor |
|
39 { |
|
40 public: |
|
41 /** |
|
42 @fn InvariantTest(TAny* aTestObject) |
|
43 Intended Usage : To check CComponentInfo for Invariant violation. |
|
44 @since 7.0 |
|
45 @param aTestObject A pointer to the object under test. |
|
46 @return KErrNone if the invariants were valid, error code otherwise. |
|
47 @pre TComponentInfo_StateAccessor is fully constructed. |
|
48 @post The class under test is set to the state specified. |
|
49 */ |
|
50 inline TInt InvariantTest(TAny* aTestObject); |
|
51 |
|
52 /** |
|
53 @fn Internalize(TAny* aTestObject) |
|
54 Intended Usage : Implemented by the developer to set the state of the object under test. |
|
55 @since 7.0 |
|
56 @param aTestObject The object to be tested |
|
57 @return KErrNone if the internalize was successful. |
|
58 @return One of the EPOC standard error codes indicating the reason |
|
59 for the failure to load the object state. |
|
60 @pre TComponentInfo_StateAccessor is fully constructed, and |
|
61 valid test object must be passed in. |
|
62 @post The class under test is set to the state specified |
|
63 */ |
|
64 inline virtual TInt Internalize(TAny* aTestObject); |
|
65 |
|
66 /** |
|
67 @fn Externalize(TAny* aTestObject) |
|
68 Intended Usage : Implemented by the developer to persist the state of the object under test. |
|
69 @since 7.0 |
|
70 @param aTestObject The object to be tested |
|
71 @return KErrNone if the internalize was successful. |
|
72 @return One of the EPOC standard error codes indicating the reason |
|
73 for the failure to externalize the object. |
|
74 @pre TComponentInfo_StateAccessor is fully constructed, and |
|
75 valid test object must be passed in. |
|
76 @post Returns an error code dependant on the result of the test |
|
77 */ |
|
78 inline virtual TInt Externalize(TAny* aTestObject); |
|
79 |
|
80 /** |
|
81 @fn InternalizeL(RFileReadStream& aStream, CComponentInfo* aComponentInfo) |
|
82 Intended Usage : Implemented by the developer to set the state of the object under test. |
|
83 Error Condition : Leaves with an error code. |
|
84 @leave KErrNoMemory |
|
85 @leave @see RFileReadStream |
|
86 @since 7.0 |
|
87 @param aStream The filestream to read from . |
|
88 @param aComponentInfo A pointer to the CComponentInfo object under test. |
|
89 @return None. |
|
90 @pre TComponentInfo_StateAccessor is fully constructed. |
|
91 @post The class under test is set to the state specified. |
|
92 */ |
|
93 inline void InternalizeL(RFileReadStream& aStream, CComponentInfo* aComponentInfo); |
|
94 |
|
95 /** |
|
96 @fn ExternalizeL(RFileWriteStream& aStream, CComponentInfo* aComponentInfo) |
|
97 Intended Usage : Implemented by the developer to persist the state of the object under test. |
|
98 Error Condition : Leaves with an error code. |
|
99 @leave KErrNoMemory |
|
100 @leave @see RFileWriteStream |
|
101 @since 7.0 |
|
102 @param aStream The filestream to persist into. |
|
103 @param aComponentInfo A pointer to the CComponentInfo object under test. |
|
104 @return None. |
|
105 @pre TComponentInfo_StateAccessor is fully constructed. |
|
106 @post No change to the class under test, its internal state. |
|
107 is persisted. |
|
108 */ |
|
109 inline void ExternalizeL(RFileWriteStream& aStream, CComponentInfo* aComponentInfo); |
|
110 |
|
111 private: |
|
112 /** |
|
113 @fn InternalizeL(CComponentInfo* aComponentInfo) |
|
114 Intended Usage : Implemented by the developer to set the state of the object under test. |
|
115 Error Condition : Leaves with an error code. |
|
116 @leave KErrNoMemory |
|
117 @leave @see RFileReadStream |
|
118 @since 7.0 |
|
119 @param TAny* A pointer to the object under test. |
|
120 @return None. |
|
121 @pre TComponentInfo_StateAccessor is fully constructed. |
|
122 @post The class under test is set to the state specified. |
|
123 */ |
|
124 inline void InternalizeL(CComponentInfo* aComponentInfo); |
|
125 |
|
126 /** |
|
127 @fn ExternalizeL(CComponentInfo* aComponentInfo) |
|
128 Intended Usage : Implemented by the developer to persist the state of the object under test. |
|
129 Error Condition : Leaves with an error code. |
|
130 @leave KErrNoMemory |
|
131 @leave @see RFileWriteStream |
|
132 @since 7.0 |
|
133 @param TAny* A pointer to the object under test. |
|
134 @return None. |
|
135 @pre TComponentInfo_StateAccessor is fully constructed. |
|
136 @post No change to the class under test, its internal state. |
|
137 is persisted. |
|
138 */ |
|
139 inline void ExternalizeL(CComponentInfo* aComponentInfo); |
|
140 }; // TComponentInfo_StateAccessor |
|
141 |
|
142 #include "ComponentInfoStateAccessor.inl" |
|
143 |
|
144 #endif // __COMPONENTINFOSTATEACCESSOR_H__ |
|
145 |