tests: Converting test cases to use UnitTestClock

Change-Id: I3ceaf048cc60f9cdbf98ace43f96d5c81047efd0
diff --git a/tests/unit-tests/management/test-nfd-controller.cpp b/tests/unit-tests/management/test-nfd-controller.cpp
index 98101f3..8555dde 100644
--- a/tests/unit-tests/management/test-nfd-controller.cpp
+++ b/tests/unit-tests/management/test-nfd-controller.cpp
@@ -26,6 +26,7 @@
 
 #include "boost-test.hpp"
 #include "util/dummy-client-face.hpp"
+#include "../unit-test-time-fixture.hpp"
 
 namespace ndn {
 namespace nfd {
@@ -36,11 +37,11 @@
 
 BOOST_AUTO_TEST_SUITE(ManagementTestNfdController)
 
-class CommandFixture
+class CommandFixture : public ndn::tests::UnitTestTimeFixture
 {
 protected:
   CommandFixture()
-    : face(makeDummyClientFace())
+    : face(makeDummyClientFace(io))
     , controller(*face, keyChain)
     , commandSucceedCallback(bind(&CommandFixture::onCommandSucceed, this, _1))
     , commandFailCallback(bind(&CommandFixture::onCommandFail, this, _1, _2))
@@ -83,7 +84,8 @@
                        parameters,
                        commandSucceedCallback,
                        commandFailCallback));
-  face->processEvents(time::milliseconds(1));
+
+  advanceClocks(time::milliseconds(1));
 
   BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
   const Interest& requestInterest = face->sentInterests[0];
@@ -109,7 +111,8 @@
   responseData.setContent(responsePayload.wireEncode());
   keyChain.sign(responseData);
   face->receive(responseData);
-  face->processEvents(time::milliseconds(1));
+
+  advanceClocks(time::milliseconds(1));
 
   BOOST_CHECK_EQUAL(commandFailHistory.size(), 0);
   BOOST_REQUIRE_EQUAL(commandSucceedHistory.size(), 1);
@@ -140,7 +143,7 @@
                          parameters,
                          commandSucceedCallback,
                          commandFailCallback));
-  face->processEvents(time::milliseconds(1));
+  advanceClocks(time::milliseconds(1));
 
   BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
   const Interest& requestInterest = face->sentInterests[0];
@@ -151,7 +154,7 @@
   responseData.setContent(responsePayload.wireEncode());
   keyChain.sign(responseData);
   face->receive(responseData);
-  face->processEvents(time::milliseconds(1));
+  advanceClocks(time::milliseconds(1));
 
   BOOST_CHECK_EQUAL(commandSucceedHistory.size(), 0);
   BOOST_REQUIRE_EQUAL(commandFailHistory.size(), 1);
@@ -167,7 +170,7 @@
                          parameters,
                          commandSucceedCallback,
                          commandFailCallback));
-  face->processEvents(time::milliseconds(1));
+  advanceClocks(time::milliseconds(1));
 
   BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
   const Interest& requestInterest = face->sentInterests[0];
@@ -183,7 +186,7 @@
   responseData.setContent(responsePayload.wireEncode());
   keyChain.sign(responseData);
   face->receive(responseData);
-  face->processEvents(time::milliseconds(1));
+  advanceClocks(time::milliseconds(1));
 
   BOOST_CHECK_EQUAL(commandSucceedHistory.size(), 0);
   BOOST_REQUIRE_EQUAL(commandFailHistory.size(), 1);
@@ -203,7 +206,7 @@
                        commandSucceedCallback,
                        commandFailCallback,
                        options));
-  face->processEvents(time::milliseconds(1));
+  advanceClocks(time::milliseconds(1));
 
   BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
   const Interest& requestInterest = face->sentInterests[0];
@@ -226,7 +229,7 @@
                        commandSucceedCallback,
                        commandFailCallback,
                        options));
-  face->processEvents(time::milliseconds(300));
+  advanceClocks(time::milliseconds(1), 101); // Face's PIT granularity is 100ms
 
   BOOST_REQUIRE_EQUAL(commandFailHistory.size(), 1);
   BOOST_CHECK_EQUAL(commandFailHistory[0].get<0>(), Controller::ERROR_TIMEOUT);