fix DatabaseIndexingManagerTest hanging in tests

Test: make RunSettingsRoboTests -j40
Change-Id: I755c04daadcb8804d97f72521d84573d80b4ff19
This commit is contained in:
jeffreyhuang
2017-12-01 10:14:24 -08:00
parent 7ec34c1781
commit 387bffcd46
2 changed files with 3 additions and 2 deletions

View File

@@ -293,7 +293,8 @@ public class IndexDatabaseHelper extends SQLiteOpenHelper {
} }
static void setBuildIndexed(Context context, String buildNo) { static void setBuildIndexed(Context context, String buildNo) {
context.getSharedPreferences(SHARED_PREFS_TAG, 0).edit().putBoolean(buildNo, true).commit(); // Use #apply() instead of #commit() since #commit() Robolectric loop indefinitely in sdk 26
context.getSharedPreferences(SHARED_PREFS_TAG, 0).edit().putBoolean(buildNo, true).apply();
} }
private void dropTables(SQLiteDatabase db) { private void dropTables(SQLiteDatabase db) {

View File

@@ -70,7 +70,7 @@ import java.util.Set;
@RunWith(SettingsRobolectricTestRunner.class) @RunWith(SettingsRobolectricTestRunner.class)
@Config( @Config(
manifest = TestConfig.MANIFEST_PATH, manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION, sdk = TestConfig.SDK_VERSION_O,
shadows = { shadows = {
ShadowRunnableAsyncTask.class, ShadowRunnableAsyncTask.class,
} }