From 3dbdc9a9e6153b46c01269c85804609123f1bd7d Mon Sep 17 00:00:00 2001 From: Kurt Pattyn Date: Sun, 26 Jan 2014 01:49:53 +0100 Subject: [PATCH] Move CORS authenticator test to non-private tests QWebSocketCorsAuthenticator is a public class and hence needs to be tested with the public API of QtWebSockets. Change-Id: If3af0744d8901f9c6c13d5fb9061ebf0a5a8d163 Reviewed-by: Frederik Gladhorn --- tests/auto/auto.pro | 6 ++--- .../qwebsocketcorsauthenticator.pro | 13 +++++++++++ .../tst_qwebsocketcorsauthenticator.cpp} | 27 ++++++++-------------- .../websocketcorsauthenticator.pro | 14 ----------- 4 files changed, 26 insertions(+), 34 deletions(-) create mode 100644 tests/auto/qwebsocketcorsauthenticator/qwebsocketcorsauthenticator.pro rename tests/auto/{websocketcorsauthenticator/tst_websocketcorsauthenticator.cpp => qwebsocketcorsauthenticator/tst_qwebsocketcorsauthenticator.cpp} (79%) delete mode 100644 tests/auto/websocketcorsauthenticator/websocketcorsauthenticator.pro diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 2ee1976..c05ce29 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -1,10 +1,10 @@ TEMPLATE = subdirs -#SUBDIRS += +SUBDIRS = \ + qwebsocketcorsauthenticator contains(QT_CONFIG, private_tests): SUBDIRS += \ websocketprotocol \ dataprocessor \ websocketframe \ - handshakerequest \ - websocketcorsauthenticator + handshakerequest diff --git a/tests/auto/qwebsocketcorsauthenticator/qwebsocketcorsauthenticator.pro b/tests/auto/qwebsocketcorsauthenticator/qwebsocketcorsauthenticator.pro new file mode 100644 index 0000000..aa485fc --- /dev/null +++ b/tests/auto/qwebsocketcorsauthenticator/qwebsocketcorsauthenticator.pro @@ -0,0 +1,13 @@ +CONFIG += console +CONFIG += testcase +CONFIG -= app_bundle + +TEMPLATE = app + +TARGET = tst_qwebsocketcorsauthenticator + +QT = core testlib websockets + +SOURCES += tst_qwebsocketcorsauthenticator.cpp + +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/websocketcorsauthenticator/tst_websocketcorsauthenticator.cpp b/tests/auto/qwebsocketcorsauthenticator/tst_qwebsocketcorsauthenticator.cpp similarity index 79% rename from tests/auto/websocketcorsauthenticator/tst_websocketcorsauthenticator.cpp rename to tests/auto/qwebsocketcorsauthenticator/tst_qwebsocketcorsauthenticator.cpp index 7bb44b1..6429ce1 100644 --- a/tests/auto/websocketcorsauthenticator/tst_websocketcorsauthenticator.cpp +++ b/tests/auto/qwebsocketcorsauthenticator/tst_qwebsocketcorsauthenticator.cpp @@ -45,20 +45,15 @@ #include #include "QtWebSockets/qwebsocketcorsauthenticator.h" -#include "QtWebSockets/qwebsocketprotocol.h" -#include "private/qwebsocketprotocol_p.h" QT_USE_NAMESPACE -Q_DECLARE_METATYPE(QWebSocketProtocol::CloseCode) -Q_DECLARE_METATYPE(QWebSocketProtocol::OpCode) - -class tst_WebSocketCorsAuthenticator : public QObject +class tst_QWebSocketCorsAuthenticator : public QObject { Q_OBJECT public: - tst_WebSocketCorsAuthenticator(); + tst_QWebSocketCorsAuthenticator(); private Q_SLOTS: void initTestCase(); @@ -69,27 +64,25 @@ private Q_SLOTS: void tst_initialization(); }; -tst_WebSocketCorsAuthenticator::tst_WebSocketCorsAuthenticator() +tst_QWebSocketCorsAuthenticator::tst_QWebSocketCorsAuthenticator() {} -void tst_WebSocketCorsAuthenticator::initTestCase() +void tst_QWebSocketCorsAuthenticator::initTestCase() { } -void tst_WebSocketCorsAuthenticator::cleanupTestCase() +void tst_QWebSocketCorsAuthenticator::cleanupTestCase() {} -void tst_WebSocketCorsAuthenticator::init() +void tst_QWebSocketCorsAuthenticator::init() { - qRegisterMetaType("QWebSocketProtocol::OpCode"); - qRegisterMetaType("QWebSocketProtocol::CloseCode"); } -void tst_WebSocketCorsAuthenticator::cleanup() +void tst_QWebSocketCorsAuthenticator::cleanup() { } -void tst_WebSocketCorsAuthenticator::tst_initialization() +void tst_QWebSocketCorsAuthenticator::tst_initialization() { { QWebSocketCorsAuthenticator authenticator((QString())); @@ -121,7 +114,7 @@ void tst_WebSocketCorsAuthenticator::tst_initialization() } } -QTEST_MAIN(tst_WebSocketCorsAuthenticator) +QTEST_MAIN(tst_QWebSocketCorsAuthenticator) -#include "tst_websocketcorsauthenticator.moc" +#include "tst_qwebsocketcorsauthenticator.moc" diff --git a/tests/auto/websocketcorsauthenticator/websocketcorsauthenticator.pro b/tests/auto/websocketcorsauthenticator/websocketcorsauthenticator.pro deleted file mode 100644 index dddec22..0000000 --- a/tests/auto/websocketcorsauthenticator/websocketcorsauthenticator.pro +++ /dev/null @@ -1,14 +0,0 @@ -CONFIG += console -CONFIG += testcase -CONFIG -= app_bundle - -TEMPLATE = app - -TARGET = tst_websocketcorsauthenticator - -QT = core testlib websockets websockets-private - -SOURCES += tst_websocketcorsauthenticator.cpp - -requires(contains(QT_CONFIG, private_tests)) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -- 2.7.4