62
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 - 2007 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: Base Class for Scripted Tests
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef BASETEST_H
|
|
19 |
#define BASETEST_H
|
|
20 |
|
|
21 |
#include <StifLogger.h>
|
|
22 |
#include <TestScripterInternal.h>
|
|
23 |
#include <StifTestModule.h>
|
|
24 |
#include "TimeoutController.h"
|
|
25 |
#include "debug.h"
|
|
26 |
|
|
27 |
|
|
28 |
// CONSTANTS
|
|
29 |
const TInt KErrBadTestParameter= -1000; // Error on configuration file
|
|
30 |
|
|
31 |
const TInt KErrEventPending =-2000; // Timeout and not callback
|
|
32 |
const TInt KErrCallbackErrorCode = -2001; // Callback return error code
|
|
33 |
const TInt KErrUnexpectedValue =-2002; // Unexpected value at setting
|
|
34 |
const TInt KExpectedFrequencyChange = -2003; // Is not finding more than one station
|
|
35 |
const TInt KErrTimeoutController = -2007; // Unexpected notification
|
|
36 |
|
|
37 |
const TInt KSmallTimeout = 1000;
|
|
38 |
const TInt KMediumTimeout = 4000;
|
|
39 |
const TInt KLargeTimeout = 100000;
|
|
40 |
|
|
41 |
|
|
42 |
_LIT( KMsgBadTestParameters, "[Error] No valid test case parameters");
|
|
43 |
|
|
44 |
_LIT( KTestFile, "c:\\Blackbird.aac");
|
|
45 |
_LIT( KTestFileMimeType, "audio/aac" );
|
|
46 |
_LIT( KRenameOldUri, "c:\\Blackbird.aac");
|
|
47 |
_LIT( KRenameNewUri, "c:\\data\\Blackbird.aac");
|
|
48 |
|
|
49 |
/**
|
|
50 |
* CBaseTest class for STIF Test Framework TestScripter.
|
|
51 |
*
|
|
52 |
*/
|
|
53 |
class CBaseTest : public CScriptBase, public MTimeoutObserver
|
|
54 |
{
|
|
55 |
public:
|
|
56 |
|
|
57 |
// Update EventName() whenever you update this
|
|
58 |
enum TExpectedEvent
|
|
59 |
{
|
|
60 |
EColHandleCollectionMessage,
|
|
61 |
EColHandleOpen,
|
|
62 |
EColHandleAddFileComplete,
|
|
63 |
EColHandleRemove,
|
|
64 |
EColHandleFindAllComplete,
|
|
65 |
|
|
66 |
EPlaHandlePlaybackMessage1,
|
|
67 |
EPlaHandlePlaybackMessage2
|
|
68 |
};
|
|
69 |
|
|
70 |
IMPORT_C CBaseTest( CTestModuleIf& aTestModuleIf );
|
|
71 |
IMPORT_C virtual ~CBaseTest();
|
|
72 |
|
|
73 |
IMPORT_C virtual void ConstructL();
|
|
74 |
|
|
75 |
public:
|
|
76 |
|
|
77 |
// From MTimeoutObserver
|
|
78 |
|
|
79 |
/**
|
|
80 |
* @since 3.2
|
|
81 |
* @param none
|
|
82 |
* Review if all the expected events have ocurred once the time is over
|
|
83 |
*/
|
|
84 |
IMPORT_C virtual void HandleTimeout(TInt error);
|
|
85 |
|
|
86 |
protected:
|
|
87 |
|
|
88 |
/**
|
|
89 |
* Maps a event with a descriptor with its name
|
|
90 |
* @since S60 3.2
|
|
91 |
*/
|
|
92 |
IMPORT_C virtual TPtrC EventName( TInt aKey );
|
|
93 |
|
|
94 |
/**
|
|
95 |
* Set an event as expected and set default timeout
|
|
96 |
* @since S60 3.2
|
|
97 |
*/
|
|
98 |
IMPORT_C virtual void AddExpectedEvent(TExpectedEvent event, TInt ms);
|
|
99 |
|
|
100 |
|
|
101 |
/**
|
|
102 |
* Unset an event as expected
|
|
103 |
* @since S60 3.2
|
|
104 |
*/
|
|
105 |
IMPORT_C virtual TBool RemoveExpectedEvent(TExpectedEvent event);
|
|
106 |
|
|
107 |
|
|
108 |
/**
|
|
109 |
* @since S60 3.2
|
|
110 |
* @param none
|
|
111 |
* Removes all expected events
|
|
112 |
*/
|
|
113 |
IMPORT_C virtual void RemoveAllExpectedEvents();
|
|
114 |
|
|
115 |
/**
|
|
116 |
* Verify that the event was expected, removes it from the list
|
|
117 |
* Signal the TestScripter with the returned error code
|
|
118 |
* @since S60 3.2
|
|
119 |
*/
|
|
120 |
IMPORT_C virtual void ProcessEvent(TExpectedEvent aEvent, TInt aError);
|
|
121 |
|
|
122 |
/*
|
|
123 |
* Test methods are listed below.
|
|
124 |
*/
|
|
125 |
|
|
126 |
/**
|
|
127 |
* Sets a timeout different since the default
|
|
128 |
* @since S60 3.2
|
|
129 |
* @param aItem Script line containing parameters.
|
|
130 |
* @return Symbian OS error code.
|
|
131 |
*/
|
|
132 |
IMPORT_C virtual TInt SetTimeout( CStifItemParser& aItem );
|
|
133 |
|
|
134 |
/**
|
|
135 |
*
|
|
136 |
* @since S60 3.2
|
|
137 |
* @param aItem Script line containing parameters.
|
|
138 |
* @return Symbian OS error code.
|
|
139 |
*/
|
|
140 |
IMPORT_C virtual TInt SetExpectedEvents( CStifItemParser& aItem );
|
|
141 |
|
|
142 |
/**
|
|
143 |
*
|
|
144 |
* @since S60 3.2
|
|
145 |
* @param aItem Script line containing parameters.
|
|
146 |
* @return Symbian OS error code.
|
|
147 |
*/
|
|
148 |
IMPORT_C virtual TInt SetAllowedPanic( CStifItemParser& aItem );
|
|
149 |
|
|
150 |
protected:
|
|
151 |
|
|
152 |
// reference to TestModuleIf
|
|
153 |
CTestModuleIf& iTestModuleIf;
|
|
154 |
|
|
155 |
// Active object with a timer to timeout the test case
|
|
156 |
CSimpleTimeout * iTimeoutController;
|
|
157 |
|
|
158 |
// Indicates if the test case use a normal exit reason
|
|
159 |
TBool iNormalExitReason;
|
|
160 |
|
|
161 |
// List of expected events
|
|
162 |
RArray<TExpectedEvent> iExpectedEvents;
|
|
163 |
|
|
164 |
// List of notification event (by the callback)
|
|
165 |
RArray<TExpectedEvent> iOcurredEvents;
|
|
166 |
};
|
|
167 |
|
|
168 |
#endif // BASETEST_H
|
|
169 |
|