diff options
author | Marja Hassinen <ext-marja.2.hassinen@nokia.com> | 2009-10-27 10:25:00 +0200 |
---|---|---|
committer | Marja Hassinen <ext-marja.2.hassinen@nokia.com> | 2009-10-27 10:25:00 +0200 |
commit | 540cc9f2c56dacee8b40ebf80d2b2fe3bdc4f5d9 (patch) | |
tree | b524c6fa29fba67ea7da54cec450c9e6a435aa60 | |
parent | 64d69dcc588a6e6ea0e193de1caa9041e72f0e35 (diff) |
libcontextprovider, protocol change: Adding customer tests.
-rw-r--r-- | libcontextprovider/customer-tests/service/servicetest.cpp | 40 | ||||
-rw-r--r-- | libcontextprovider/customer-tests/service/servicetest.h | 1 |
2 files changed, 41 insertions, 0 deletions
diff --git a/libcontextprovider/customer-tests/service/servicetest.cpp b/libcontextprovider/customer-tests/service/servicetest.cpp index 534674f5..75587538 100644 --- a/libcontextprovider/customer-tests/service/servicetest.cpp +++ b/libcontextprovider/customer-tests/service/servicetest.cpp @@ -110,6 +110,46 @@ void ServiceTests::startStopStart() delete property; } +void ServiceTests::recreate() +{ + // Check that the initialization went well. + // Doing this only in init() is not enough; doesn't stop the test case. + QVERIFY(clientStarted); + + // Test: create a Service and an associated Property + Service* service = new Service(QDBusConnection::SessionBus, SERVICE_NAME); + Property* property = new Property(*service, "Test.Property"); + + // Test: command client to subscribe + QString actual = writeToClient("subscribe service Test.Property\n"); + + // Expected result: service is started automatically and Subscribe works + QString expected = "Subscribe returned: Unknown"; + QCOMPARE(actual.simplified(), expected.simplified()); + + // Test: delete the property and the service + delete property; + delete service; + + actual = writeToClient("subscribe service Test.Property\n"); + + // Expected result: the client can no more subscribe + expected = "Subscribe error: org.freedesktop.DBus.Error.ServiceUnknown"; + QCOMPARE(actual.simplified(), expected.simplified()); + + // Test: recreate the service and try to subscribe again + service = new Service(QDBusConnection::SessionBus, SERVICE_NAME); + property = new Property(*service, "Test.Property"); + actual = writeToClient("subscribe service Test.Property\n"); + + // Expected result: service is started and Subscribe works + expected = "Subscribe returned: Unknown"; + QCOMPARE(actual.simplified(), expected.simplified()); + + delete service; + delete property; +} + void ServiceTests::readStandardOutput() { isReadyToRead = true; diff --git a/libcontextprovider/customer-tests/service/servicetest.h b/libcontextprovider/customer-tests/service/servicetest.h index 90e2a2e9..fd4ad7a7 100644 --- a/libcontextprovider/customer-tests/service/servicetest.h +++ b/libcontextprovider/customer-tests/service/servicetest.h @@ -18,6 +18,7 @@ private slots: void cleanup(); void startStopStart(); + void recreate(); public slots: void readStandardOutput(); |