|
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 "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: videoappuiengine test class declaration. |
|
15 * |
|
16 */ |
|
17 |
|
18 // TODO: at the moment we are not able to get access to all private methods |
|
19 // to the class under test. We need to declare some own framework in order |
|
20 // to declare testclasses into friends of classes under test etc. |
|
21 // |
|
22 // missing test functions: |
|
23 // - how to setup construction to fail for testing purposes |
|
24 |
|
25 |
|
26 #ifndef __TESTVIDEOAPPUIENGINE_H__ |
|
27 #define __TESTVIDEOAPPUIENGINE_H__ |
|
28 |
|
29 |
|
30 // INCLUDES |
|
31 #include <QtTest/QtTest> |
|
32 #include <e32base.h> |
|
33 #include <e32def.h> |
|
34 #include <mpxmessage2.h> |
|
35 |
|
36 //typedef struct |
|
37 //{ |
|
38 // TInt iEvent; |
|
39 // TInt iData; |
|
40 // TInt iError; |
|
41 //} TCallbackEvent; |
|
42 |
|
43 enum TActivationCommands |
|
44 { |
|
45 EProcessTail, |
|
46 EProcessFile, |
|
47 EProcessStandAlone |
|
48 }; |
|
49 |
|
50 enum TStifFileTypes |
|
51 { |
|
52 ELocalFile, |
|
53 ESdpFile, |
|
54 ERamFile, |
|
55 EUrl, |
|
56 EAsxFile, |
|
57 EMultiLinkFile |
|
58 }; |
|
59 |
|
60 enum TMpxUtilityEvents |
|
61 { |
|
62 EViewUtilityPreLoadView, |
|
63 EViewUtilityActivateView, |
|
64 EViewUtilityActivateViewUid, |
|
65 EViewUtilityActivatePdlView, |
|
66 EViewUtilitySetAsDefaultView, |
|
67 EViewUtilityActivatePreviousView, |
|
68 EPlaybackUtilityInitFileHandle, |
|
69 EPlaybackUtilityInitFileName, |
|
70 EPlaybackUtilityInitStreamingUrl, |
|
71 EPlaybackUtilityInitStreamingFileHandle, |
|
72 EPlaybackUtilityInitPlaylist, |
|
73 EPlaybackUtilityStartPdl, |
|
74 EPlaybackUtilityPlayCmd, |
|
75 EPlaybackUtilityPdlInstance, |
|
76 EPlaybackUtilityClose, |
|
77 ECollectionUtilityMedia, |
|
78 ECollectionUtilityOpen, |
|
79 EAppUiCmdExit, |
|
80 EPlaybackUtilityOpenPlaylist, |
|
81 EAsxAttributeSeekUpdate, |
|
82 EFunctionLeave |
|
83 }; |
|
84 |
|
85 typedef struct |
|
86 { |
|
87 TMpxUtilityEvents iEvent; |
|
88 TUid iUid; |
|
89 TFileName iFileName; |
|
90 TInt iDownloadId; |
|
91 TInt iApId; |
|
92 TInt iExtra; |
|
93 } TCallbackEvent; |
|
94 |
|
95 typedef CArrayPtrFlat<TCallbackEvent> CCallbackEventArray; |
|
96 |
|
97 _LIT(KTestLocalFilename, "c:\\data\\videos\\test.3gp" ); |
|
98 _LIT(KTestRamFilename, "c:\\data\\videos\\test.ram" ); |
|
99 _LIT(KTestRtspUrl, "rtsp://testserver/test.3gp"); |
|
100 |
|
101 |
|
102 class MAppUiEngineUnitTestObserver |
|
103 { |
|
104 public: |
|
105 virtual void HandleUtilityEvent( TCallbackEvent* aEvent ) = 0; |
|
106 }; |
|
107 |
|
108 |
|
109 class QMpxVideoPlaybackWrapper; |
|
110 class CMpxVideoPlayerAppUiEngine; |
|
111 class MMPXPlaybackUtility; |
|
112 class CMPXCollectionUtility; |
|
113 |
|
114 class TestVideoAppUiEngine : public QObject, |
|
115 public MAppUiEngineUnitTestObserver |
|
116 { |
|
117 |
|
118 Q_OBJECT |
|
119 |
|
120 public: // Constructor / destructor |
|
121 |
|
122 /** |
|
123 * Contructor. |
|
124 * |
|
125 */ |
|
126 TestVideoAppUiEngine(); |
|
127 |
|
128 /** |
|
129 * Destructor. |
|
130 * |
|
131 */ |
|
132 virtual ~TestVideoAppUiEngine(); |
|
133 |
|
134 // |
|
135 // MAppUiEngineStifTestObserver Implementation |
|
136 // |
|
137 void HandleUtilityEvent( TCallbackEvent* aEvent ); |
|
138 |
|
139 CMPXMessage* CreateMpxMessageLC( int aEvent, int aType, int aData ); |
|
140 |
|
141 |
|
142 private slots: |
|
143 |
|
144 void init(); |
|
145 void cleanup(); |
|
146 |
|
147 void testPlaybackUtility(); |
|
148 void testOpenFile(); |
|
149 void testOpenMedia(); |
|
150 void testDoHandlePlaybackMessage(); |
|
151 void testPrepareCloseMpx(); |
|
152 void testDoHandleCollectionMedia(); |
|
153 void testHandlePlaybackMessage(); |
|
154 void testHandleCollectionMessage(); |
|
155 void testHandleCollectionMedia(); |
|
156 |
|
157 // called after last test case executed |
|
158 void cleanupTestCase(); |
|
159 |
|
160 signals: |
|
161 |
|
162 void aboutToQuit(); |
|
163 |
|
164 private: |
|
165 |
|
166 CMpxVideoPlayerAppUiEngine* mTestObject; |
|
167 |
|
168 QMpxVideoPlaybackWrapper* mPlaybackWrapper; |
|
169 |
|
170 //CCallbackEventArray* mExpectedEventArray; |
|
171 |
|
172 int mError; |
|
173 |
|
174 TCallbackEvent* mExpectedEvent; |
|
175 |
|
176 bool mTestResult; |
|
177 |
|
178 MMPXPlaybackUtility* mPlaybackUtility; |
|
179 CMPXCollectionUtility* mCollectionUtility; |
|
180 |
|
181 }; |
|
182 |
|
183 #endif // __TESTVIDEOAPPUIENGINE_H__ |
|
184 |
|
185 // End of file |
|
186 |
|
187 |
|
188 |