51
|
1 |
/*!
|
|
2 |
* Copyright (c) 2010 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <QtTest/QtTest>
|
|
19 |
#ifdef Q_OS_SYMBIAN
|
|
20 |
#include <btxqserviceapi.h>
|
|
21 |
#endif
|
|
22 |
#include "ut_bluetoothkeysequencehandler.h"
|
|
23 |
#include "bluetoothkeysequencehandler.h"
|
|
24 |
#include "keysequencerecognitionservicedefs.h"
|
|
25 |
#include "qtestmains60.h"
|
|
26 |
#include "xqappmgr.h"
|
|
27 |
|
|
28 |
QString mService;
|
|
29 |
QString mInterface;
|
|
30 |
QString mOperation;
|
|
31 |
bool mEmbedded;
|
|
32 |
bool mSendCalled;
|
|
33 |
|
|
34 |
#ifdef Q_OS_SYMBIAN
|
|
35 |
XQAiwRequest* XQApplicationManager::create(const QString& service, const QString& interface, const QString& operation, bool embedded)
|
|
36 |
{
|
|
37 |
mService = service;
|
|
38 |
mInterface = interface;
|
|
39 |
mOperation = operation;
|
|
40 |
mEmbedded = embedded;
|
|
41 |
return new XQAiwRequest();
|
|
42 |
}
|
|
43 |
void XQAiwRequest::send() { mSendCalled = true; }
|
|
44 |
#endif
|
|
45 |
|
|
46 |
UT_BluetoothKeySequenceHandler::UT_BluetoothKeySequenceHandler() : m_handler(0)
|
|
47 |
{
|
|
48 |
|
|
49 |
}
|
|
50 |
|
|
51 |
UT_BluetoothKeySequenceHandler::~UT_BluetoothKeySequenceHandler()
|
|
52 |
{
|
|
53 |
delete m_handler;
|
|
54 |
}
|
|
55 |
|
|
56 |
void UT_BluetoothKeySequenceHandler::init()
|
|
57 |
{
|
|
58 |
mService = QString("");
|
|
59 |
mInterface = QString("");
|
|
60 |
mOperation = QString("");
|
|
61 |
mEmbedded = false;
|
|
62 |
mSendCalled = false;
|
|
63 |
m_handler = new BluetoothKeySequenceHandler();
|
|
64 |
}
|
|
65 |
|
|
66 |
void UT_BluetoothKeySequenceHandler::cleanup()
|
|
67 |
{
|
|
68 |
delete m_handler;
|
|
69 |
m_handler = 0;
|
|
70 |
}
|
|
71 |
|
|
72 |
void UT_BluetoothKeySequenceHandler::testShowBTLocalAddressKeySequence()
|
|
73 |
{
|
|
74 |
#ifdef Q_OS_SYMBIAN
|
|
75 |
bool handled = m_handler->executeKeySequence(KShowBTAddress);
|
|
76 |
QVERIFY(handled == true);
|
|
77 |
QCOMPARE(mService, BluetoothServiceName);
|
|
78 |
QCOMPARE(mInterface, BluetoothInterfaceShowLocalAddress);
|
|
79 |
QCOMPARE(mOperation, BluetoothShowLocalAddress);
|
|
80 |
QVERIFY(mEmbedded == false);
|
|
81 |
QVERIFY(mSendCalled == true);
|
|
82 |
#endif
|
|
83 |
}
|
|
84 |
|
|
85 |
void UT_BluetoothKeySequenceHandler::testActivateBTDutModeKeySequence()
|
|
86 |
{
|
|
87 |
#ifdef Q_OS_SYMBIAN
|
|
88 |
bool handled = m_handler->executeKeySequence(KActivateBTTestMode);
|
|
89 |
QVERIFY(handled == true);
|
|
90 |
QCOMPARE(mService, BluetoothServiceName);
|
|
91 |
QCOMPARE(mInterface, BluetoothInterfaceActivateDutMode);
|
|
92 |
QCOMPARE(mOperation, BluetoothActivateDutMode);
|
|
93 |
QVERIFY(mEmbedded == false);
|
|
94 |
QVERIFY(mSendCalled == true);
|
|
95 |
#endif
|
|
96 |
}
|
|
97 |
|
|
98 |
void UT_BluetoothKeySequenceHandler::testToggleBTSSPDebugModeKeySequence()
|
|
99 |
{
|
|
100 |
#ifdef Q_OS_SYMBIAN
|
|
101 |
bool handled = m_handler->executeKeySequence(KToggleBTSSPDebugMode);
|
|
102 |
QVERIFY(handled == true);
|
|
103 |
QCOMPARE(mService, BluetoothServiceName);
|
|
104 |
QCOMPARE(mInterface, BluetoothInterfaceToggleSspDebugMode);
|
|
105 |
QCOMPARE(mOperation, BluetoothToggleSspDebugMode);
|
|
106 |
QVERIFY(mEmbedded == false);
|
|
107 |
QVERIFY(mSendCalled == true);
|
|
108 |
#endif
|
|
109 |
}
|
|
110 |
|
|
111 |
void UT_BluetoothKeySequenceHandler::testInvalidKeySequence()
|
|
112 |
{
|
|
113 |
#ifdef Q_OS_SYMBIAN
|
|
114 |
bool handled = m_handler->executeKeySequence("*#1234#");
|
|
115 |
QVERIFY(handled == false);
|
|
116 |
QCOMPARE(mService, QString(""));
|
|
117 |
QCOMPARE(mInterface, QString(""));
|
|
118 |
QCOMPARE(mOperation, QString(""));
|
|
119 |
QVERIFY(mEmbedded == false);
|
|
120 |
QVERIFY(mSendCalled == false);
|
|
121 |
#endif
|
|
122 |
}
|
|
123 |
|
|
124 |
QTEST_MAIN_S60(UT_BluetoothKeySequenceHandler)
|