|
1 /* |
|
2 * Copyright (c) 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: Tools class used in ProfileEngine tests. |
|
15 * |
|
16 */ |
|
17 |
|
18 //////////////////////////////////////////////////////////////////////// |
|
19 // T_ProfileTestTools.h |
|
20 // |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <CNTDEF.H> |
|
25 |
|
26 #include <MProfileChangeObserver.h> |
|
27 //CONSTS |
|
28 |
|
29 //#define PROFILE_TEST_RUN_ALLOC |
|
30 |
|
31 |
|
32 // default profile names |
|
33 _LIT( KProfileGeneralName, "General" ); |
|
34 _LIT( KProfileSilentName, "Silent" ); |
|
35 _LIT( KProfileMeetingName, "Meeting" ); |
|
36 _LIT( KProfileOutdoorName, "Outdoor" ); |
|
37 _LIT( KProfilePagerName, "Pager" ); |
|
38 #ifdef __OFFLINE_MODE |
|
39 _LIT( KProfileOfflineName, "Off-line" ); |
|
40 #endif |
|
41 #ifdef __DRIVE_MODE |
|
42 _LIT( KProfileDriveName, "Drive" ); |
|
43 #endif |
|
44 |
|
45 _LIT( KProfileGeneralName2, "General2" ); |
|
46 _LIT( KProfileSilentName2, "Silent2" ); |
|
47 _LIT( KProfileMeetingName2, "Meeting2" ); |
|
48 _LIT( KProfileOutdoorName2, "Outdoor2" ); |
|
49 _LIT( KProfilePagerName2, "Pager2" ); |
|
50 #ifdef __OFFLINE_MODE |
|
51 _LIT( KProfileOfflineName2, "Off-line2" ); |
|
52 #endif |
|
53 #ifdef __DRIVE_MODE |
|
54 _LIT( KProfileDriveName2, "Drive2" ); |
|
55 #endif |
|
56 |
|
57 // default tone settings |
|
58 _LIT( KProfileNokiaTune, "z:\\data\\sounds\\digital\\nokia tune.aac" ); |
|
59 _LIT( KProfileMessageTone, "z:\\data\\sounds\\digital\\message 1.aac" ); |
|
60 _LIT( KProfileIMMessageTone, "z:\\data\\sounds\\digital\\Chat alert.aac" ); |
|
61 _LIT( KProfileBeep, "z:\\data\\sounds\\simple\\beep.rng" ); |
|
62 _LIT( KProfileBeepTwice, "z:\\data\\sounds\\simple\\beep twice.rng" ); |
|
63 _LIT( KProfileNoSound, "z:\\resource\\no_sound.wav" ); |
|
64 |
|
65 // default presence settings |
|
66 //_LIT( KProfileStatusMessageAvailable, "Available" ); |
|
67 //_LIT( KProfileStatusMessageDiscreet, "Discreet" ); |
|
68 //_LIT( KProfileStatusMessageNotAvailable, "Not available" ); |
|
69 _LIT( KProfileStatusMessageAvailable, "" ); |
|
70 _LIT( KProfileStatusMessageDiscreet, "" ); |
|
71 _LIT( KProfileStatusMessageNotAvailable, "" ); |
|
72 |
|
73 _LIT( KProfileEmpty, "" ); |
|
74 _LIT( KProfileMinName, "Z" ); |
|
75 _LIT( KProfileMaxName, "1234567890123456789012345678901234567890123456789012345678901234" ); // 64 |
|
76 //_LIT( KProfileTooLongProfileName, "1234567890123456789012345678901234567890123456789012345678901234567890" ); // 70 |
|
77 _LIT( KProfileMaxFileName, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456" ); // 256 |
|
78 _LIT( KProfileTooLongFileName, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567" ); // 257 |
|
79 _LIT( KProfileMaxStatusMessage, "1234567890123456789012345678901234567890" ); // 40 |
|
80 |
|
81 const TInt KMaxNumberOfDynamicProfiles( 20 ); |
|
82 |
|
83 |
|
84 // FORWARD DECLARATION |
|
85 class RFs; |
|
86 class MProfilesNamesArray; |
|
87 struct TProfileToneSettings; |
|
88 class CPbkContactEngine; |
|
89 |
|
90 struct TSharedDataSettings |
|
91 { |
|
92 TInt iRingType; |
|
93 TInt iRingVol; |
|
94 TInt iVibrAlert; |
|
95 TInt iKeyVolume; |
|
96 TInt iWarnTone; |
|
97 TInt iMsgAlert; |
|
98 TBuf<64> iRingTone1; |
|
99 TBuf<64> iRingTone2; |
|
100 TBuf<64> iMsgTone; |
|
101 TBuf<16> iName; |
|
102 TInt iActive; |
|
103 }; |
|
104 |
|
105 /** |
|
106 * Test observer |
|
107 */ |
|
108 class CTestObserver: public CBase, public MProfileChangeObserver |
|
109 { |
|
110 public: |
|
111 static CTestObserver* NewL() |
|
112 {CTestObserver* self = new (ELeave) CTestObserver; return self;} |
|
113 ~CTestObserver() |
|
114 {}; |
|
115 void HandleActiveProfileEventL( TProfileEvent aProfileEvent, TInt aProfileId ) |
|
116 { |
|
117 iLastEvent = aProfileEvent; |
|
118 iLastId = aProfileId; |
|
119 CActiveScheduler::Stop(); |
|
120 } |
|
121 TProfileEvent iLastEvent; |
|
122 TInt iLastId; |
|
123 }; |
|
124 |
|
125 /** |
|
126 * Test Tools |
|
127 */ |
|
128 class T_ProfileTestTools |
|
129 { |
|
130 public: |
|
131 static void ResetRepository(); |
|
132 static void RemoveFilesL( RFs& aFs ); |
|
133 static TInt DefaultFiles( RFs& aFs ); |
|
134 static TInt CorruptFiles( RFs& aFs ); |
|
135 static TInt MakeBackupFiles( RFs& aFs ); |
|
136 static TBool CompareArrays( const TArray<TContactItemId>& aArray1, const TArray<TContactItemId>& aArray2 ); |
|
137 static TBool CheckArray( const MProfilesNamesArray& aArray ); |
|
138 static TBool CheckModifiedArray( MProfilesNamesArray& aArray ); |
|
139 static const TDesC& ProfileShortName( TInt aId ); |
|
140 static const TDesC& ProfileName( TInt aId ); |
|
141 static const TDesC& ProfileModifiedName( TInt aId ); |
|
142 static const TDesC& ProfileRingingTone( TInt aId ); |
|
143 static const TDesC& ProfileMessageAlertTone( TInt aId ); |
|
144 static const TDesC& ProfileIMMessageAlertTone( TInt aId ); |
|
145 static const TDesC& ProfileEmailAlertTone( TInt aId ); |
|
146 static const TDesC& ProfileVideoCallRingingTone( TInt aId ); |
|
147 static const TDesC& ProfileStatusMessage( TInt aId ); |
|
148 static TBool CheckToneSettings( TInt aId, const TProfileToneSettings& aSettings ); |
|
149 static void CreateContactGroupsL( TInt aNumber, RArray<TContactItemId>& aArray, CPbkContactEngine& aContactEngine ); |
|
150 static void DeleteContactGroups( RArray<TContactItemId>& aArray, CPbkContactEngine& aContactEngine ); |
|
151 static void CreateContactsL( TInt aNumber, RArray<TContactItemId>& aArray, CPbkContactEngine& aContactEngine ); |
|
152 static void DeleteContacts( RArray<TContactItemId>& aArray, CPbkContactEngine& aContactEngine ); |
|
153 static void WriteAlertForIdsToCenrepL( TInt aProfileId, RArray<TContactItemId>& aArray ); |
|
154 static void DeleteAlertForIdsFromCenrep( TInt aProfileId ); |
|
155 static TBool CheckSharedDataSettingsL( TInt aId ); |
|
156 static TBool CheckSharedDataSettingsL( const TSharedDataSettings& aSettings ); |
|
157 static TBool CompareSettings( const TSharedDataSettings& aSettings, const TSharedDataSettings& aSettings1 ); |
|
158 static TInt ProfilePttStatus( TInt aProfileId ); |
|
159 static const TDesC& ProfilePttRingingTone( TInt aProfileId ); |
|
160 }; |