phoneengine/phoneservices/tsrc/ut_phoneservices/unit_tests.cpp
changeset 30 ebdbd102c78a
parent 21 92ab7f8d0eab
child 51 f39ed5e045e0
--- a/phoneengine/phoneservices/tsrc/ut_phoneservices/unit_tests.cpp	Mon May 03 12:31:11 2010 +0300
+++ b/phoneengine/phoneservices/tsrc/ut_phoneservices/unit_tests.cpp	Fri May 14 15:51:57 2010 +0300
@@ -21,21 +21,33 @@
 #include "phoneservices.h"
 #include "dialservice.h"
 #include "dtmfservice.h"
+#include "keysequencerecognitionservice.h"
+#include "mpekeysequencerecognitionif.h"
 
 bool m_dialServiceConstructed;
 bool m_dtmfServiceConstructed;
+bool g_keySequenceServiceConstructed;
 MPECallControlIF* m_dialServiceCallPointer;
 MPECallSettersIF* m_dialServiceParameterPointer;
+MPEKeySequenceRecognitionIF* g_keySequenceRecognizerParameterPointer;
 MPECallControlIF* m_dtmfServiceCallPointer;
 MPECallSettersIF* m_dtmfServiceParameterPointer;
 
-class TestPhoneServices : public QObject, public MPECallControlIF, public MPECallSettersIF
+class TestPhoneServices 
+    : 
+    public QObject,
+    public MPECallControlIF,
+    public MPECallSettersIF,
+    public MPEKeySequenceRecognitionIF
 {
     Q_OBJECT
 public:
     TestPhoneServices();
     virtual ~TestPhoneServices();    
 
+public:
+    TBool ExecuteKeySequenceL(const TDesC16& aSequence);
+    
 public slots:
     void initTestCase ();
     void cleanupTestCase ();
@@ -72,7 +84,7 @@
 };
 
 DialService::DialService(MPECallControlIF &call, MPECallSettersIF &parameters, QObject* parent) : 
-    XQServiceProvider(QLatin1String("com.nokia.services.telephony"), parent), m_call (call), m_parameters (parameters)
+    XQServiceProvider(QLatin1String("com.nokia.symbian.ICallDial"), parent), m_call (call), m_parameters (parameters)
 {
     m_dialServiceConstructed = true;
     m_dialServiceCallPointer = &call;
@@ -133,7 +145,7 @@
 }
 
 DTMFService::DTMFService(MPECallControlIF &call, MPECallSettersIF &parameters, QObject* parent) : 
-    XQServiceProvider(QLatin1String("com.nokia.services.telephony.dtmf"), parent), m_call (call), m_parameters (parameters)
+    XQServiceProvider(QLatin1String("com.nokia.symbian.IDtmfPlay"), parent), m_call (call), m_parameters (parameters)
 {
     m_dtmfServiceConstructed = true;
     m_dtmfServiceCallPointer = &call;
@@ -144,11 +156,6 @@
 {
 }
 
-void DTMFService::executeKeySequence(const QString& keySequence)
-{
-    Q_UNUSED(keySequence);
-}
-
 void DTMFService::playDTMFTone(const QChar& keyToPlay)
 {
     Q_UNUSED(keyToPlay);
@@ -158,6 +165,29 @@
 {
 }
 
+KeySequenceRecognitionService::KeySequenceRecognitionService(
+    MPEKeySequenceRecognitionIF &keySequenceRecognizer,
+    QObject* parent) 
+    : 
+    XQServiceProvider(
+        QLatin1String("com.nokia.symbian.IDtmfPlay"), parent),
+        m_keySequenceRecognizer(keySequenceRecognizer)
+{
+    g_keySequenceServiceConstructed = true;
+    g_keySequenceRecognizerParameterPointer = &keySequenceRecognizer;
+}
+
+bool KeySequenceRecognitionService::executeKeySequence(
+    const QString &keySequence)
+{
+    Q_UNUSED(keySequence);
+    return true;
+}
+
+KeySequenceRecognitionService::~KeySequenceRecognitionService()
+{
+}
+
 TestPhoneServices::TestPhoneServices ()
 {
 }
@@ -188,8 +218,9 @@
     keyValue = -1;
     m_dialServiceConstructed = false;
     m_dtmfServiceConstructed = false;
+    g_keySequenceServiceConstructed = false;
     
-    m_phoneServices = new PhoneServices (*this, *this, this);
+    m_phoneServices = new PhoneServices (*this, *this, *this, this);
 
     QVERIFY(m_dialServiceConstructed == true);
     QVERIFY(m_dialServiceCallPointer == this);
@@ -198,6 +229,9 @@
     QVERIFY(m_dtmfServiceConstructed == true);
     QVERIFY(m_dtmfServiceCallPointer == this);
     QVERIFY(m_dtmfServiceParameterPointer == this);
+    
+    QVERIFY(g_keySequenceServiceConstructed == true);
+    QVERIFY(g_keySequenceRecognizerParameterPointer == this);
 }
 
 void TestPhoneServices::cleanup ()
@@ -205,6 +239,12 @@
     delete m_phoneServices;
 }
 
+TBool TestPhoneServices::ExecuteKeySequenceL(const TDesC16& aSequence)
+{
+    Q_UNUSED(aSequence)
+    return ETrue;
+}
+
 void TestPhoneServices::SetKeyCode( const TChar& aKeyCode )
 {
     m_setKeyCodeCalled = true;
@@ -242,7 +282,7 @@
 
 void TestPhoneServices::SetServiceIdCommand( TUint32 aServiceId )
 {
-	
+    Q_UNUSED(aServiceId)
 }
 
 TInt TestPhoneServices::HandleDialServiceCall( const TBool aClientCall )