|
1 // Copyright (c) 2010 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: Wrapper for testing RStateAwareSession class. |
|
14 // |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @test |
|
21 @internalComponent - Internal Symbian test code |
|
22 */ |
|
23 |
|
24 |
|
25 #ifndef __T_STATEAWARESESSIONWRAPPER_H__ |
|
26 #define __T_STATEAWARESESSIONWRAPPER_H__ |
|
27 |
|
28 #include <ssm/ssmstatemanager.h> |
|
29 #include <ssm/ssmstateawaresession.h> |
|
30 |
|
31 #include <test/testexecutestepbase.h> |
|
32 #include <test/datawrapper.h> |
|
33 |
|
34 // This structure is used to hold data read from the test ini file for CTestRStateAwareSession1 |
|
35 struct TIniData1 |
|
36 { |
|
37 TBool iCancelDeferral; |
|
38 TBool iAckLastState; |
|
39 TBool iDeferTwice; |
|
40 TInt iCount; |
|
41 TBool iAcknowledge; |
|
42 TIniData1(); |
|
43 }; |
|
44 |
|
45 // This structure is used to hold data read from the test ini file for CTestRStateAwareSession2 |
|
46 struct TIniData2 |
|
47 { |
|
48 TInt iCount; |
|
49 TBool iAcknowledge; |
|
50 TIniData2(); |
|
51 }; |
|
52 |
|
53 //Client 1 |
|
54 class CTestRStateAwareSession1 : public CDataWrapper |
|
55 { |
|
56 public: |
|
57 static CTestRStateAwareSession1* NewL(); |
|
58 ~CTestRStateAwareSession1(); |
|
59 |
|
60 TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); |
|
61 |
|
62 TAny* GetObject(); |
|
63 void SetObjectL(TAny* aAny); |
|
64 void DisownObjectL(); |
|
65 |
|
66 |
|
67 void DoCmdNew(); |
|
68 void DoCmdDestructor(); |
|
69 void DoCmdConnect(const TDesC& aSection); |
|
70 void DoCmdClose(); |
|
71 void DoCmdRequestStateNotification(const TInt aAsyncErrorIndex); |
|
72 void DoCmdAcknowledgeStateNotification(const TDesC& aSection); |
|
73 void DoCmdAcknowledgeAndRequestStateNotification(const TDesC& aSection, const TInt aAsyncErrorIndex); |
|
74 void DoCmdRequestStateNotificationCancel(); |
|
75 void DoCmdDeferAcknowledgement(const TInt aAsyncErrorIndex); |
|
76 void DoCmdReturnCount(const TDesC& aSection); |
|
77 void DoCmdReadIniData(const TDesC& aSection); |
|
78 |
|
79 //helper |
|
80 void DoCleanup(); |
|
81 |
|
82 protected: |
|
83 CTestRStateAwareSession1(); |
|
84 void ConstructL(); |
|
85 |
|
86 void RunL(CActive* aActive, TInt aIndex); |
|
87 void DoCancel(CActive* aActive, TInt aIndex); |
|
88 |
|
89 |
|
90 private: |
|
91 RSsmStateAwareSession* iSsmStateAwareSession; |
|
92 CActiveCallback* iActiveNotifyOnChange; |
|
93 CActiveCallback* iActiveNotifyOnChange2; |
|
94 // The iCount variable is used to store the no. of deferral calls made. |
|
95 // It is incremented each time a deferral call is made. |
|
96 TInt iCount; |
|
97 TIniData1 iIniData; |
|
98 }; |
|
99 |
|
100 //Client 2 |
|
101 class CTestRStateAwareSession2 : public CDataWrapper |
|
102 { |
|
103 public: |
|
104 static CTestRStateAwareSession2* NewL(); |
|
105 ~CTestRStateAwareSession2(); |
|
106 |
|
107 TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); |
|
108 |
|
109 TAny* GetObject(); |
|
110 void SetObjectL(TAny* aAny); |
|
111 void DisownObjectL(); |
|
112 |
|
113 |
|
114 void DoCmdNew(); |
|
115 void DoCmdDestructor(); |
|
116 void DoCmdConnect(const TDesC& aSection); |
|
117 void DoCmdClose(); |
|
118 void DoCmdRequestStateNotification(const TInt aAsyncErrorIndex); |
|
119 void DoCmdAcknowledgeStateNotification(const TDesC& aSection); |
|
120 void DoCmdAcknowledgeAndRequestStateNotification(const TDesC& aSection, const TInt aAsyncErrorIndex); |
|
121 void DoCmdRequestStateNotificationCancel(); |
|
122 void DoCmdReadIniData(const TDesC& aSection); |
|
123 |
|
124 //helper |
|
125 void DoCleanup(); |
|
126 |
|
127 protected: |
|
128 CTestRStateAwareSession2(); |
|
129 void ConstructL(); |
|
130 |
|
131 void RunL(CActive* aActive, TInt aIndex); |
|
132 void DoCancel(CActive* aActive, TInt aIndex); |
|
133 |
|
134 |
|
135 private: |
|
136 RSsmStateAwareSession* iSsmStateAwareSession; |
|
137 CActiveCallback* iActiveNotifyOnChange; |
|
138 TInt iCount; |
|
139 TIniData2 iIniData; |
|
140 }; |
|
141 |
|
142 #endif // __T_STATEAWARESESSIONWRAPPER_H__ |