aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/usb-snap-test.cpp
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2016-03-17 10:24:41 -0500
committerCharles Kerr <charles.kerr@canonical.com>2016-03-17 10:24:41 -0500
commit5b6008fa3b5a9b0373b2f03791140ca1fa8dc8de (patch)
tree220fe388c073b776a62b4f31741ffe5f5745ee8b /tests/unit/usb-snap-test.cpp
parentc63d90da0f1d9cbd1eee5dd66a9828c51cc8dcc9 (diff)
downloadayatana-indicator-display-5b6008fa3b5a9b0373b2f03791140ca1fa8dc8de.tar.gz
ayatana-indicator-display-5b6008fa3b5a9b0373b2f03791140ca1fa8dc8de.tar.bz2
ayatana-indicator-display-5b6008fa3b5a9b0373b2f03791140ca1fa8dc8de.zip
introduce a QtFixture gtest base class to reduce redundancy in test fixtures' helper/util code
Diffstat (limited to 'tests/unit/usb-snap-test.cpp')
-rw-r--r--tests/unit/usb-snap-test.cpp34
1 files changed, 5 insertions, 29 deletions
diff --git a/tests/unit/usb-snap-test.cpp b/tests/unit/usb-snap-test.cpp
index dc17696..663f9e6 100644
--- a/tests/unit/usb-snap-test.cpp
+++ b/tests/unit/usb-snap-test.cpp
@@ -18,47 +18,24 @@
*/
#define QT_NO_KEYWORDS
-#include <tests/utils/dbus-types.h>
-#include <tests/utils/qdbus-helpers.h>
-#include <tests/utils/glib-fixture.h>
-#include <tests/utils/gtest-qt-print-helpers.h>
+#include <tests/utils/qt-fixture.h>
#include <src/dbus-names.h>
#include <src/usb-snap.h>
-#include <glib.h>
-
#include <libqtdbustest/DBusTestRunner.h>
#include <libqtdbustest/QProcessDBusService.h>
#include <libqtdbusmock/DBusMock.h>
-#include <QSignalSpy>
-
-#include <gtest/gtest.h>
-
-using namespace QtDBusTest;
-using namespace QtDBusMock;
-
-#define WAIT_FOR_SIGNALS(signalSpy, signalsExpected)\
-{\
- while (signalSpy.size() < signalsExpected)\
- {\
- ASSERT_TRUE(signalSpy.wait());\
- }\
- ASSERT_EQ(signalsExpected, signalSpy.size());\
-}
-
-class UsbSnapFixture: public GlibFixture
+class UsbSnapFixture: public QtFixture
{
- using super = GlibFixture;
+ using super = QtFixture;
public:
UsbSnapFixture():
dbusMock{dbusTestRunner}
{
- DBusTypes::registerMetaTypes();
-
dbusTestRunner.startServices();
}
@@ -84,7 +61,6 @@ protected:
QtDBusTest::DBusTestRunner dbusTestRunner;
QtDBusMock::DBusMock dbusMock;
- QtDBusTest::DBusServicePtr indicator;
};
TEST_F(UsbSnapFixture, TestRoundTrip)
@@ -119,7 +95,7 @@ TEST_F(UsbSnapFixture, TestRoundTrip)
});
// test that UsbSnap creates a fdo notification
- WAIT_FOR_SIGNALS(notificationsSpy, 1);
+ wait_for_signals(notificationsSpy, 1);
{
QVariantList const& call(notificationsSpy.at(0));
EXPECT_EQ("Notify", call.at(0));
@@ -157,7 +133,7 @@ TEST_F(UsbSnapFixture, TestRoundTrip)
// confirm that the snap dtor cleans up the notification
snap.reset();
- WAIT_FOR_SIGNALS(notificationsSpy, 1);
+ wait_for_signals(notificationsSpy, 1);
{
QVariantList const& call(notificationsSpy.at(0));
EXPECT_EQ("CloseNotification", call.at(0));