face: introduce NullTransport and use it in several places
Refs: #4528
Change-Id: Icc7a77232bca1a700ce1319493c15a85d05d7488
diff --git a/tests/daemon/face/transport.t.cpp b/tests/daemon/face/transport.t.cpp
index 747622e..fbe3ee5 100644
--- a/tests/daemon/face/transport.t.cpp
+++ b/tests/daemon/face/transport.t.cpp
@@ -26,10 +26,10 @@
#include "face/transport.hpp"
#include "face/face.hpp"
+#include "tests/test-common.hpp"
#include "tests/daemon/global-io-fixture.hpp"
#include "dummy-receive-link-service.hpp"
#include "dummy-transport.hpp"
-#include "transport-test-common.hpp"
#include <boost/mpl/fold.hpp>
#include <boost/mpl/int.hpp>
@@ -50,37 +50,10 @@
BOOST_AUTO_TEST_SUITE(Face)
BOOST_AUTO_TEST_SUITE(TestTransport)
-BOOST_AUTO_TEST_CASE(DummyTransportStaticProperties)
-{
- auto transport = make_unique<DummyTransport>();
- checkStaticPropertiesInitialized(*transport);
-}
-
-class PersistencyTestTransport : public DummyTransport
-{
-public:
- PersistencyTestTransport()
- : DummyTransport("dummy://", "dummy://",
- ndn::nfd::FACE_SCOPE_NON_LOCAL,
- ndn::nfd::FACE_PERSISTENCY_ON_DEMAND)
- {
- }
-
-protected:
- void
- afterChangePersistency(ndn::nfd::FacePersistency oldPersistency) final
- {
- persistencyHistory.push_back(oldPersistency);
- }
-
-public:
- std::vector<ndn::nfd::FacePersistency> persistencyHistory;
-};
-
BOOST_AUTO_TEST_CASE(PersistencyChange)
{
- auto transport = make_unique<PersistencyTestTransport>();
- BOOST_CHECK_EQUAL(transport->getPersistency(), ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
+ auto transport = make_unique<DummyTransport>();
+ BOOST_CHECK_EQUAL(transport->getPersistency(), ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
BOOST_CHECK_EQUAL(transport->persistencyHistory.size(), 0);
BOOST_CHECK_EQUAL(transport->canChangePersistencyTo(ndn::nfd::FACE_PERSISTENCY_NONE), false);
@@ -88,13 +61,13 @@
BOOST_REQUIRE_EQUAL(transport->canChangePersistencyTo(ndn::nfd::FACE_PERSISTENCY_PERMANENT), true);
transport->setPersistency(transport->getPersistency());
- BOOST_CHECK_EQUAL(transport->getPersistency(), ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
+ BOOST_CHECK_EQUAL(transport->getPersistency(), ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
BOOST_CHECK_EQUAL(transport->persistencyHistory.size(), 0);
transport->setPersistency(ndn::nfd::FACE_PERSISTENCY_PERMANENT);
BOOST_CHECK_EQUAL(transport->getPersistency(), ndn::nfd::FACE_PERSISTENCY_PERMANENT);
BOOST_REQUIRE_EQUAL(transport->persistencyHistory.size(), 1);
- BOOST_CHECK_EQUAL(transport->persistencyHistory.back(), ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
+ BOOST_CHECK_EQUAL(transport->persistencyHistory.back(), ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
}
/** \brief a macro to declare a TransportState as a integral constant
@@ -205,13 +178,6 @@
}
}
-BOOST_AUTO_TEST_CASE(NoExpirationTime)
-{
- auto transport = make_unique<DummyTransport>();
-
- BOOST_CHECK_EQUAL(transport->getExpirationTime(), time::steady_clock::TimePoint::max());
-}
-
class DummyTransportFixture : public GlobalIoFixture
{
protected:
@@ -225,9 +191,9 @@
}
void
- initialize(unique_ptr<DummyTransport> transport = make_unique<DummyTransport>())
+ initialize(unique_ptr<DummyTransport> t = make_unique<DummyTransport>())
{
- this->face = make_unique<nfd::Face>(make_unique<DummyReceiveLinkService>(), std::move(transport));
+ this->face = make_unique<nfd::Face>(make_unique<DummyReceiveLinkService>(), std::move(t));
this->transport = static_cast<DummyTransport*>(face->getTransport());
this->sentPackets = &this->transport->sentPackets;
this->receivedPackets = &static_cast<DummyReceiveLinkService*>(face->getLinkService())->receivedPackets;