diff --git a/res/layout/wifi_dpp_add_device_fragment.xml b/res/layout/wifi_dpp_add_device_fragment.xml new file mode 100644 index 00000000000..03add625733 --- /dev/null +++ b/res/layout/wifi_dpp_add_device_fragment.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + diff --git a/res/layout/wifi_dpp_choose_saved_wifi_network_fragment.xml b/res/layout/wifi_dpp_choose_saved_wifi_network_fragment.xml new file mode 100644 index 00000000000..a65cf3e99f6 --- /dev/null +++ b/res/layout/wifi_dpp_choose_saved_wifi_network_fragment.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + diff --git a/res/layout/wifi_dpp_qrcode_generator_fragment.xml b/res/layout/wifi_dpp_qrcode_generator_fragment.xml new file mode 100644 index 00000000000..789b3a3a42a --- /dev/null +++ b/res/layout/wifi_dpp_qrcode_generator_fragment.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/res/layout/wifi_dpp_qrcode_scanner_fragment.xml b/res/layout/wifi_dpp_qrcode_scanner_fragment.xml index 130bb6d847b..a864f511e93 100644 --- a/res/layout/wifi_dpp_qrcode_scanner_fragment.xml +++ b/res/layout/wifi_dpp_qrcode_scanner_fragment.xml @@ -17,7 +17,6 @@ (WifiDppConfiguratorActivity.class); @Test - public void testLaunchModeQrCodeScanner_shouldNotAutoFinish() { + public void launchActivity_modeQrCodeScanner_shouldNotAutoFinish() { Intent intent = new Intent(); intent.putExtra(WifiDppConfiguratorActivity.EXTRA_LAUNCH_MODE, WifiDppConfiguratorActivity.LaunchMode.LAUNCH_MODE_QR_CODE_SCANNER.getMode()); mActivityRule.launchActivity(intent); assertThat(mActivityRule.getActivity().isFinishing()).isEqualTo(false); - mActivityRule.finishActivity(); } @Test - public void testNoLaunchMode_shouldFinishActivityWithResultCodeCanceled() { + public void launchActivity_modeQrCodeGenerator_shouldNotAutoFinish() { + Intent intent = new Intent(); + intent.putExtra(WifiDppConfiguratorActivity.EXTRA_LAUNCH_MODE, + WifiDppConfiguratorActivity.LaunchMode.LAUNCH_MODE_QR_CODE_GENERATOR.getMode()); + mActivityRule.launchActivity(intent); + + assertThat(mActivityRule.getActivity().isFinishing()).isEqualTo(false); + } + + @Test + public void launchActivity_modeChooseSavedWifiNetwork_shouldNotAutoFinish() { + Intent intent = new Intent(); + intent.putExtra(WifiDppConfiguratorActivity.EXTRA_LAUNCH_MODE, + WifiDppConfiguratorActivity.LaunchMode + .LAUNCH_MODE_CHOOSE_SAVED_WIFI_NETWORK.getMode()); + mActivityRule.launchActivity(intent); + + assertThat(mActivityRule.getActivity().isFinishing()).isEqualTo(false); + } + + @Test + public void launchActivity_noLaunchMode_shouldFinishActivityWithResultCodeCanceled() { // If we do not specify launch mode, the activity will finish itself right away Intent intent = new Intent(); mActivityRule.launchActivity(intent); diff --git a/tests/unit/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragmentTest.java b/tests/unit/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragmentTest.java index 58fa61fcf6f..0f4bfd9e6b4 100644 --- a/tests/unit/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragmentTest.java +++ b/tests/unit/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragmentTest.java @@ -47,8 +47,9 @@ public class WifiDppQrCodeScannerFragmentTest { } @Test - public void testLeftButton_shouldFinishActivityWithResultCodeCanceled() { + public void leftButton_shouldFinishActivityWithResultCodeCanceled() { onView(withText("Cancel")).perform(click()); + assertThat(mActivityRule.getActivityResult().getResultCode()). isEqualTo(Activity.RESULT_CANCELED); }