sl@0
|
1 |
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// T_ScheduleEntryInfo2.cpp
|
sl@0
|
15 |
// This file contains the implementation of test classe for TScheduleEntryInfo2.
|
sl@0
|
16 |
//
|
sl@0
|
17 |
//
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <e32test.h>
|
sl@0
|
20 |
#include <f32file.h>
|
sl@0
|
21 |
#include <s32file.h>
|
sl@0
|
22 |
#include <schinfointernal.h>
|
sl@0
|
23 |
#include "Thelpers.h"
|
sl@0
|
24 |
|
sl@0
|
25 |
#include "SCHINFO.H"
|
sl@0
|
26 |
|
sl@0
|
27 |
_LIT(KTestName, "TScheduleEntryInfo2 Tests");
|
sl@0
|
28 |
RTest TheTest(KTestName);
|
sl@0
|
29 |
|
sl@0
|
30 |
static RFs TheFsSession;
|
sl@0
|
31 |
_LIT(KFileName,"_:\\tscheduleinfo2.dat");
|
sl@0
|
32 |
static TBuf<32> fileName;
|
sl@0
|
33 |
|
sl@0
|
34 |
//
|
sl@0
|
35 |
//
|
sl@0
|
36 |
//Test macroses and functions
|
sl@0
|
37 |
|
sl@0
|
38 |
static void Check(TInt aValue, TInt aLine)
|
sl@0
|
39 |
{
|
sl@0
|
40 |
if(!aValue)
|
sl@0
|
41 |
{
|
sl@0
|
42 |
(void)TheFsSession.Delete(fileName);
|
sl@0
|
43 |
TheTest(EFalse, aLine);
|
sl@0
|
44 |
}
|
sl@0
|
45 |
}
|
sl@0
|
46 |
static void Check(TInt aValue, TInt aExpected, TInt aLine)
|
sl@0
|
47 |
{
|
sl@0
|
48 |
if(aValue != aExpected)
|
sl@0
|
49 |
{
|
sl@0
|
50 |
RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
|
sl@0
|
51 |
(void)TheFsSession.Delete(fileName);
|
sl@0
|
52 |
TheTest(EFalse, aLine);
|
sl@0
|
53 |
}
|
sl@0
|
54 |
}
|
sl@0
|
55 |
#define TEST(arg) ::Check((arg), __LINE__)
|
sl@0
|
56 |
#define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__)
|
sl@0
|
57 |
|
sl@0
|
58 |
|
sl@0
|
59 |
/**
|
sl@0
|
60 |
State accessor for the TScheduleEntryInfo2 object under test.
|
sl@0
|
61 |
*/
|
sl@0
|
62 |
class TScheduleEntryInfo2_StateAccessor
|
sl@0
|
63 |
{
|
sl@0
|
64 |
|
sl@0
|
65 |
public:
|
sl@0
|
66 |
void TestDefaultConstructor();
|
sl@0
|
67 |
void TestCopyConstructorOverloadedConstructor();
|
sl@0
|
68 |
|
sl@0
|
69 |
//utility Get and Set methods
|
sl@0
|
70 |
void TestIntervalTypeSetIntervalType();
|
sl@0
|
71 |
void TestStartTimeSetStartTime();
|
sl@0
|
72 |
void TestIntervalSetInterval();
|
sl@0
|
73 |
void TestValidityPeriodSetValidityPeriod();
|
sl@0
|
74 |
void TestNonExportedConstructor();
|
sl@0
|
75 |
void TestExternalizeInternalizeL();
|
sl@0
|
76 |
};
|
sl@0
|
77 |
|
sl@0
|
78 |
|
sl@0
|
79 |
|
sl@0
|
80 |
/**
|
sl@0
|
81 |
@file
|
sl@0
|
82 |
@SYMTestCaseID SYSLIB-SCHSVR-CT-0231
|
sl@0
|
83 |
@SYMTestCaseDesc Check the default constructor
|
sl@0
|
84 |
@SYMTestPriority low
|
sl@0
|
85 |
@SYMTestActions Creates an instance of TScheduleEntryInfo2 using the default constructor
|
sl@0
|
86 |
anc checks that the data has been properly initialised
|
sl@0
|
87 |
@SYMTestExpectedResults The test must not fail.
|
sl@0
|
88 |
@SYMPREQ PREQ234
|
sl@0
|
89 |
*/
|
sl@0
|
90 |
void TScheduleEntryInfo2_StateAccessor::TestDefaultConstructor()
|
sl@0
|
91 |
{
|
sl@0
|
92 |
//Default constructor called
|
sl@0
|
93 |
//Sets Start Time to 0 UTC time
|
sl@0
|
94 |
//the interval type to 0,
|
sl@0
|
95 |
//the interval to 0,
|
sl@0
|
96 |
//the validityPeriod to 0
|
sl@0
|
97 |
TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SCHSVR-CT-0231 Test default constructor "));
|
sl@0
|
98 |
TScheduleEntryInfo2 entry;
|
sl@0
|
99 |
|
sl@0
|
100 |
TEST(entry.iIntervalType==0);
|
sl@0
|
101 |
TEST(entry.iStartTime.GetUtcTime() == TTime(0));
|
sl@0
|
102 |
TEST(entry.iInterval == 0);
|
sl@0
|
103 |
TEST(entry.iValidityPeriod == TTimeIntervalMinutes(0));
|
sl@0
|
104 |
}
|
sl@0
|
105 |
|
sl@0
|
106 |
|
sl@0
|
107 |
/**
|
sl@0
|
108 |
@file
|
sl@0
|
109 |
@SYMTestCaseID SYSLIB-SCHSVR-CT-0232
|
sl@0
|
110 |
@SYMTestCaseDesc Check the copy constructor and the overloaded constructor
|
sl@0
|
111 |
@SYMTestPriority low
|
sl@0
|
112 |
@SYMTestActions Creates an instance of TScheduleEntryInfo2 using the overloaded
|
sl@0
|
113 |
constructor and another instance of TScheduleEntryInfo2 using the copy constructor.
|
sl@0
|
114 |
Then checks that data of both instances are equal.
|
sl@0
|
115 |
@SYMTestExpectedResults The test must not fail.
|
sl@0
|
116 |
@SYMPREQ PREQ234
|
sl@0
|
117 |
*/
|
sl@0
|
118 |
void TScheduleEntryInfo2_StateAccessor::TestCopyConstructorOverloadedConstructor()
|
sl@0
|
119 |
{
|
sl@0
|
120 |
TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SCHSVR-CT-0232 Text contructors "));
|
sl@0
|
121 |
|
sl@0
|
122 |
TDateTime date(2005, EMay, 15, 8, 55, 0, 0);
|
sl@0
|
123 |
TTime time(date);
|
sl@0
|
124 |
TTsTime startTime(time, EFalse);
|
sl@0
|
125 |
TIntervalType intervalType(EHourly);
|
sl@0
|
126 |
TInt interval(1);
|
sl@0
|
127 |
TTimeIntervalMinutes validityPeriod(60);
|
sl@0
|
128 |
|
sl@0
|
129 |
TScheduleEntryInfo2 entry1(startTime, intervalType, interval, validityPeriod);
|
sl@0
|
130 |
|
sl@0
|
131 |
TScheduleEntryInfo2 entry2(entry1);
|
sl@0
|
132 |
|
sl@0
|
133 |
//Test entry1 == entry2
|
sl@0
|
134 |
TEST(entry1.StartTime().GetLocalTime() == entry2.StartTime().GetLocalTime());
|
sl@0
|
135 |
TEST(entry1.ValidityPeriod() == entry2.ValidityPeriod());
|
sl@0
|
136 |
TEST(entry1.Interval() == entry2.Interval());
|
sl@0
|
137 |
|
sl@0
|
138 |
}
|
sl@0
|
139 |
|
sl@0
|
140 |
|
sl@0
|
141 |
/**
|
sl@0
|
142 |
@file
|
sl@0
|
143 |
@SYMTestCaseID SYSLIB-SCHSVR-CT-0233
|
sl@0
|
144 |
@SYMTestCaseDesc Check SetIntervalType and IntervalType.
|
sl@0
|
145 |
@SYMTestActions Creates an instance of TScheduleEntryInfo2 using the default constructor.
|
sl@0
|
146 |
Sets its interval type and checks that the returned value of IntervalType()
|
sl@0
|
147 |
is equal to the one set initially.
|
sl@0
|
148 |
@SYMTestExpectedResults The test must not fail.
|
sl@0
|
149 |
@SYMPREQ PREQ234
|
sl@0
|
150 |
*/
|
sl@0
|
151 |
void TScheduleEntryInfo2_StateAccessor::TestIntervalTypeSetIntervalType()
|
sl@0
|
152 |
{
|
sl@0
|
153 |
TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SCHSVR-CT-0233 Test set and get for Interval Type "));
|
sl@0
|
154 |
|
sl@0
|
155 |
TScheduleEntryInfo2 scheduleEntryInfo;
|
sl@0
|
156 |
|
sl@0
|
157 |
scheduleEntryInfo.SetIntervalType(TIntervalType(EHourly));
|
sl@0
|
158 |
TIntervalType intervalType = scheduleEntryInfo.IntervalType();
|
sl@0
|
159 |
TEST(intervalType == EHourly);
|
sl@0
|
160 |
}
|
sl@0
|
161 |
|
sl@0
|
162 |
|
sl@0
|
163 |
/**
|
sl@0
|
164 |
@file
|
sl@0
|
165 |
@SYMTestCaseID SYSLIB-SCHSVR-CT-0234
|
sl@0
|
166 |
@SYMTestCaseDesc Check SetStartTime() and StartTime()
|
sl@0
|
167 |
@SYMTestPriority low
|
sl@0
|
168 |
@SYMTestActions Creates an instance of TScheduleEntryInfo2 using the default constructor
|
sl@0
|
169 |
Sets its start time using SetStartTime() and compares StartTime() returned value
|
sl@0
|
170 |
to the one set initially.
|
sl@0
|
171 |
@SYMTestExpectedResults The test must not fail.
|
sl@0
|
172 |
@SYMPREQ PREQ234
|
sl@0
|
173 |
*/
|
sl@0
|
174 |
void TScheduleEntryInfo2_StateAccessor::TestStartTimeSetStartTime()
|
sl@0
|
175 |
{
|
sl@0
|
176 |
TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SCHSVR-CT-0234 Test start time set and get methods "));
|
sl@0
|
177 |
|
sl@0
|
178 |
TScheduleEntryInfo2 scheduleEntryInfo;
|
sl@0
|
179 |
|
sl@0
|
180 |
TDateTime date(2005, EMay, 15, 8, 55, 0, 0);
|
sl@0
|
181 |
TTime time(date);
|
sl@0
|
182 |
TTsTime startTime(time, EFalse);
|
sl@0
|
183 |
|
sl@0
|
184 |
scheduleEntryInfo.SetStartTime(startTime);
|
sl@0
|
185 |
|
sl@0
|
186 |
TEST(scheduleEntryInfo.StartTime().GetLocalTime() == startTime.GetLocalTime());
|
sl@0
|
187 |
}
|
sl@0
|
188 |
|
sl@0
|
189 |
|
sl@0
|
190 |
/**
|
sl@0
|
191 |
@file
|
sl@0
|
192 |
@SYMTestCaseID SYSLIB-SCHSVR-CT-0235
|
sl@0
|
193 |
@SYMTestCaseDesc Check SetInterval() and Intervale()
|
sl@0
|
194 |
@SYMTestPriority low
|
sl@0
|
195 |
@SYMTestActions Creates an instance of TScheduleEntryInfo2 using the default constructor
|
sl@0
|
196 |
Sets its Interval using SetInterval() and compares the returned value of
|
sl@0
|
197 |
Interval() to the one set initially.
|
sl@0
|
198 |
@SYMTestExpectedResults The test must not fail.
|
sl@0
|
199 |
@SYMPREQ PREQ234
|
sl@0
|
200 |
*/
|
sl@0
|
201 |
void TScheduleEntryInfo2_StateAccessor::TestIntervalSetInterval()
|
sl@0
|
202 |
{
|
sl@0
|
203 |
TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SCHSVR-CT-0235 Test set and get for Interval "));
|
sl@0
|
204 |
|
sl@0
|
205 |
TScheduleEntryInfo2 scheduleEntryInfo;
|
sl@0
|
206 |
scheduleEntryInfo.SetInterval(1);
|
sl@0
|
207 |
TEST(scheduleEntryInfo.Interval() == TInt(1));
|
sl@0
|
208 |
}
|
sl@0
|
209 |
|
sl@0
|
210 |
/**
|
sl@0
|
211 |
@file
|
sl@0
|
212 |
@SYMTestCaseID SYSLIB-SCHSVR-CT-0236
|
sl@0
|
213 |
@SYMTestCaseDesc Check SetValidityPeriod() and ValidityPeriod()
|
sl@0
|
214 |
@SYMTestPriority low
|
sl@0
|
215 |
@SYMTestActions Creates an instance of TScheduleEntryInfo2 using the default constructor
|
sl@0
|
216 |
Sets its validty period using SetValidityPeriod() and checks that ValidityPeriod() returns
|
sl@0
|
217 |
the same value as the one set initially.
|
sl@0
|
218 |
@SYMTestExpectedResults The test must not fail.
|
sl@0
|
219 |
@SYMPREQ PREQ234
|
sl@0
|
220 |
*/
|
sl@0
|
221 |
void TScheduleEntryInfo2_StateAccessor::TestValidityPeriodSetValidityPeriod()
|
sl@0
|
222 |
{
|
sl@0
|
223 |
TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SCHSVR-CT-0236 Set and get for validity period "));
|
sl@0
|
224 |
TScheduleEntryInfo2 scheduleEntryInfo;
|
sl@0
|
225 |
|
sl@0
|
226 |
scheduleEntryInfo.SetValidityPeriod(60);
|
sl@0
|
227 |
TTimeIntervalMinutes retValidityPeriod = scheduleEntryInfo.ValidityPeriod();
|
sl@0
|
228 |
|
sl@0
|
229 |
TEST(retValidityPeriod == TTimeIntervalMinutes(60));
|
sl@0
|
230 |
|
sl@0
|
231 |
}
|
sl@0
|
232 |
|
sl@0
|
233 |
/**
|
sl@0
|
234 |
@file
|
sl@0
|
235 |
@SYMTestCaseID SYSLIB-SCHSVR-CT-0237
|
sl@0
|
236 |
@SYMTestCaseDesc Check non exported constructor provided for use with the deprecated APIs
|
sl@0
|
237 |
@SYMTestPriority low
|
sl@0
|
238 |
@SYMTestActions Creates an instance of TScheduleEntryInfo using the default constructor, sets its member data,
|
sl@0
|
239 |
and creates an instance of TScheduleEntryInfo2 using the provied constructor for use with deprecated APIs.
|
sl@0
|
240 |
Then checks that TScheduleEntryInfo2 date is equal to TScheduleEntryInfo data.
|
sl@0
|
241 |
|
sl@0
|
242 |
@SYMTestExpectedResults The test must not fail.
|
sl@0
|
243 |
@SYMPREQ PREQ234
|
sl@0
|
244 |
*/
|
sl@0
|
245 |
void TScheduleEntryInfo2_StateAccessor::TestNonExportedConstructor()
|
sl@0
|
246 |
{
|
sl@0
|
247 |
TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SCHSVR-CT-0237 Test non exported constructor "));
|
sl@0
|
248 |
|
sl@0
|
249 |
TScheduleEntryInfo entry1;
|
sl@0
|
250 |
entry1.iIntervalType = EHourly;
|
sl@0
|
251 |
entry1.iStartTime = SchSvrHelpers::TimeBasedOnOffset(1);
|
sl@0
|
252 |
|
sl@0
|
253 |
entry1.iInterval = 1;
|
sl@0
|
254 |
entry1.iValidityPeriod = 20;
|
sl@0
|
255 |
|
sl@0
|
256 |
TScheduleEntryInfo2 entry2(entry1);
|
sl@0
|
257 |
|
sl@0
|
258 |
//test that scheduleEntryInfo2 startTime is local time
|
sl@0
|
259 |
TEST(!entry2.iStartTime.IsUtc());
|
sl@0
|
260 |
|
sl@0
|
261 |
//test intervalType
|
sl@0
|
262 |
TEST(entry2.iIntervalType == entry1.iIntervalType);
|
sl@0
|
263 |
|
sl@0
|
264 |
//test interval
|
sl@0
|
265 |
TEST(entry2.iInterval == entry1.iInterval);
|
sl@0
|
266 |
|
sl@0
|
267 |
//test validity period
|
sl@0
|
268 |
TEST(entry2.iValidityPeriod == entry1.iValidityPeriod);
|
sl@0
|
269 |
}
|
sl@0
|
270 |
|
sl@0
|
271 |
|
sl@0
|
272 |
/**
|
sl@0
|
273 |
@file
|
sl@0
|
274 |
@SYMTestCaseID SYSLIB-SCHSVR-CT-0238
|
sl@0
|
275 |
@SYMTestCaseDesc Check Exetrnalize and Internalize methods
|
sl@0
|
276 |
@SYMTestPriority low
|
sl@0
|
277 |
@SYMTestActions Creates an instance of TScheduleEntryInfo2 using the overloaded operator, externalizes it
|
sl@0
|
278 |
to a file and then internalizes into another instance of TScheduleEntryInfo2.
|
sl@0
|
279 |
Checks the externalized data is the same as the internalized one.
|
sl@0
|
280 |
@SYMTestExpectedResults The test must not fail.
|
sl@0
|
281 |
@SYMPREQ PREQ234
|
sl@0
|
282 |
*/
|
sl@0
|
283 |
void TScheduleEntryInfo2_StateAccessor::TestExternalizeInternalizeL()
|
sl@0
|
284 |
{
|
sl@0
|
285 |
|
sl@0
|
286 |
// Test externalise
|
sl@0
|
287 |
TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SCHSVR-CT-0238 \n=== Test TScheduleEntryInfo2::ExternalizeL\n"));
|
sl@0
|
288 |
RFile file;
|
sl@0
|
289 |
|
sl@0
|
290 |
|
sl@0
|
291 |
TFileName testFileName(fileName);
|
sl@0
|
292 |
TEST2(file.Replace(TheFsSession,testFileName,EFileWrite|EFileRead), KErrNone);
|
sl@0
|
293 |
RFileBuf buf;
|
sl@0
|
294 |
CleanupClosePushL(buf);
|
sl@0
|
295 |
buf.Attach(file);
|
sl@0
|
296 |
RWriteStream stream(&buf);
|
sl@0
|
297 |
|
sl@0
|
298 |
TTsTime ttime(SchSvrHelpers::TimeBasedOnOffset(1), EFalse);
|
sl@0
|
299 |
TScheduleEntryInfo2 entry1(ttime, EHourly, 1, 20);
|
sl@0
|
300 |
stream << entry1; //externalize TScheduleEntryInfo2
|
sl@0
|
301 |
buf.SynchL();
|
sl@0
|
302 |
CleanupStack::PopAndDestroy(&buf);
|
sl@0
|
303 |
|
sl@0
|
304 |
|
sl@0
|
305 |
// Test internalise
|
sl@0
|
306 |
TheTest.Next(_L("\n=== Test TScheduleEntryInfo2::InternalizeL\n"));
|
sl@0
|
307 |
TScheduleEntryInfo2 entry2;
|
sl@0
|
308 |
TInt err = file.Open(TheFsSession,testFileName,EFileRead);
|
sl@0
|
309 |
TEST2(err, KErrNone);
|
sl@0
|
310 |
RFileBuf buf2;
|
sl@0
|
311 |
CleanupClosePushL(buf2);
|
sl@0
|
312 |
buf2.Attach(file);
|
sl@0
|
313 |
RReadStream stream2(&buf2);
|
sl@0
|
314 |
|
sl@0
|
315 |
stream2 >> entry2; //internalize TScheduleEntryInfo2
|
sl@0
|
316 |
|
sl@0
|
317 |
//check iIntervalType
|
sl@0
|
318 |
TEST(entry1.iIntervalType == entry2.iIntervalType);
|
sl@0
|
319 |
|
sl@0
|
320 |
//check iStartTime
|
sl@0
|
321 |
TEST(entry1.iStartTime.GetUtcTime() == entry2.iStartTime.GetUtcTime());
|
sl@0
|
322 |
|
sl@0
|
323 |
//check iInterval
|
sl@0
|
324 |
TEST(entry1.iInterval == entry2.iInterval);
|
sl@0
|
325 |
|
sl@0
|
326 |
//check iValidityPeriod
|
sl@0
|
327 |
TEST(entry1.iValidityPeriod == entry2.iValidityPeriod);
|
sl@0
|
328 |
|
sl@0
|
329 |
CleanupStack::PopAndDestroy(&buf2);
|
sl@0
|
330 |
|
sl@0
|
331 |
}
|
sl@0
|
332 |
|
sl@0
|
333 |
/**
|
sl@0
|
334 |
@SYMTestCaseID SYSLIB-SCHSVR-CT-3368
|
sl@0
|
335 |
@SYMTestCaseDesc Task Scheduler: Persistent Schedules not ReScheduled on Device Bootup.
|
sl@0
|
336 |
@SYMTestPriority High
|
sl@0
|
337 |
@SYMTestActions This test does not have any capability. It tries to create persistent
|
sl@0
|
338 |
time/ conduction schedule, it fail to create schedule
|
sl@0
|
339 |
So return code will be KErrPermissionDenied
|
sl@0
|
340 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
341 |
@SYMDEF PDEF098080: Task Scheduler: Persistent Schedules not ReScheduled on Device Bootup.
|
sl@0
|
342 |
*/
|
sl@0
|
343 |
LOCAL_D void CreatePersistentScheduleCapabilityTest()
|
sl@0
|
344 |
{
|
sl@0
|
345 |
__UHEAP_MARK;
|
sl@0
|
346 |
|
sl@0
|
347 |
TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SCHSVR-CT-3368 \nPDEF098080: Task Scheduler: Persistent Schedules not ReScheduled on Device Bootup\n"));
|
sl@0
|
348 |
|
sl@0
|
349 |
RScheduler TheScheduler;
|
sl@0
|
350 |
TheTest(TheScheduler.Connect() == KErrNone);;
|
sl@0
|
351 |
|
sl@0
|
352 |
//Create persistent time based schedule
|
sl@0
|
353 |
CArrayFixFlat<TScheduleEntryInfo2>* entryList = new(ELeave) CArrayFixFlat<TScheduleEntryInfo2>(1);
|
sl@0
|
354 |
CleanupStack::PushL(entryList);
|
sl@0
|
355 |
TSchedulerItemRef ref;
|
sl@0
|
356 |
|
sl@0
|
357 |
TTime ttime(SchSvrHelpers::TimeBasedOnOffset(0));
|
sl@0
|
358 |
TTsTime startTime1(ttime, EFalse);
|
sl@0
|
359 |
|
sl@0
|
360 |
TScheduleEntryInfo2 entry1 (startTime1, EDaily, 1, 20);
|
sl@0
|
361 |
entryList->AppendL(entry1);
|
sl@0
|
362 |
|
sl@0
|
363 |
// Create the time base schedule and check capability policing is working .
|
sl@0
|
364 |
TEST2(TheScheduler.CreatePersistentSchedule(ref, *entryList),KErrPermissionDenied);
|
sl@0
|
365 |
|
sl@0
|
366 |
CleanupStack::PopAndDestroy(entryList);
|
sl@0
|
367 |
|
sl@0
|
368 |
//Create persistent Condition based schedule
|
sl@0
|
369 |
CArrayFixFlat<TTaskSchedulerCondition>* conditionList = new(ELeave) CArrayFixFlat<TTaskSchedulerCondition>(1);
|
sl@0
|
370 |
CleanupStack::PushL(conditionList);
|
sl@0
|
371 |
TSchedulerItemRef ref1;
|
sl@0
|
372 |
|
sl@0
|
373 |
TTaskSchedulerCondition condition1;
|
sl@0
|
374 |
const TUid KTestUid = TUid::Uid(0x01234566);
|
sl@0
|
375 |
condition1.iCategory = KTestUid;
|
sl@0
|
376 |
condition1.iKey = 10;
|
sl@0
|
377 |
condition1.iState = 10;
|
sl@0
|
378 |
condition1.iType = TTaskSchedulerCondition::EEquals;
|
sl@0
|
379 |
conditionList->AppendL(condition1);
|
sl@0
|
380 |
|
sl@0
|
381 |
// Create the condition base schedule and check capability policing is working .
|
sl@0
|
382 |
TEST2(TheScheduler.CreatePersistentSchedule(ref1, *conditionList,startTime1),KErrPermissionDenied);
|
sl@0
|
383 |
|
sl@0
|
384 |
CleanupStack::PopAndDestroy(conditionList);
|
sl@0
|
385 |
TheScheduler.Close();
|
sl@0
|
386 |
|
sl@0
|
387 |
__UHEAP_MARKEND;
|
sl@0
|
388 |
}
|
sl@0
|
389 |
|
sl@0
|
390 |
|
sl@0
|
391 |
/**
|
sl@0
|
392 |
Runs all the tests.
|
sl@0
|
393 |
*/
|
sl@0
|
394 |
static void RunTestsL()
|
sl@0
|
395 |
{
|
sl@0
|
396 |
TheTest.Start(_L("=== Start TScheduleEntryInfo2 tests \n"));
|
sl@0
|
397 |
|
sl@0
|
398 |
CreatePersistentScheduleCapabilityTest();
|
sl@0
|
399 |
|
sl@0
|
400 |
TScheduleEntryInfo2_StateAccessor* scheduleStateAccessor = new (ELeave) TScheduleEntryInfo2_StateAccessor;
|
sl@0
|
401 |
|
sl@0
|
402 |
CleanupStack::PushL(scheduleStateAccessor);
|
sl@0
|
403 |
|
sl@0
|
404 |
scheduleStateAccessor->TestDefaultConstructor();
|
sl@0
|
405 |
scheduleStateAccessor->TestCopyConstructorOverloadedConstructor();
|
sl@0
|
406 |
|
sl@0
|
407 |
//utility Get and Set methods
|
sl@0
|
408 |
scheduleStateAccessor->TestIntervalTypeSetIntervalType();
|
sl@0
|
409 |
scheduleStateAccessor->TestStartTimeSetStartTime();
|
sl@0
|
410 |
scheduleStateAccessor->TestIntervalSetInterval();
|
sl@0
|
411 |
scheduleStateAccessor->TestValidityPeriodSetValidityPeriod();
|
sl@0
|
412 |
scheduleStateAccessor->TestNonExportedConstructor();
|
sl@0
|
413 |
|
sl@0
|
414 |
//utility externalize internalize
|
sl@0
|
415 |
scheduleStateAccessor->TestExternalizeInternalizeL();
|
sl@0
|
416 |
CleanupStack::PopAndDestroy();
|
sl@0
|
417 |
}
|
sl@0
|
418 |
|
sl@0
|
419 |
|
sl@0
|
420 |
|
sl@0
|
421 |
//***********************************************************************************
|
sl@0
|
422 |
GLDEF_C TInt E32Main()
|
sl@0
|
423 |
{
|
sl@0
|
424 |
CTrapCleanup* tc = CTrapCleanup::New();
|
sl@0
|
425 |
TEST(tc != NULL);
|
sl@0
|
426 |
|
sl@0
|
427 |
__UHEAP_MARK;
|
sl@0
|
428 |
|
sl@0
|
429 |
fileName.Copy(KFileName);
|
sl@0
|
430 |
fileName[0] = RFs::GetSystemDriveChar();
|
sl@0
|
431 |
|
sl@0
|
432 |
TInt err = TheFsSession.Connect();
|
sl@0
|
433 |
TEST2(err, KErrNone);
|
sl@0
|
434 |
|
sl@0
|
435 |
TheTest.Title();
|
sl@0
|
436 |
|
sl@0
|
437 |
TRAP(err, ::RunTestsL())
|
sl@0
|
438 |
TEST2(err, KErrNone);
|
sl@0
|
439 |
|
sl@0
|
440 |
(void)TheFsSession.Delete(fileName);
|
sl@0
|
441 |
TheFsSession.Close();
|
sl@0
|
442 |
TheTest.End();
|
sl@0
|
443 |
TheTest.Close();
|
sl@0
|
444 |
|
sl@0
|
445 |
__UHEAP_MARKEND;
|
sl@0
|
446 |
|
sl@0
|
447 |
delete tc;
|
sl@0
|
448 |
|
sl@0
|
449 |
return(KErrNone);
|
sl@0
|
450 |
|
sl@0
|
451 |
}
|
sl@0
|
452 |
|
sl@0
|
453 |
|
sl@0
|
454 |
|