diff options
author | Lorenzo Colitti <lorenzo@google.com> | 2015-04-27 20:32:01 +0900 |
---|---|---|
committer | Lorenzo Colitti <lorenzo@google.com> | 2015-05-02 10:43:31 +0900 |
commit | d46bb58fa635110bf8c911107819e8bd8e8b06e2 (patch) | |
tree | 2d6172bf12d2a3ddd8fd357719e1ed8e7a5076ab /packages/SystemUI/tests | |
parent | b57f236e30d87bdfa69bb99e6b3f5ec6a3cc07c7 (diff) | |
download | frameworks_base-d46bb58fa635110bf8c911107819e8bd8e8b06e2.zip frameworks_base-d46bb58fa635110bf8c911107819e8bd8e8b06e2.tar.gz frameworks_base-d46bb58fa635110bf8c911107819e8bd8e8b06e2.tar.bz2 |
Add a status bar icon for Ethernet.
Bug: 20613953
Change-Id: I52970b4f5fb6429876d1a2eb195a834c9e020021
Diffstat (limited to 'packages/SystemUI/tests')
-rw-r--r-- | packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerEthernetTest.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerEthernetTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerEthernetTest.java new file mode 100644 index 0000000..82ced9f --- /dev/null +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerEthernetTest.java @@ -0,0 +1,40 @@ +package com.android.systemui.statusbar.policy; + +import android.net.NetworkCapabilities; + +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; + +public class NetworkControllerEthernetTest extends NetworkControllerBaseTest { + + public void testEthernetIcons() { + verifyLastEthernetIcon(false, 0); + + setEthernetState(true, false); // Connected, unvalidated. + verifyLastEthernetIcon(true, EthernetIcons.ETHERNET_ICONS[0][0]); + + setEthernetState(true, true); // Connected, validated. + verifyLastEthernetIcon(true, EthernetIcons.ETHERNET_ICONS[1][0]); + + setEthernetState(true, false); // Connected, unvalidated. + verifyLastEthernetIcon(true, EthernetIcons.ETHERNET_ICONS[0][0]); + + setEthernetState(false, false); // Disconnected. + verifyLastEthernetIcon(false, 0); + } + + protected void setEthernetState(boolean connected, boolean validated) { + setConnectivity(validated ? 100 : 0, NetworkCapabilities.TRANSPORT_ETHERNET, connected); + } + + protected void verifyLastEthernetIcon(boolean visible, int icon) { + ArgumentCaptor<Boolean> visibleArg = ArgumentCaptor.forClass(Boolean.class); + ArgumentCaptor<Integer> iconArg = ArgumentCaptor.forClass(Integer.class); + + Mockito.verify(mSignalCluster, Mockito.atLeastOnce()).setEthernetIndicators( + visibleArg.capture(), iconArg.capture(), + ArgumentCaptor.forClass(String.class).capture()); + assertEquals("Ethernet visible, in status bar", visible, (boolean) visibleArg.getValue()); + assertEquals("Ethernet icon, in status bar", icon, (int) iconArg.getValue()); + } +} |