fw: eliminate Forwarder::dispatchToStrategy()

Change-Id: Ia2e58c66548644fe3395f7e8c65e860554484fc8
diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp
index f3f7c63..e3b3a19 100644
--- a/tests/daemon/fw/forwarder.t.cpp
+++ b/tests/daemon/fw/forwarder.t.cpp
@@ -265,55 +265,36 @@
   BOOST_CHECK_EQUAL(faceRemote->sentInterests.size(), 2);
 }
 
-class ScopeLocalhostIncomingTestForwarder : public Forwarder
+BOOST_AUTO_TEST_CASE(ScopeLocalhostIncoming)
 {
-public:
-  using Forwarder::Forwarder;
+  auto face1 = addFace("dummy://", "dummy://", ndn::nfd::FACE_SCOPE_LOCAL);
+  auto face2 = addFace(); // default is non-local
 
-protected:
-  void
-  dispatchToStrategy(pit::Entry&, std::function<void(fw::Strategy&)>) final
-  {
-    ++dispatchToStrategy_count;
-  }
-
-public:
-  int dispatchToStrategy_count = 0;
-};
-
-BOOST_FIXTURE_TEST_CASE(ScopeLocalhostIncoming, GlobalIoTimeFixture)
-{
-  FaceTable faceTable;
-  ScopeLocalhostIncomingTestForwarder forwarder(faceTable);
-
-  auto face1 = make_shared<DummyFace>("dummy://", "dummy://", ndn::nfd::FACE_SCOPE_LOCAL);
-  auto face2 = make_shared<DummyFace>();
-  faceTable.add(face1);
-  faceTable.add(face2);
+  auto& strategy = choose<DummyStrategy>(forwarder, "/", DummyStrategy::getStrategyName());
 
   // local face, /localhost: OK
-  forwarder.dispatchToStrategy_count = 0;
+  strategy.afterReceiveInterest_count = 0;
   auto i1 = makeInterest("/localhost/A1");
   forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *i1);
-  BOOST_CHECK_EQUAL(forwarder.dispatchToStrategy_count, 1);
+  BOOST_CHECK_EQUAL(strategy.afterReceiveInterest_count, 1);
 
   // non-local face, /localhost: violate
-  forwarder.dispatchToStrategy_count = 0;
+  strategy.afterReceiveInterest_count = 0;
   auto i2 = makeInterest("/localhost/A2");
   forwarder.onIncomingInterest(FaceEndpoint(*face2, 0), *i2);
-  BOOST_CHECK_EQUAL(forwarder.dispatchToStrategy_count, 0);
+  BOOST_CHECK_EQUAL(strategy.afterReceiveInterest_count, 0);
 
   // local face, non-/localhost: OK
-  forwarder.dispatchToStrategy_count = 0;
+  strategy.afterReceiveInterest_count = 0;
   auto i3 = makeInterest("/A3");
   forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *i3);
-  BOOST_CHECK_EQUAL(forwarder.dispatchToStrategy_count, 1);
+  BOOST_CHECK_EQUAL(strategy.afterReceiveInterest_count, 1);
 
   // non-local face, non-/localhost: OK
-  forwarder.dispatchToStrategy_count = 0;
+  strategy.afterReceiveInterest_count = 0;
   auto i4 = makeInterest("/A4");
   forwarder.onIncomingInterest(FaceEndpoint(*face2, 0), *i4);
-  BOOST_CHECK_EQUAL(forwarder.dispatchToStrategy_count, 1);
+  BOOST_CHECK_EQUAL(strategy.afterReceiveInterest_count, 1);
 
   BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 0);
 
@@ -322,7 +303,7 @@
   forwarder.onIncomingData(FaceEndpoint(*face1, 0), *d1);
   BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 1);
 
-  // non-local face, /localhost: OK
+  // non-local face, /localhost: violate
   auto d2 = makeData("/localhost/B2");
   forwarder.onIncomingData(FaceEndpoint(*face2, 0), *d2);
   BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 1);
@@ -349,31 +330,31 @@
   auto interest1 = makeInterest("/A/1");
   strategyA.afterReceiveInterest_count = 0;
   strategyA.interestOutFace = face2;
-  forwarder.startProcessInterest(FaceEndpoint(*face1, 0), *interest1);
+  forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *interest1);
   BOOST_CHECK_EQUAL(strategyA.afterReceiveInterest_count, 1);
 
   auto interest2 = makeInterest("/B/2", true);
   strategyB.afterReceiveInterest_count = 0;
   strategyB.interestOutFace = face2;
-  forwarder.startProcessInterest(FaceEndpoint(*face1, 0), *interest2);
+  forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *interest2);
   BOOST_CHECK_EQUAL(strategyB.afterReceiveInterest_count, 1);
 
   this->advanceClocks(1_ms, 5_ms);
 
   auto data1 = makeData("/A/1");
   strategyA.beforeSatisfyInterest_count = 0;
-  forwarder.startProcessData(FaceEndpoint(*face2, 0), *data1);
+  forwarder.onIncomingData(FaceEndpoint(*face2, 0), *data1);
   BOOST_CHECK_EQUAL(strategyA.beforeSatisfyInterest_count, 1);
 
   auto data2 = makeData("/B/2/b");
   strategyB.beforeSatisfyInterest_count = 0;
-  forwarder.startProcessData(FaceEndpoint(*face2, 0), *data2);
+  forwarder.onIncomingData(FaceEndpoint(*face2, 0), *data2);
   BOOST_CHECK_EQUAL(strategyB.beforeSatisfyInterest_count, 1);
 
   auto interest3 = makeInterest("/A/3", false, 30_ms);
-  forwarder.startProcessInterest(FaceEndpoint(*face1, 0), *interest3);
+  forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *interest3);
   auto interest4 = makeInterest("/B/4", false, 5_s);
-  forwarder.startProcessInterest(FaceEndpoint(*face1, 0), *interest4);
+  forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *interest4);
 }
 
 BOOST_AUTO_TEST_CASE(IncomingData)
@@ -682,7 +663,7 @@
   Pit& pit = forwarder.getPit();
   BOOST_REQUIRE_EQUAL(pit.size(), 0);
 
-  forwarder.startProcessInterest(FaceEndpoint(*face1, 0), *interest);
+  forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *interest);
   this->advanceClocks(100_ms, 20_s);
   BOOST_CHECK_EQUAL(pit.size(), 0);
 }