Merge "Revert "Support search "Mobile data""" into main

This commit is contained in:
Pechetty Sravani
2024-07-12 09:34:44 +00:00
committed by Android (Google) Code Review
8 changed files with 4 additions and 247 deletions

View File

@@ -29,7 +29,6 @@ import android.database.Cursor;
import android.text.TextUtils;
import com.android.settings.network.NetworkProviderSettings;
import com.android.settings.spa.search.SearchablePage;
import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settings.testutils.FakeIndexProvider;
import com.android.settingslib.search.SearchIndexableData;
@@ -118,10 +117,8 @@ public class SearchIndexableResourcesTest {
public void testAllClassNamesHaveProviders() {
for (SearchIndexableData data :
mSearchProvider.getSearchIndexableResources().getProviderValues()) {
Class<?> targetClass = data.getTargetClass();
if (DatabaseIndexingUtils.getSearchIndexProvider(targetClass) == null
&& !SearchablePage.class.isAssignableFrom(targetClass)) {
fail(targetClass.getName() + " is not an index provider");
if (DatabaseIndexingUtils.getSearchIndexProvider(data.getTargetClass()) == null) {
fail(data.getTargetClass().getName() + "is not an index provider");
}
}
}

View File

@@ -1,51 +0,0 @@
/*
* Copyright (C) 2024 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.spa.search
import android.content.Context
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.android.settings.spa.search.SpaSearchRepository.Companion.createSearchIndexableData
import com.android.settingslib.spa.framework.common.SettingsPageProvider
import com.google.common.truth.Truth.assertThat
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.mock
@RunWith(AndroidJUnit4::class)
class SpaSearchRepositoryTest {
@Test
fun createSearchIndexableData() {
val pageProvider =
object : SettingsPageProvider {
override val name = PAGE_NAME
}
val searchIndexableData = pageProvider.createSearchIndexableData { listOf(TITLE) }
val dynamicRawDataToIndex =
searchIndexableData.searchIndexProvider.getDynamicRawDataToIndex(mock<Context>(), true)
assertThat(searchIndexableData.targetClass).isEqualTo(pageProvider::class.java)
assertThat(dynamicRawDataToIndex).hasSize(1)
assertThat(dynamicRawDataToIndex[0].title).isEqualTo(TITLE)
}
private companion object {
const val PAGE_NAME = "PageName"
const val TITLE = "Title"
}
}