Revise firewalld unittests

Previously, unit tests for firewalld in iptables_unittest.cc
were tightly coupled with the implementation of IpTables::ApplyVpnSetup
making them difficult to maintain when changes to the daemon were
introduced. This commit augments the MockIpTables class by mocking
ExecvNonRoot and keeping track of the ip/iptables shell commands that
are issued during a test. This makes it possible to test that error
cases properly handle undo-ing the addition of any firewall rules
that are added during IpTables::ApplyVpnSetup.

BUG=None
TEST=None
Change-Id: Ibfd581ebaad55826d95bdc3b5ad98795610aee9f
Reviewed-on: https://chromium-review.googlesource.com/370862
Commit-Ready: Kevin Cernekee <cernekee@chromium.org>
Tested-by: Ian Wyszynski <wyszynski@google.com>
Reviewed-by: Ian Wyszynski <wyszynski@google.com>
Reviewed-by: Kevin Cernekee <cernekee@chromium.org>
5 files changed