[Wi-Fi] Use getUriHelpString() result to judge if Settings APP should register the help button click event and file related intent if need.

The Openroaming help button should show only when the getHelpUriString() value is not null, and need to handle the click event in Settings APP.

Bug: 146669261
Test: Adjust unit test cases:
      1. make RunSettingsRoboTests ROBOTEST_FILTER=WifiEntryPreferenceTest
      2. make RunSettingsRoboTests ROBOTEST_FILTER=WifiSettings2Test
Change-Id: I27a717c3014b01cc464908bac56f64bd08aa5da3
This commit is contained in:
govenliu
2020-04-06 20:45:44 +08:00
parent 9266fe32f7
commit a82d2c8a88
3 changed files with 11 additions and 13 deletions

View File

@@ -74,6 +74,7 @@ import org.robolectric.shadows.ShadowToast;
public class WifiSettings2Test {
private static final int NUM_NETWORKS = 4;
private static final String FAKE_URI_STRING = "fakeuri";
@Mock
private PowerManager mPowerManager;
@@ -281,10 +282,12 @@ public class WifiSettings2Test {
@Test
public void openSubscriptionHelpPage_shouldCallStartActivityForResult() {
doReturn(new Intent()).when(mWifiSettings2).getHelpIntent(mContext);
doReturn(new Intent()).when(mWifiSettings2).getHelpIntent(mContext, FAKE_URI_STRING);
doNothing().when(mWifiSettings2).startActivityForResult(any(Intent.class), anyInt());
final WifiEntry mockWifiEntry = mock(WifiEntry.class);
when(mockWifiEntry.getHelpUriString()).thenReturn(FAKE_URI_STRING);
mWifiSettings2.openSubscriptionHelpPage();
mWifiSettings2.openSubscriptionHelpPage(mockWifiEntry);
verify(mWifiSettings2, times(1)).startActivityForResult(any(), anyInt());
}