|
1 /* |
|
2 * Copyright (c) 2002-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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef HARVESTERCLIENTTESTSCRIPTER_H |
|
20 #define HARVESTERCLIENTTESTSCRIPTER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <StifLogger.h> |
|
24 #include <TestScripterInternal.h> |
|
25 #include <StifTestModule.h> |
|
26 #include "harvesterclient.h" |
|
27 #include "mdccommon.h" |
|
28 #include "mdesession.h" |
|
29 #include "mdequery.h" |
|
30 |
|
31 // CONSTANTS |
|
32 |
|
33 // MACROS |
|
34 // Logging path |
|
35 _LIT( KHarvesterClientTestScripterLogPath, "\\logs\\testframework\\HarvesterClientTestScripter\\" ); |
|
36 // Log file |
|
37 _LIT( KHarvesterClientTestScripterLogFile, "HarvesterClientTestScripter.txt" ); |
|
38 _LIT( KHarvesterClientTestScripterLogFileWithTitle, "HarvesterClientTestScripter_[%S].txt" ); |
|
39 |
|
40 // FORWARD DECLARATIONS |
|
41 class CMdEHarvesterSession; |
|
42 class CHarvesterClientTestScripter; |
|
43 |
|
44 // CLASS DECLARATION |
|
45 |
|
46 /** |
|
47 * CHarvesterClientTestScripter test class for STIF Test Framework TestScripter. |
|
48 * ?other_description_lines |
|
49 * |
|
50 * @lib ?library |
|
51 * @since ?Series60_version |
|
52 */ |
|
53 NONSHARABLE_CLASS(CHarvesterClientTestScripter) : public CScriptBase, |
|
54 public MMdESessionObserver, |
|
55 public MHarvestObserver, |
|
56 public MMdEQueryObserver, |
|
57 public MMdEObjectObserver, |
|
58 public MHarvesterEventObserver |
|
59 { |
|
60 public: // Constructors and destructor |
|
61 |
|
62 /** |
|
63 * Two-phased constructor. |
|
64 */ |
|
65 static CHarvesterClientTestScripter* NewL( CTestModuleIf& aTestModuleIf ); |
|
66 |
|
67 /** |
|
68 * Destructor. |
|
69 */ |
|
70 virtual ~CHarvesterClientTestScripter(); |
|
71 |
|
72 public: // Functions from base classes |
|
73 |
|
74 /** |
|
75 * From CScriptBase Runs a script line. |
|
76 * @since ?Series60_version |
|
77 * @param aItem Script line containing method name and parameters |
|
78 * @return Symbian OS error code |
|
79 */ |
|
80 virtual TInt RunMethodL( CStifItemParser& aItem ); |
|
81 |
|
82 private: // Functions from base classes |
|
83 void HandleSessionOpened(CMdESession& aSession, TInt aError); |
|
84 void HandleSessionError(CMdESession& aSession, TInt aError); |
|
85 void HandleObjectNotification(CMdESession& aSession, |
|
86 TObserverNotificationType aType, |
|
87 const RArray<TItemId>& aObjectIdArray); |
|
88 void HandleQueryNewResults(CMdEQuery& aQuery, |
|
89 TInt aFirstNewItemIndex, |
|
90 TInt aNewItemCount); |
|
91 void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError); |
|
92 |
|
93 void HarvestingComplete( TDesC& aURI, TInt aError ); |
|
94 void HarvestingUpdated( HarvesterEventObserverType aHEObserverType, |
|
95 HarvesterEventState aHarvesterEventState, |
|
96 TInt aItemsLeft ); |
|
97 |
|
98 private: |
|
99 |
|
100 /** |
|
101 * C++ default constructor. |
|
102 */ |
|
103 CHarvesterClientTestScripter( CTestModuleIf& aTestModuleIf ); |
|
104 |
|
105 /** |
|
106 * By default Symbian 2nd phase constructor is private. |
|
107 */ |
|
108 void ConstructL(); |
|
109 |
|
110 /** |
|
111 * Frees all resources allocated from test methods. |
|
112 * @since ?Series60_version |
|
113 */ |
|
114 void Delete(); |
|
115 |
|
116 void CheckComplete(); |
|
117 /** |
|
118 * Test helper methods are listed below. |
|
119 */ |
|
120 virtual TInt AddObjectObserverL( CStifItemParser& aItem ); |
|
121 virtual TInt RemoveObjectObserverL( CStifItemParser& aItem ); |
|
122 virtual TInt BeginHarvesterSessionL( CStifItemParser& aItem ); |
|
123 virtual TInt EndHarvesterSessionL( CStifItemParser& aItem ); |
|
124 |
|
125 /** |
|
126 * Test methods are listed below. |
|
127 */ |
|
128 virtual TInt SetUp( CStifItemParser& aItem ); |
|
129 virtual TInt TearDown( CStifItemParser& aItem ); |
|
130 virtual TInt HarvesterClientConnectL( CStifItemParser& aItem ); |
|
131 virtual TInt HarvesterClientCloseL( CStifItemParser& aItem ); |
|
132 virtual TInt HarvesterClientPauseL( CStifItemParser& aItem ); |
|
133 virtual TInt HarvesterClientResumeL( CStifItemParser& aItem ); |
|
134 virtual TInt SetHarvesterObserverL( CStifItemParser& aItem ); |
|
135 virtual TInt RemoveHarvesterObserverL( CStifItemParser& aItem ); |
|
136 virtual TInt SetLocationInfoL( CStifItemParser& aItem ); |
|
137 virtual TInt HarvestFileL( CStifItemParser& aItem ); |
|
138 virtual TInt HarvestFileWithUIDL( CStifItemParser& aItem ); |
|
139 virtual TInt QueryImageObjectByIdIndexL( CStifItemParser& aItem ); |
|
140 virtual TInt QueryAudioObjectByIdIndexL( CStifItemParser& aItem ); |
|
141 virtual TInt RemoveObjectL( CStifItemParser& aItem ); |
|
142 virtual TInt Results( CStifItemParser& aItem ); |
|
143 virtual TInt AddHarvesterEventObserverL( CStifItemParser& aItem ); |
|
144 virtual TInt RemoveHarvesterEventObserverL( CStifItemParser& aItem ); |
|
145 |
|
146 private: // Data |
|
147 // Status booleans |
|
148 TBool iHarvestingComplete; |
|
149 TBool iPlaceholderComplete; |
|
150 TBool iNewObjectComplete; |
|
151 TBool iQuerySuccess; |
|
152 TBool iObjectNotification; |
|
153 TBool iSetLocation; |
|
154 |
|
155 // Test helper classes |
|
156 CMdESession* iMdeSession; |
|
157 CMdEHarvesterSession* iHarvesterSession; |
|
158 CMdEQuery* iQuery; |
|
159 |
|
160 RHarvesterClient iHc; |
|
161 RArray<TItemId> iAlbumIds; |
|
162 RArray<TItemId> iObjectIdArray; |
|
163 |
|
164 TFileName iUri; |
|
165 }; |
|
166 |
|
167 #endif // HARVESTERCLIENTTESTSCRIPTER_H |
|
168 |
|
169 // End of File |