Fix broken dark ui test

It was checking something in shared preferences which seems
to have stopped working (a bunch of the stuff used in the
test is deprecated). This CL just has it verify that
updateDarkTheme() is called when appropriate since that
is all we really care about.

Test: is a test
Bug: 130897882
Change-Id: If3286dd91b5a95cb0f41cac619a11a9089e0aecf
This commit is contained in:
Salvador Martinez
2019-04-23 19:51:23 -07:00
parent f3365e911d
commit b0737ee174
2 changed files with 3 additions and 8 deletions

View File

@@ -16,9 +16,6 @@
package com.android.settings.display;
import static com.android.settings.display.DarkUIPreferenceController.DARK_MODE_PREFS;
import static com.android.settings.display.DarkUIPreferenceController.PREF_DARK_MODE_DIALOG_SEEN;
import android.app.Dialog;
import android.app.UiModeManager;
import android.content.Context;

View File

@@ -26,9 +26,9 @@ import static org.mockito.Mockito.verify;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.provider.Settings;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -50,7 +50,6 @@ public class DarkUIInfoDialogFragmentTest {
}
@Test
@Ignore("b/130897882")
public void dialogDismissedOnConfirmation() {
doReturn(RuntimeEnvironment.application).when(mFragment).getContext();
SharedPreferences prefs = RuntimeEnvironment.application.getSharedPreferences(
@@ -60,8 +59,7 @@ public class DarkUIInfoDialogFragmentTest {
.isFalse();
mFragment.onClick(dialog, DialogInterface.BUTTON_POSITIVE);
verify(dialog, times(1)).dismiss();
assertThat(prefs.getBoolean(DarkUIPreferenceController.PREF_DARK_MODE_DIALOG_SEEN, false))
.isTrue();
assertThat(Settings.Secure.getInt(RuntimeEnvironment.application.getContentResolver(),
Settings.Secure.DARK_MODE_DIALOG_SEEN, -1)).isEqualTo(1);
}
}