1 /* |
|
2 * Copyright (c) 2008 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: Unit test |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INTERNAL INCLUDES |
|
21 #include "ut_mcctranscoder.h" |
|
22 #include "mmcctranscoder.h" |
|
23 #include "transcoderimpl.h" |
|
24 |
|
25 _LIT( KTestMccTranscodeFile, "C:\\data\\videos\\big.3gp" ); |
|
26 _LIT( KTestMccTranscodedFile, "C:\\data\\videos\\normal.3gp" ); |
|
27 _LIT8( KTestMccTranscodedVideoMimeType, "H264" ); |
|
28 _LIT8( KTestMccTranscodedAudioMimeType, "AAC" ); |
|
29 |
|
30 |
|
31 // SYSTEM INCLUDES |
|
32 #include <digia/eunit/eunitmacros.h> |
|
33 |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 UT_CMccTranscoder* UT_CMccTranscoder::NewL() |
|
40 { |
|
41 UT_CMccTranscoder* self = UT_CMccTranscoder::NewLC(); |
|
42 CleanupStack::Pop( self ); |
|
43 return self; |
|
44 } |
|
45 |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 UT_CMccTranscoder* UT_CMccTranscoder::NewLC() |
|
52 { |
|
53 UT_CMccTranscoder* self = new( ELeave ) UT_CMccTranscoder(); |
|
54 CleanupStack::PushL( self ); |
|
55 self->ConstructL(); |
|
56 return self; |
|
57 } |
|
58 |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 // ----------------------------------------------------------------------------- |
|
63 // |
|
64 UT_CMccTranscoder::~UT_CMccTranscoder() |
|
65 { |
|
66 } |
|
67 |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // Default constructor |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 UT_CMccTranscoder::UT_CMccTranscoder() |
|
74 { |
|
75 // NOP |
|
76 } |
|
77 |
|
78 |
|
79 // ----------------------------------------------------------------------------- |
|
80 // Second phase construct |
|
81 // ----------------------------------------------------------------------------- |
|
82 // |
|
83 void UT_CMccTranscoder::ConstructL() |
|
84 { |
|
85 // The ConstructL from the base class CEUnitTestSuiteClass must be called. |
|
86 // It generates the test case table. |
|
87 CEUnitTestSuiteClass::ConstructL(); |
|
88 } |
|
89 |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 void UT_CMccTranscoder::SetupL() |
|
96 { |
|
97 iMccTranscoder = CMccTranscoder::NewL(); |
|
98 iMccTranscoder->RegisterEventObserver( *this ); |
|
99 |
|
100 iData.iSourceFile = KTestMccTranscodeFile(); |
|
101 iData.iDesFile = KTestMccTranscodedFile(); |
|
102 iData.iQuality = CVedMovie::EQualityAutomatic; |
|
103 iData.iVideoCodec.iMimeType = KTestMccTranscodedVideoMimeType(); |
|
104 iData.iAudioCodec.iMimeType = KTestMccTranscodedAudioMimeType(); |
|
105 |
|
106 } |
|
107 |
|
108 |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 // ----------------------------------------------------------------------------- |
|
112 // |
|
113 void UT_CMccTranscoder::Teardown() |
|
114 { |
|
115 delete iMccTranscoder; |
|
116 } |
|
117 |
|
118 void UT_CMccTranscoder::MccTranscoderEventReceived( TMccEvent& aEvent ) |
|
119 { |
|
120 iMccEvent = aEvent; |
|
121 } |
|
122 |
|
123 |
|
124 |
|
125 // TEST CASES |
|
126 |
|
127 // ----------------------------------------------------------------------------- |
|
128 // |
|
129 // ----------------------------------------------------------------------------- |
|
130 // |
|
131 void UT_CMccTranscoder::UT_CMccTranscoder_RegisterEventObserverL() |
|
132 { |
|
133 iMccTranscoder->RegisterEventObserver( *this ); |
|
134 delete iMccTranscoder->iTranscoderImpl; |
|
135 iMccTranscoder->iTranscoderImpl = NULL; |
|
136 |
|
137 iMccTranscoder->RegisterEventObserver( *this ); |
|
138 } |
|
139 |
|
140 |
|
141 |
|
142 // ----------------------------------------------------------------------------- |
|
143 // |
|
144 // ----------------------------------------------------------------------------- |
|
145 // |
|
146 void UT_CMccTranscoder::UT_CMccTranscoder_UnregisterEventObserverL() |
|
147 { |
|
148 iMccTranscoder->UnregisterEventObserver(); |
|
149 delete iMccTranscoder->iTranscoderImpl; |
|
150 iMccTranscoder->iTranscoderImpl = NULL; |
|
151 |
|
152 iMccTranscoder->UnregisterEventObserver(); |
|
153 |
|
154 } |
|
155 |
|
156 |
|
157 // ----------------------------------------------------------------------------- |
|
158 // |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 void UT_CMccTranscoder::UT_CMccTranscoder_TranscodeFileLL() |
|
162 { |
|
163 |
|
164 TMccTranscodeFileMsgBuffer data( iData ); |
|
165 TUint32 sessionId = 0; |
|
166 iMccTranscoder->TranscodeFileL( sessionId, data ); |
|
167 |
|
168 delete iMccTranscoder->iTranscoderImpl; |
|
169 iMccTranscoder->iTranscoderImpl = NULL; |
|
170 |
|
171 EUNIT_ASSERT_LEAVE( iMccTranscoder->TranscodeFileL( sessionId, data ) ); |
|
172 |
|
173 } |
|
174 |
|
175 // ----------------------------------------------------------------------------- |
|
176 // |
|
177 // ----------------------------------------------------------------------------- |
|
178 // |
|
179 void UT_CMccTranscoder::UT_CMccTranscoder_CancelTranscodeFileLL() |
|
180 { |
|
181 |
|
182 EUNIT_ASSERT_LEAVE( iMccTranscoder->CancelTranscodeFileL( 11 ) ); |
|
183 |
|
184 TMccTranscodeFileMsgBuffer data( iData ); |
|
185 TUint32 sessionId = 0; |
|
186 iMccTranscoder->TranscodeFileL( sessionId, data ); |
|
187 EUNIT_ASSERT( sessionId ); |
|
188 |
|
189 iMccTranscoder->CancelTranscodeFileL( sessionId ); |
|
190 |
|
191 } |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 // TEST TABLE |
|
199 |
|
200 EUNIT_BEGIN_TEST_TABLE( |
|
201 UT_CMccTranscoder, |
|
202 "UT_CMccTranscoder", |
|
203 "UNIT" ) |
|
204 |
|
205 EUNIT_TEST( |
|
206 "RegisterEventObserver - test", |
|
207 "CMccTranscoder", |
|
208 "RegisterEventObserver", |
|
209 "FUNCTIONALITY", |
|
210 SetupL, UT_CMccTranscoder_RegisterEventObserverL, Teardown) |
|
211 |
|
212 EUNIT_TEST( |
|
213 "UnregisterEventObserver - test", |
|
214 "CMccTranscoder", |
|
215 "UnregisterEventObserver", |
|
216 "FUNCTIONALITY", |
|
217 SetupL, UT_CMccTranscoder_UnregisterEventObserverL, Teardown) |
|
218 |
|
219 EUNIT_TEST( |
|
220 "TranscodeFileL - test", |
|
221 "CMccTranscoder", |
|
222 "TranscodeFileL", |
|
223 "FUNCTIONALITY", |
|
224 SetupL, UT_CMccTranscoder_TranscodeFileLL, Teardown) |
|
225 |
|
226 EUNIT_TEST( |
|
227 "CancelTranscodeFileL - test", |
|
228 "CMccTranscoder", |
|
229 "CancelTranscodeFileL", |
|
230 "FUNCTIONALITY", |
|
231 SetupL, UT_CMccTranscoder_CancelTranscodeFileLL, Teardown) |
|
232 |
|
233 |
|
234 |
|
235 EUNIT_END_TEST_TABLE |
|
236 |
|
237 // END OF FILE |
|
238 |
|
239 |
|