Do not block UI when this page didn't have slice

This CL before, if controller have UIBlocker interface
will going to blocker condition to make whole page
invisible for a certain time until slice is fully loaded.

This CL add the check condition that if the controller
have UIBlocker inferface but didn't have slice uri will
not go to blocker condition.

Bug: 141292712
Test: make -j42 RunSettingsRoboTests ROBOTEST_FILTER=DashboardFragmentTest
Change-Id: I79daae131654f8fd823a9c8f1be46ad6c7921908
This commit is contained in:
hughchen
2019-09-24 10:30:49 +08:00
parent c6ef1edddc
commit d49de61f96
2 changed files with 27 additions and 11 deletions

View File

@@ -31,6 +31,7 @@ import static org.mockito.Mockito.when;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.net.Uri;
import android.os.Bundle;
import androidx.preference.Preference;
@@ -240,14 +241,28 @@ public class DashboardFragmentTest {
}
@Test
public void checkUiBlocker_hasUiBlocker_controllerNotNull() {
public void checkUiBlocker_hasUiBlockerAndControllerIsAvailable_controllerNotNull() {
final BlockingSlicePrefController controller =
new BlockingSlicePrefController(mContext, "pref_key");
controller.setSliceUri(Uri.parse("testUri"));
mTestFragment.mBlockerController = null;
mControllers.add(new TestPreferenceController(mContext));
mControllers.add(controller);
mTestFragment.checkUiBlocker(mControllers);
assertThat(mTestFragment.mBlockerController).isNotNull();
}
@Test
public void checkUiBlocker_hasUiBlockerAndControllerIsNotAvailable_controllerIsNull() {
mTestFragment.mBlockerController = null;
mControllers.add(new TestPreferenceController(mContext));
mControllers.add(new BlockingSlicePrefController(mContext, "pref_key"));
mTestFragment.checkUiBlocker(mControllers);
assertThat(mTestFragment.mBlockerController).isNotNull();
assertThat(mTestFragment.mBlockerController).isNull();
}
public static class TestPreferenceController extends AbstractPreferenceController