Add a class to properly manage ethernet test interfaces
Tun/tap interfaces are difficult to use in combination with
EthernetManager#setIncludeTestInterfaces(). For one, the test must
ensure that the ethernet service has fully unregistered the interface
before calling setIncludeTestInterfaces(false) at the end of the test.
Otherwise, test setup of the next test might race with interface tear
down processing.
In order to make the correct use of tun/tap interfaces in ethernet
service easier, this class encapsulates the appropriate calls to
setIncludeTestInterfaces() and synchronizes interface creation and
deletion with processing in ethernet service by listening to the
respective callbacks.
Note that tests that do not register their interfaces with ethernet
service could technically still race with tests that do, though setUp()
unlikely to win.
Test: mm
Change-Id: I048512a1e4eef17a6f02d46b8b9f7a16210e3271
1 file changed