Merge "Fix search non-indexable update"

This commit is contained in:
TreeHugger Robot
2018-02-28 02:09:21 +00:00
committed by Android (Google) Code Review
7 changed files with 89 additions and 14 deletions

View File

@@ -0,0 +1,32 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.core;
import android.content.Context;
public class BadPreferenceController extends BasePreferenceController {
public BadPreferenceController(Context context, String preferenceKey) {
super(context, preferenceKey);
throw new IllegalArgumentException("error");
}
@Override
public int getAvailabilityStatus() {
return AVAILABLE;
}
}

View File

@@ -59,6 +59,17 @@ public class PreferenceControllerListHelperTest {
}
}
@Test
@Config(qualifiers = "mcc998")
public void getControllers_partialFailure_shouldReturnTheRest() {
final List<BasePreferenceController> controllers =
PreferenceControllerListHelper.getPreferenceControllersFromXml(mContext,
R.xml.location_settings);
assertThat(controllers).hasSize(1);
assertThat(controllers.get(0)).isInstanceOf(FakePreferenceController.class);
}
@Test
public void filterControllers_noFilter_shouldReturnSameList() {
final List<BasePreferenceController> controllers = new ArrayList<>();