111 |
111 |
112 void UT_UriSchemeHandlerService::t_viewUnsupportedScheme() |
112 void UT_UriSchemeHandlerService::t_viewUnsupportedScheme() |
113 { |
113 { |
114 QString unknownUri("mailto:alice@wonderland"); |
114 QString unknownUri("mailto:alice@wonderland"); |
115 |
115 |
116 EXPECT(TelUriSchemeParser::isSupportedUriScheme).returns(false); |
116 EXPECT(TelUriSchemeParser, isSupportedUriScheme).returns(false); |
117 EXPECT(CPECallControlIFMock::HandleDialServiceCall).times(0); |
117 EXPECT(CPECallControlIFMock, HandleDialServiceCall).times(0); |
118 |
118 |
119 bool handled = m_uriHandlerService->view(unknownUri); |
119 bool handled = m_uriHandlerService->view(unknownUri); |
120 |
120 |
121 QCOMPARE(handled, false); |
121 QCOMPARE(handled, false); |
122 QVERIFY(verify()); |
122 QVERIFY(verify()); |
123 } |
123 } |
124 |
124 |
125 |
125 |
126 void UT_UriSchemeHandlerService::t_viewSupportedSchemeCapabilityCheckFails() |
126 void UT_UriSchemeHandlerService::t_viewSupportedSchemeCapabilityCheckFails() |
127 { |
127 { |
128 EXPECT(TelUriSchemeParser::isSupportedUriScheme).returns(true); |
128 EXPECT(TelUriSchemeParser, isSupportedUriScheme).returns(true); |
129 QSet<int> invalidCapabilities; |
129 QSet<int> invalidCapabilities; |
130 invalidCapabilities.insert(ECapabilityNetworkServices); |
130 invalidCapabilities.insert(ECapabilityNetworkServices); |
131 EXPECT(XQRequestInfo::clientCapabilities).returns(invalidCapabilities); |
131 EXPECT(XQRequestInfo, clientCapabilities).returns(invalidCapabilities); |
132 EXPECT(CPECallControlIFMock::HandleDialServiceCall).times(0); |
132 EXPECT(CPECallControlIFMock, HandleDialServiceCall).times(0); |
133 |
133 |
134 bool handled = m_uriHandlerService->view(KTelUriWithGlobalNumber); |
134 bool handled = m_uriHandlerService->view(KTelUriWithGlobalNumber); |
135 |
135 |
136 QCOMPARE(handled, false); |
136 QCOMPARE(handled, false); |
137 QVERIFY(verify()); |
137 QVERIFY(verify()); |
138 } |
138 } |
139 |
139 |
140 |
140 |
141 void UT_UriSchemeHandlerService::t_viewSupportedSchemeParsingFails() |
141 void UT_UriSchemeHandlerService::t_viewSupportedSchemeParsingFails() |
142 { |
142 { |
143 EXPECT(TelUriSchemeParser::isSupportedUriScheme).returns(true); |
143 EXPECT(TelUriSchemeParser, isSupportedUriScheme).returns(true); |
144 QSet<int> validCapabilities; |
144 QSet<int> validCapabilities; |
145 validCapabilities.insert(ECapabilityNetworkServices); |
145 validCapabilities.insert(ECapabilityNetworkServices); |
146 validCapabilities.insert(ECapabilityNetworkControl); |
146 validCapabilities.insert(ECapabilityNetworkControl); |
147 EXPECT(XQRequestInfo::clientCapabilities).returns(validCapabilities); |
147 EXPECT(XQRequestInfo, clientCapabilities).returns(validCapabilities); |
148 EXPECT(TelUriSchemeParser::parseUri).returns(false); |
148 EXPECT(TelUriSchemeParser, parseUri).returns(false); |
149 EXPECT(CPECallControlIFMock::HandleDialServiceCall).times(0); |
149 EXPECT(CPECallControlIFMock, HandleDialServiceCall).times(0); |
150 |
150 |
151 bool handled = m_uriHandlerService->view(KTelUriWithGlobalNumber); |
151 bool handled = m_uriHandlerService->view(KTelUriWithGlobalNumber); |
152 |
152 |
153 QCOMPARE(handled, false); |
153 QCOMPARE(handled, false); |
154 QVERIFY(verify()); |
154 QVERIFY(verify()); |
155 } |
155 } |
156 |
156 |
157 |
157 |
158 void UT_UriSchemeHandlerService::t_viewSupportedUriUserCancelsCall() |
158 void UT_UriSchemeHandlerService::t_viewSupportedUriUserCancelsCall() |
159 { |
159 { |
160 EXPECT(TelUriSchemeParser::isSupportedUriScheme).returns(true); |
160 EXPECT(TelUriSchemeParser, isSupportedUriScheme).returns(true); |
161 QSet<int> validCapabilities; |
161 QSet<int> validCapabilities; |
162 validCapabilities.insert(ECapabilityNetworkServices); |
162 validCapabilities.insert(ECapabilityNetworkServices); |
163 validCapabilities.insert(ECapabilityNetworkControl); |
163 validCapabilities.insert(ECapabilityNetworkControl); |
164 EXPECT(XQRequestInfo::clientCapabilities).returns(validCapabilities); |
164 EXPECT(XQRequestInfo, clientCapabilities).returns(validCapabilities); |
165 EXPECT(TelUriSchemeParser::parseUri).returns(true); |
165 EXPECT(TelUriSchemeParser, parseUri).returns(true); |
166 EXPECT(HbDeviceMessageBox::setTimeout).with(0); |
166 EXPECT(HbDeviceMessageBox, setTimeout).with(0); |
167 EXPECT(HbDeviceMessageBox::isAcceptAction).returns(false); |
167 EXPECT(HbDeviceMessageBox, isAcceptAction).returns(false); |
168 EXPECT(CPECallControlIFMock::HandleDialServiceCall).times(0); |
168 EXPECT(CPECallControlIFMock, HandleDialServiceCall).times(0); |
169 |
169 |
170 bool handled = m_uriHandlerService->view(KTelUriWithGlobalNumber); |
170 bool handled = m_uriHandlerService->view(KTelUriWithGlobalNumber); |
171 |
171 |
172 QCOMPARE(handled, false); |
172 QCOMPARE(handled, false); |
173 QVERIFY(verify()); |
173 QVERIFY(verify()); |
174 } |
174 } |
175 |
175 |
176 |
176 |
177 void UT_UriSchemeHandlerService::t_viewSupportedUriUserAcceptsCall() |
177 void UT_UriSchemeHandlerService::t_viewSupportedUriUserAcceptsCall() |
178 { |
178 { |
179 EXPECT(TelUriSchemeParser::isSupportedUriScheme).returns(true); |
179 EXPECT(TelUriSchemeParser, isSupportedUriScheme).returns(true); |
180 QSet<int> validCapabilities; |
180 QSet<int> validCapabilities; |
181 validCapabilities.insert(ECapabilityNetworkServices); |
181 validCapabilities.insert(ECapabilityNetworkServices); |
182 validCapabilities.insert(ECapabilityNetworkControl); |
182 validCapabilities.insert(ECapabilityNetworkControl); |
183 EXPECT(XQRequestInfo::clientCapabilities).returns(validCapabilities); |
183 EXPECT(XQRequestInfo, clientCapabilities).returns(validCapabilities); |
184 EXPECT(TelUriSchemeParser::parseUri) |
184 EXPECT(TelUriSchemeParser, parseUri) |
185 .willOnce(invoke(setPhoneNumber)) |
185 .willOnce(invoke(setPhoneNumber)) |
186 .returns(true); |
186 .returns(true); |
187 EXPECT(HbDeviceMessageBox::setTimeout).with(0); |
187 EXPECT(HbDeviceMessageBox, setTimeout).with(0); |
188 EXPECT(HbDeviceMessageBox::isAcceptAction).returns(true); |
188 EXPECT(HbDeviceMessageBox, isAcceptAction).returns(true); |
189 |
189 |
190 _LIT(KExpectedDialString, "+358401234567890"); |
190 _LIT(KExpectedDialString, "+358401234567890"); |
191 EXPECT(CPECallSettersIFMock::SetPhoneNumber).with(KExpectedDialString()); |
191 EXPECT(CPECallSettersIFMock, SetPhoneNumber).with(KExpectedDialString()); |
192 EXPECT(CPECallSettersIFMock::SetCallTypeCommand).with(EPECallTypeCSVoice); |
192 EXPECT(CPECallSettersIFMock, SetCallTypeCommand).with(EPECallTypeCSVoice); |
193 EXPECT(CPECallControlIFMock::HandleDialServiceCall).returns(KErrNone); |
193 EXPECT(CPECallControlIFMock, HandleDialServiceCall).returns(KErrNone); |
194 |
194 |
195 bool handled = m_uriHandlerService->view(KTelUriWithGlobalNumber); |
195 bool handled = m_uriHandlerService->view(KTelUriWithGlobalNumber); |
196 |
196 |
197 QCOMPARE(handled, true); |
197 QCOMPARE(handled, true); |
198 QVERIFY(verify()); |
198 QVERIFY(verify()); |
199 } |
199 } |
200 |
200 |
201 |
201 |
202 void UT_UriSchemeHandlerService::t_viewSupportedUriCallRequestFails() |
202 void UT_UriSchemeHandlerService::t_viewSupportedUriCallRequestFails() |
203 { |
203 { |
204 EXPECT(TelUriSchemeParser::isSupportedUriScheme).returns(true); |
204 EXPECT(TelUriSchemeParser, isSupportedUriScheme).returns(true); |
205 QSet<int> validCapabilities; |
205 QSet<int> validCapabilities; |
206 validCapabilities.insert(ECapabilityNetworkServices); |
206 validCapabilities.insert(ECapabilityNetworkServices); |
207 validCapabilities.insert(ECapabilityNetworkControl); |
207 validCapabilities.insert(ECapabilityNetworkControl); |
208 EXPECT(XQRequestInfo::clientCapabilities).returns(validCapabilities); |
208 EXPECT(XQRequestInfo, clientCapabilities).returns(validCapabilities); |
209 EXPECT(TelUriSchemeParser::parseUri) |
209 EXPECT(TelUriSchemeParser, parseUri) |
210 .willOnce(invoke(setPhoneNumber)) |
210 .willOnce(invoke(setPhoneNumber)) |
211 .returns(true); |
211 .returns(true); |
212 EXPECT(HbDeviceMessageBox::setTimeout).with(0); |
212 EXPECT(HbDeviceMessageBox, setTimeout).with(0); |
213 EXPECT(HbDeviceMessageBox::isAcceptAction).returns(true); |
213 EXPECT(HbDeviceMessageBox, isAcceptAction).returns(true); |
214 |
214 |
215 _LIT(KExpectedDialString, "+358401234567890"); |
215 _LIT(KExpectedDialString, "+358401234567890"); |
216 EXPECT(CPECallSettersIFMock::SetPhoneNumber).with(KExpectedDialString()); |
216 EXPECT(CPECallSettersIFMock, SetPhoneNumber).with(KExpectedDialString()); |
217 EXPECT(CPECallSettersIFMock::SetCallTypeCommand).with(EPECallTypeCSVoice); |
217 EXPECT(CPECallSettersIFMock, SetCallTypeCommand).with(EPECallTypeCSVoice); |
218 EXPECT(CPECallControlIFMock::HandleDialServiceCall).returns(KErrNoMemory); |
218 EXPECT(CPECallControlIFMock, HandleDialServiceCall).returns(KErrNoMemory); |
219 |
219 |
220 bool handled = m_uriHandlerService->view(KTelUriWithGlobalNumber); |
220 bool handled = m_uriHandlerService->view(KTelUriWithGlobalNumber); |
221 |
221 |
222 QCOMPARE(handled, false); |
222 QCOMPARE(handled, false); |
223 QVERIFY(verify()); |
223 QVERIFY(verify()); |