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: Implementation of T_CSPSettingsVoIPUtils class. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "T_CSPSettingsVoIPUtils.h" |
|
19 #include <EUnitMacros.h> |
|
20 #include <EUnitDecorators.h> |
|
21 #include <centralrepository.h> |
|
22 #include <SettingsInternalCRKeys.h> |
|
23 |
|
24 #include "spsettingsvoiputils.h" |
|
25 #include "TestData.h" |
|
26 |
|
27 // - Construction ----------------------------------------------------------- |
|
28 |
|
29 T_CSPSettingsVoIPUtils* T_CSPSettingsVoIPUtils::NewL() |
|
30 { |
|
31 T_CSPSettingsVoIPUtils* self = T_CSPSettingsVoIPUtils::NewLC(); |
|
32 CleanupStack::Pop(); |
|
33 return self; |
|
34 } |
|
35 |
|
36 T_CSPSettingsVoIPUtils* T_CSPSettingsVoIPUtils::NewLC() |
|
37 { |
|
38 T_CSPSettingsVoIPUtils* self = new( ELeave ) T_CSPSettingsVoIPUtils(); |
|
39 CleanupStack::PushL( self ); |
|
40 self->ConstructL(); |
|
41 return self; |
|
42 } |
|
43 |
|
44 T_CSPSettingsVoIPUtils::~T_CSPSettingsVoIPUtils() |
|
45 { |
|
46 } |
|
47 |
|
48 T_CSPSettingsVoIPUtils::T_CSPSettingsVoIPUtils() |
|
49 { |
|
50 } |
|
51 |
|
52 void T_CSPSettingsVoIPUtils::ConstructL() |
|
53 { |
|
54 CEUnitTestSuiteClass::ConstructL(); |
|
55 } |
|
56 |
|
57 // - Test methods ----------------------------------------------------------- |
|
58 |
|
59 |
|
60 |
|
61 void T_CSPSettingsVoIPUtils::SetupL( ) |
|
62 { |
|
63 iCSPSettingsVoIPUtils = CSPSettingsVoIPUtils::NewL(); |
|
64 } |
|
65 |
|
66 void T_CSPSettingsVoIPUtils::Setup2L( ) |
|
67 { |
|
68 iCSPSettingsVoIPUtils = CSPSettingsVoIPUtils::NewL(); |
|
69 |
|
70 CRepository* repository = CRepository::NewLC( KCRUidTelephonySettings ); |
|
71 User::LeaveIfError( repository->Set( KDynamicVoIP, EFalse ) ); |
|
72 CleanupStack::PopAndDestroy( repository ); |
|
73 |
|
74 repository = CRepository::NewLC( KCRUidRichCallSettings ); |
|
75 User::LeaveIfError( repository->Set( KRCSPSPreferredService, 0 ) ); |
|
76 CleanupStack::PopAndDestroy( repository ); |
|
77 } |
|
78 |
|
79 void T_CSPSettingsVoIPUtils::Setup3L( ) |
|
80 { |
|
81 TestData::iCheckSupportedCase = ETrue; |
|
82 iCSPSettingsVoIPUtils = CSPSettingsVoIPUtils::NewL(); |
|
83 } |
|
84 |
|
85 void T_CSPSettingsVoIPUtils::Teardown( ) |
|
86 { |
|
87 delete iCSPSettingsVoIPUtils; |
|
88 iCSPSettingsVoIPUtils = NULL; |
|
89 } |
|
90 |
|
91 void T_CSPSettingsVoIPUtils::T_CSPSettingsVoIPUtils_VoIPProfilesExistLL( ) |
|
92 { |
|
93 iCSPSettingsVoIPUtils->VoIPProfilesExistL(); |
|
94 } |
|
95 |
|
96 void T_CSPSettingsVoIPUtils::T_CSPSettingsVoIPUtils_IsVoIPSupportedL( ) |
|
97 { |
|
98 EUNIT_ASSERT( !iCSPSettingsVoIPUtils->IsVoIPSupported( ) ); |
|
99 TestData::iCheckSupportedCase = EFalse; |
|
100 } |
|
101 |
|
102 void T_CSPSettingsVoIPUtils::T_CSPSettingsVoIPUtils_IsPreferredTelephonyVoIPL( ) |
|
103 { |
|
104 EUNIT_ASSERT( !iCSPSettingsVoIPUtils->IsPreferredTelephonyVoIP() ); |
|
105 } |
|
106 |
|
107 void T_CSPSettingsVoIPUtils::T_CSPSettingsVoIPUtils_GetPreferredServiceL( ) |
|
108 { |
|
109 TUint id( 0 ); |
|
110 EUNIT_ASSERT( KErrNotSupported == iCSPSettingsVoIPUtils->GetPreferredService( id ) ); |
|
111 |
|
112 CRepository* repository = CRepository::NewLC( KCRUidTelephonySettings ); |
|
113 User::LeaveIfError( repository->Set( KDynamicVoIP, ETrue ) ); |
|
114 CleanupStack::PopAndDestroy( repository ); |
|
115 |
|
116 EUNIT_ASSERT( KErrNotFound == iCSPSettingsVoIPUtils->GetPreferredService( id ) ); |
|
117 |
|
118 TInt testValue( 1 ); |
|
119 repository = CRepository::NewLC( KCRUidRichCallSettings ); |
|
120 User::LeaveIfError( repository->Set( KRCSPSPreferredService, testValue ) ); |
|
121 CleanupStack::PopAndDestroy( repository ); |
|
122 EUNIT_ASSERT( KErrNone == iCSPSettingsVoIPUtils->GetPreferredService( id ) ); |
|
123 EUNIT_ASSERT( testValue == id ); |
|
124 } |
|
125 |
|
126 void T_CSPSettingsVoIPUtils::T_CSPSettingsVoIPUtils_DoGetPreferredServiceLL( ) |
|
127 { |
|
128 |
|
129 } |
|
130 |
|
131 |
|
132 // - EUnit test table ------------------------------------------------------- |
|
133 |
|
134 EUNIT_BEGIN_TEST_TABLE( |
|
135 T_CSPSettingsVoIPUtils, |
|
136 "Add test suite description here.", |
|
137 "UNIT" ) |
|
138 |
|
139 EUNIT_TEST( |
|
140 "VoIPProfilesExistL - test", |
|
141 "CSPSettingsVoIPUtils", |
|
142 "VoIPProfilesExistL - test", |
|
143 "FUNCTIONALITY", |
|
144 SetupL, T_CSPSettingsVoIPUtils_VoIPProfilesExistLL, Teardown) |
|
145 |
|
146 EUNIT_TEST( |
|
147 "IsVoIPSupported - test", |
|
148 "CSPSettingsVoIPUtils", |
|
149 "IsVoIPSupported - test", |
|
150 "FUNCTIONALITY", |
|
151 Setup3L, T_CSPSettingsVoIPUtils_IsVoIPSupportedL, Teardown) |
|
152 |
|
153 EUNIT_TEST( |
|
154 "IsPreferredTelephonyVoIP - test", |
|
155 "CSPSettingsVoIPUtils", |
|
156 "IsPreferredTelephonyVoIP - test", |
|
157 "FUNCTIONALITY", |
|
158 SetupL, T_CSPSettingsVoIPUtils_IsPreferredTelephonyVoIPL, Teardown) |
|
159 |
|
160 EUNIT_TEST( |
|
161 "GetPreferredService - test", |
|
162 "CSPSettingsVoIPUtils", |
|
163 "GetPreferredService - test", |
|
164 "FUNCTIONALITY", |
|
165 Setup2L, T_CSPSettingsVoIPUtils_GetPreferredServiceL, Teardown) |
|
166 /* |
|
167 EUNIT_TEST( |
|
168 "DoGetPreferredServiceL - test", |
|
169 "CSPSettingsVoIPUtils", |
|
170 "DoGetPreferredServiceL - test", |
|
171 "FUNCTIONALITY", |
|
172 SetupL, T_CSPSettingsVoIPUtils_DoGetPreferredServiceLL, Teardown)*/ |
|
173 |
|
174 |
|
175 EUNIT_END_TEST_TABLE |
|