|
1 /* |
|
2 * t_vimpstenginesearchmgrextention.cpp :: 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 "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:t_vimpstenginesearchmgrextention.cpp |
|
15 * |
|
16 */ |
|
17 #include <EUnitMacros.h> |
|
18 #include <TEUnitAssertionInfo.h> |
|
19 #include <CEUnitAllocTestCaseDecorator.h> |
|
20 |
|
21 #include "T_vimpstenginesearchmgrextention.h" |
|
22 |
|
23 #include "s_presencefeatures.h" |
|
24 #include "s_presentitygroups.h" |
|
25 #include "s_ximpclient.h" |
|
26 #include "s_ximpcontext.h" |
|
27 #include "s_ximprequestcompleteevent.h" |
|
28 #include "s_ximpobjectfactory.h" |
|
29 |
|
30 #include "cvimpstenginerequestmapper.h" |
|
31 #include "cvimpstenginesearchmgrextention.h" |
|
32 #include "cvimpstenginerequest.h" |
|
33 |
|
34 |
|
35 /* |
|
36 * To be tested: |
|
37 * - SearchContactsL |
|
38 * - SubscribeForSearchKeysL |
|
39 * - IsSupported |
|
40 * - Type |
|
41 * - HandleSessionContextEventL |
|
42 */ |
|
43 |
|
44 |
|
45 extern TXIMPRequestId gTXIMPRequestId; |
|
46 |
|
47 T_VIMPSTEngineSearchMgrExtention* T_VIMPSTEngineSearchMgrExtention::NewLC() |
|
48 { |
|
49 T_VIMPSTEngineSearchMgrExtention* self = new( ELeave ) T_VIMPSTEngineSearchMgrExtention; |
|
50 CleanupStack::PushL( self ); |
|
51 self->ConstructL(); |
|
52 return self; |
|
53 } |
|
54 |
|
55 T_VIMPSTEngineSearchMgrExtention::~T_VIMPSTEngineSearchMgrExtention() |
|
56 { |
|
57 } |
|
58 |
|
59 void T_VIMPSTEngineSearchMgrExtention::ConstructL() |
|
60 { |
|
61 CEUnitTestSuiteClass::ConstructL(); |
|
62 } |
|
63 |
|
64 |
|
65 void T_VIMPSTEngineSearchMgrExtention::SetupL() |
|
66 { |
|
67 iClient = MXIMPClientStub::NewClientL(); |
|
68 |
|
69 //Create new sink to receive ximp context events |
|
70 iPresenceCtx = iClient->NewPresenceContextLC(); |
|
71 // ignore code scanner warning, it gives panic |
|
72 CleanupStack::Pop();// because of LC method |
|
73 |
|
74 iFeatures = MyMPresenceFeatureStub::NewStubL(iPresenceCtx); |
|
75 |
|
76 iRequestMapper = CVIMPSTEngineRequestMapper::NewL() ; |
|
77 |
|
78 iSearcMgrExtention = CVIMPSTEngineSearchMgrExtention::NewL( *iPresenceCtx, |
|
79 *iRequestMapper ); |
|
80 } |
|
81 |
|
82 void T_VIMPSTEngineSearchMgrExtention::Teardown() |
|
83 { |
|
84 delete iSearcMgrExtention; |
|
85 delete iRequestMapper; |
|
86 delete iFeatures; |
|
87 delete iPresenceCtx; |
|
88 delete iClient; |
|
89 } |
|
90 |
|
91 // From MVIMPSTEngineSearchExtentionEventObserver |
|
92 void HandleSearchResultL(RArray<TVIMPSTSearchData> aSerachData) |
|
93 { |
|
94 |
|
95 } |
|
96 void HandleSearchFinishedL(TInt /*aError*/) |
|
97 { |
|
98 |
|
99 } |
|
100 void HandleSearchKeysEventL( RArray<TInt>& /*aEnumKeysArray*/, RPointerArray<HBufC>& /*aLebelKeysArray*/ ) |
|
101 { |
|
102 |
|
103 } |
|
104 |
|
105 // T_VIMPSTEngineSearchMgrExtention::TestSearchContactsL |
|
106 // TODO: All test cases... |
|
107 void T_VIMPSTEngineSearchMgrExtention::TestSearchContactsL() |
|
108 { |
|
109 TInt error = KErrNone; |
|
110 iSearcMgrExtention->RegisterObserver( this ); |
|
111 |
|
112 |
|
113 RArray<TVIMPSTSearchKeyData> aKeyDataArray; |
|
114 TVIMPSTSearchKeyData data = |
|
115 { |
|
116 TVIMPSTEnums::EVIMPSTFirstName, |
|
117 KNullDesC, |
|
118 KNullDesC |
|
119 }; |
|
120 aKeyDataArray.Append(data); |
|
121 |
|
122 error = iSearcMgrExtention->SearchContactsL( aKeyDataArray ); |
|
123 EUNIT_ASSERT( error == KErrNone ); |
|
124 |
|
125 iSearcMgrExtention->UnRegisterObserver( this ); |
|
126 } |
|
127 |
|
128 // T_VIMPSTEngineSearchMgrExtention::TestSubscribeForSearchKeysL |
|
129 // TODO: All test cases... |
|
130 void T_VIMPSTEngineSearchMgrExtention::TestSubscribeForSearchKeysL() |
|
131 { |
|
132 //MXIMPBase* event = NULL; |
|
133 } |
|
134 |
|
135 // T_VIMPSTEngineSearchMgrExtention::TestIsSupported |
|
136 // TODO: All test cases... |
|
137 void T_VIMPSTEngineSearchMgrExtention::TestIsSupported() |
|
138 { |
|
139 |
|
140 } |
|
141 |
|
142 // T_VIMPSTEngineSearchMgrExtention::TestType |
|
143 // TODO: All test cases... |
|
144 void T_VIMPSTEngineSearchMgrExtention::TestType() |
|
145 { |
|
146 |
|
147 } |
|
148 |
|
149 // T_VIMPSTEngineSearchMgrExtention::TestHandleSessionContextEventL |
|
150 // TODO: All test cases... |
|
151 void T_VIMPSTEngineSearchMgrExtention::TestHandleSessionContextEventL() |
|
152 { |
|
153 |
|
154 } |
|
155 |
|
156 // T_VIMPSTEngineSearchMgrExtention::TestAllFunctionsL |
|
157 // TODO: Remove this functio... |
|
158 void T_VIMPSTEngineSearchMgrExtention::TestAllFunctionsL() |
|
159 { |
|
160 |
|
161 //Do all the functions here.. |
|
162 /*EUNIT_ASSERT( EVIMPSTXimpOperationBind == iRequest->RequestType() ); |
|
163 |
|
164 EUNIT_ASSERT( gTXIMPRequestId == iRequest->GetRequestId() ); |
|
165 |
|
166 |
|
167 iRequest->SetRequestType(EVIMPSTXimpOperationUnBind); |
|
168 EUNIT_ASSERT( EVIMPSTXimpOperationUnBind == iRequest->RequestType() ); |
|
169 |
|
170 iRequest->StartWait(); |
|
171 EUNIT_ASSERT( ETrue == iRequest->IsWaitStarted() ); |
|
172 iRequest->StartWait(); |
|
173 |
|
174 iRequest->StopWait(); |
|
175 EUNIT_ASSERT( EFalse == iRequest->IsWaitStarted() ); |
|
176 iRequest->StopWait();*/ |
|
177 |
|
178 |
|
179 } |
|
180 |
|
181 |
|
182 EUNIT_BEGIN_TEST_TABLE( T_VIMPSTEngineSearchMgrExtention, "T_VIMPSTEngineSearchMgrExtention", "" ) |
|
183 |
|
184 EUNIT_TEST( "", "", "", "", SetupL, TestSearchContactsL, Teardown ) |
|
185 EUNIT_TEST( "", "", "", "", SetupL, TestSubscribeForSearchKeysL, Teardown ) |
|
186 EUNIT_TEST( "", "", "", "", SetupL, TestIsSupported, Teardown ) |
|
187 EUNIT_TEST( "", "", "", "", SetupL, TestType, Teardown ) |
|
188 EUNIT_TEST( "", "", "", "", SetupL, TestHandleSessionContextEventL, Teardown ) |
|
189 |
|
190 EUNIT_END_TESTCASE_TABLE |
|
191 |
|
192 // END OF FILE |