From 624bf3d7f66e496952c5ae8917dc785676921c99 Mon Sep 17 00:00:00 2001 From: Erik Kline Date: Tue, 14 Feb 2017 15:55:00 +0900 Subject: [PATCH] Verify duplicate upstream notifications are ignored Test: as follows - built (bullhead) - flashed - booted - runtest .../tethering/TetherInterfaceStateMachineTest.java passes Bug: 32163131 Change-Id: I3c097d766fe4c416a8e3f02640809fe1199c6ef2 --- .../tethering/TetherInterfaceStateMachineTest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/net/java/com/android/server/connectivity/tethering/TetherInterfaceStateMachineTest.java b/tests/net/java/com/android/server/connectivity/tethering/TetherInterfaceStateMachineTest.java index 2b31eb6bf8250..32e1b96cf798f 100644 --- a/tests/net/java/com/android/server/connectivity/tethering/TetherInterfaceStateMachineTest.java +++ b/tests/net/java/com/android/server/connectivity/tethering/TetherInterfaceStateMachineTest.java @@ -294,6 +294,18 @@ public class TetherInterfaceStateMachineTest { IFACE_NAME, mTestedSm, STATE_AVAILABLE, TETHER_ERROR_ENABLE_NAT_ERROR); } + @Test + public void ignoresDuplicateUpstreamNotifications() throws Exception { + initTetheredStateMachine(TETHERING_WIFI, UPSTREAM_IFACE); + + verifyNoMoreInteractions(mNMService, mStatsService, mTetherHelper); + + for (int i = 0; i < 5; i++) { + dispatchTetherConnectionChanged(UPSTREAM_IFACE); + verifyNoMoreInteractions(mNMService, mStatsService, mTetherHelper); + } + } + /** * Send a command to the state machine under test, and run the event loop to idle. *