Add a rudimentary unit test for BandwidthController.

Bug: 26685616
Bug: 27506285
Change-Id: I4457abd43697a0425f167b81c1432d743800abb8
diff --git a/server/BandwidthController.cpp b/server/BandwidthController.cpp
index 1115cbc..2f129ab 100644
--- a/server/BandwidthController.cpp
+++ b/server/BandwidthController.cpp
@@ -60,6 +60,9 @@
 const char* BandwidthController::LOCAL_RAW_PREROUTING = "bw_raw_PREROUTING";
 const char* BandwidthController::LOCAL_MANGLE_POSTROUTING = "bw_mangle_POSTROUTING";
 
+auto BandwidthController::execFunction = android_fork_execvp;
+auto BandwidthController::popenFunction = popen;
+
 namespace {
 
 const char ALERT_GLOBAL_NAME[] = "globalAlert";
@@ -235,7 +238,7 @@
     }
 
     argv[argc] = NULL;
-    res = android_fork_execvp(argc, (char **)argv, &status, false,
+    res = execFunction(argc, (char **)argv, &status, false,
             failureHandling == IptFailShow);
     res = res || !WIFEXITED(status) || WEXITSTATUS(status);
     if (res && failureHandling == IptFailShow) {
@@ -1218,7 +1221,7 @@
     fullCmd = IPTABLES_PATH;
     fullCmd += " -nvx -w -L ";
     fullCmd += NatController::LOCAL_TETHER_COUNTERS_CHAIN;
-    iptOutput = popen(fullCmd.c_str(), "r");
+    iptOutput = popenFunction(fullCmd.c_str(), "r");
     if (!iptOutput) {
             ALOGE("Failed to run %s err=%s", fullCmd.c_str(), strerror(errno));
             extraProcessingInfo += "Failed to run iptables.";
@@ -1238,7 +1241,7 @@
     /* Only lookup ip4 table names as ip6 will have the same tables ... */
     fullCmd = IPTABLES_PATH;
     fullCmd += " -w -S";
-    iptOutput = popen(fullCmd.c_str(), "r");
+    iptOutput = popenFunction(fullCmd.c_str(), "r");
     if (!iptOutput) {
             ALOGE("Failed to run %s err=%s", fullCmd.c_str(), strerror(errno));
         return;