Fix flaky test
Prevents NPE in test by inverting the order of equals. Also, to make the test more independent, set the setting in setup Test: atest QSTileHostTest after deleting the setting Bug: 138516392 Change-Id: I7093cafaecaa6922c4dc07bcbdaed4b5c08aae60
This commit is contained in:
@@ -97,6 +97,8 @@ public class QSTileHostTest extends SysuiTestCase {
|
||||
mLooper.getLooper(),
|
||||
mPluginManager, mTunerService, mAutoTiles, mDumpController);
|
||||
setUpTileFactory();
|
||||
Settings.Secure.putStringForUser(mContext.getContentResolver(), QSTileHost.TILES_SETTING,
|
||||
"", ActivityManager.getCurrentUser());
|
||||
}
|
||||
|
||||
private void setUpTileFactory() {
|
||||
@@ -188,7 +190,8 @@ public class QSTileHostTest extends SysuiTestCase {
|
||||
// changed
|
||||
String newSetting = Settings.Secure.getStringForUser(getContext().getContentResolver(),
|
||||
TILES_SETTING, ActivityManager.getCurrentUser());
|
||||
if (!previousSetting.equals(newSetting)) {
|
||||
// newSetting is not null, as it has just been set.
|
||||
if (!newSetting.equals(previousSetting)) {
|
||||
onTuningChanged(TILES_SETTING, newSetting);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user