route: Refresh FIB entries independently of routing table calculation

refs: #2778

Change-Id: I3536faa9c097152bfb99ebc0270221ca359cba35
diff --git a/tests/test-fib-entry.cpp b/tests/test-fib-entry.cpp
index cabda0b..e8846ad 100644
--- a/tests/test-fib-entry.cpp
+++ b/tests/test-fib-entry.cpp
@@ -33,13 +33,10 @@
 
 BOOST_AUTO_TEST_CASE(FibEntryConstructorAndGetters)
 {
-  ndn::time::system_clock::TimePoint testTimePoint =  ndn::time::system_clock::now();
   FibEntry fe1("next1");
-  fe1.setExpirationTimePoint(testTimePoint);
 
   BOOST_CHECK_EQUAL(fe1.getName(), "next1");
-  BOOST_CHECK_EQUAL(fe1.getExpirationTimePoint(), testTimePoint);
-  BOOST_CHECK_EQUAL(fe1.getSeqNo(), 0);           //Default Seq No.
+  BOOST_CHECK_EQUAL(fe1.getSeqNo(), 1);  // Initial Seq No.
 }
 
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/test-fib.cpp b/tests/test-fib.cpp
index 790a42c..4b2229a 100644
--- a/tests/test-fib.cpp
+++ b/tests/test-fib.cpp
@@ -34,7 +34,7 @@
 
 using std::shared_ptr;
 
-class FibFixture : public BaseFixture
+class FibFixture : public UnitTestTimeFixture
 {
 public:
   FibFixture()
@@ -107,8 +107,8 @@
   hops.addNextHop(hop1);
   hops.addNextHop(hop2);
 
-  fib->update("/ndn/name", hops);
-  face->processEvents(ndn::time::milliseconds(1));
+  fib->processUpdate("/ndn/name", hops);
+  face->processEvents(ndn::time::milliseconds(-1));
 
   // Should register faces 1 and 2 for /ndn/name
   BOOST_REQUIRE_EQUAL(interests.size(), 2);
@@ -141,14 +141,14 @@
   oldHops.addNextHop(hop1);
   oldHops.addNextHop(hop2);
 
-  fib->update("/ndn/name", oldHops);
-  face->processEvents(ndn::time::milliseconds(1));
+  fib->processUpdate("/ndn/name", oldHops);
+  face->processEvents(ndn::time::milliseconds(-1));
 
   BOOST_REQUIRE_EQUAL(interests.size(), 2);
   interests.clear();
 
-  fib->update("/ndn/name", oldHops);
-  face->processEvents(ndn::time::milliseconds(1));
+  fib->processUpdate("/ndn/name", oldHops);
+  face->processEvents(ndn::time::milliseconds(-1));
 
   // Should register face 1 and 2 for /ndn/name
   BOOST_REQUIRE_EQUAL(interests.size(), 2);
@@ -180,16 +180,16 @@
   oldHops.addNextHop(hop1);
   oldHops.addNextHop(hop2);
 
-  fib->update("/ndn/name", oldHops);
-  face->processEvents(ndn::time::milliseconds(1));
+  fib->processUpdate("/ndn/name", oldHops);
+  face->processEvents(ndn::time::milliseconds(-1));
 
   BOOST_REQUIRE_EQUAL(interests.size(), 2);
   interests.clear();
 
   NexthopList empty;
 
-  fib->update("/ndn/name", empty);
-  face->processEvents(ndn::time::milliseconds(1));
+  fib->processUpdate("/ndn/name", empty);
+  face->processEvents(ndn::time::milliseconds(-1));
 
   // Should unregister faces 1 and 2 for /ndn/name
   BOOST_CHECK_EQUAL(interests.size(), 2);
@@ -223,8 +223,8 @@
   hops.addNextHop(hop2);
   hops.addNextHop(hop3);
 
-  fib->update("/ndn/name", hops);
-  face->processEvents(ndn::time::milliseconds(1));
+  fib->processUpdate("/ndn/name", hops);
+  face->processEvents(ndn::time::milliseconds(-1));
 
   // Should only register faces 1 and 2 for /ndn/name
   BOOST_CHECK_EQUAL(interests.size(), 2);
@@ -256,8 +256,8 @@
   hops.addNextHop(hop1);
   hops.addNextHop(hop2);
 
-  fib->update("/ndn/name", hops);
-  face->processEvents(ndn::time::milliseconds(1));
+  fib->processUpdate("/ndn/name", hops);
+  face->processEvents(ndn::time::milliseconds(-1));
 
   // FIB
   // Name        NextHops
@@ -269,8 +269,8 @@
   NextHop hop3(router3FaceUri, 5);
   hops.addNextHop(hop3);
 
-  fib->update("/ndn/name", hops);
-  face->processEvents(ndn::time::milliseconds(1));
+  fib->processUpdate("/ndn/name", hops);
+  face->processEvents(ndn::time::milliseconds(-1));
 
   // To maintain a max 2 face requirement, face 3 should be registered and face 2 should be
   // unregistered. Face 1 will also be re-registered.
@@ -306,6 +306,20 @@
               verb == ndn::Name::Component("unregister"));
 }
 
+BOOST_FIXTURE_TEST_CASE(ScheduleFibEntryRefresh, FibFixture)
+{
+  ndn::Name name1("/name/1");
+  FibEntry fe(name1);
+  fib->m_table.emplace(name1, fe);
+  int origSeqNo = fe.getSeqNo();
+
+  fib->scheduleEntryRefresh(fe,
+                            [&, this] (FibEntry& entry) {
+                              BOOST_CHECK_EQUAL(origSeqNo+1, entry.getSeqNo());
+                            });
+  this->advanceClocks(ndn::time::milliseconds(10), 1);
+}
+
 BOOST_AUTO_TEST_SUITE_END()
 
 } // namespace test