Search in sources :

Example 11 with Searchables

use of com.android.server.search.Searchables in project android_frameworks_base by DirtyUnicorns.

the class SearchablesTest method testNonSearchable.

/*
     * SearchableInfo tests
     *  Mock the context so I can provide very specific input data
     *  Confirm OK with "zero" searchables
     *  Confirm "good" metadata read properly
     *  Confirm "bad" metadata skipped properly
     *  Confirm ordering of searchables
     *  Confirm "good" actionkeys
     *  confirm "bad" actionkeys are rejected
     *  confirm XML ordering enforced (will fail today - bug in SearchableInfo)
     *  findActionKey works
     *  getIcon works
     */
/**
     * Test that non-searchable activities return no searchable info (this would typically
     * trigger the use of the default searchable e.g. contacts)
     */
public void testNonSearchable() {
    // test basic array & hashmap
    Searchables searchables = new Searchables(mContext, 0);
    searchables.updateSearchableList();
    // confirm that we return null for non-searchy activities
    ComponentName nonActivity = new ComponentName("com.android.frameworks.coretests", "com.android.frameworks.coretests.activity.NO_SEARCH_ACTIVITY");
    SearchableInfo si = searchables.getSearchableInfo(nonActivity);
    assertNull(si);
}
Also used : SearchableInfo(android.app.SearchableInfo) Searchables(com.android.server.search.Searchables) ComponentName(android.content.ComponentName)

Example 12 with Searchables

use of com.android.server.search.Searchables in project android_frameworks_base by DirtyUnicorns.

the class SearchablesTest method testSearchablesListEmpty.

/**
     * This round of tests confirms good operations with "zero" searchables found
     */
public void testSearchablesListEmpty() {
    MyMockPackageManager mockPM = new MyMockPackageManager(mContext.getPackageManager());
    MyMockContext mockContext = new MyMockContext(mContext, mockPM);
    mockPM.setSearchablesMode(MyMockPackageManager.SEARCHABLES_MOCK_ZERO);
    Searchables searchables = new Searchables(mockContext, 0);
    searchables.updateSearchableList();
    ArrayList<SearchableInfo> searchablesList = searchables.getSearchablesList();
    assertNotNull(searchablesList);
    MoreAsserts.assertEmpty(searchablesList);
    ArrayList<SearchableInfo> global = searchables.getSearchablesInGlobalSearchList();
    MoreAsserts.assertEmpty(global);
}
Also used : SearchableInfo(android.app.SearchableInfo) Searchables(com.android.server.search.Searchables)

Example 13 with Searchables

use of com.android.server.search.Searchables in project android_frameworks_base by ResurrectionRemix.

the class SearchablesTest method testNonSearchable.

/*
     * SearchableInfo tests
     *  Mock the context so I can provide very specific input data
     *  Confirm OK with "zero" searchables
     *  Confirm "good" metadata read properly
     *  Confirm "bad" metadata skipped properly
     *  Confirm ordering of searchables
     *  Confirm "good" actionkeys
     *  confirm "bad" actionkeys are rejected
     *  confirm XML ordering enforced (will fail today - bug in SearchableInfo)
     *  findActionKey works
     *  getIcon works
     */
/**
     * Test that non-searchable activities return no searchable info (this would typically
     * trigger the use of the default searchable e.g. contacts)
     */
public void testNonSearchable() {
    // test basic array & hashmap
    Searchables searchables = new Searchables(mContext, 0);
    searchables.updateSearchableList();
    // confirm that we return null for non-searchy activities
    ComponentName nonActivity = new ComponentName("com.android.frameworks.coretests", "com.android.frameworks.coretests.activity.NO_SEARCH_ACTIVITY");
    SearchableInfo si = searchables.getSearchableInfo(nonActivity);
    assertNull(si);
}
Also used : SearchableInfo(android.app.SearchableInfo) Searchables(com.android.server.search.Searchables) ComponentName(android.content.ComponentName)

Example 14 with Searchables

use of com.android.server.search.Searchables in project android_frameworks_base by ResurrectionRemix.

the class SearchablesTest method testSearchablesListEmpty.

/**
     * This round of tests confirms good operations with "zero" searchables found
     */
public void testSearchablesListEmpty() {
    MyMockPackageManager mockPM = new MyMockPackageManager(mContext.getPackageManager());
    MyMockContext mockContext = new MyMockContext(mContext, mockPM);
    mockPM.setSearchablesMode(MyMockPackageManager.SEARCHABLES_MOCK_ZERO);
    Searchables searchables = new Searchables(mockContext, 0);
    searchables.updateSearchableList();
    ArrayList<SearchableInfo> searchablesList = searchables.getSearchablesList();
    assertNotNull(searchablesList);
    MoreAsserts.assertEmpty(searchablesList);
    ArrayList<SearchableInfo> global = searchables.getSearchablesInGlobalSearchList();
    MoreAsserts.assertEmpty(global);
}
Also used : SearchableInfo(android.app.SearchableInfo) Searchables(com.android.server.search.Searchables)

Example 15 with Searchables

use of com.android.server.search.Searchables in project android_frameworks_base by crdroidandroid.

the class SearchablesTest method testNonSearchable.

/*
     * SearchableInfo tests
     *  Mock the context so I can provide very specific input data
     *  Confirm OK with "zero" searchables
     *  Confirm "good" metadata read properly
     *  Confirm "bad" metadata skipped properly
     *  Confirm ordering of searchables
     *  Confirm "good" actionkeys
     *  confirm "bad" actionkeys are rejected
     *  confirm XML ordering enforced (will fail today - bug in SearchableInfo)
     *  findActionKey works
     *  getIcon works
     */
/**
     * Test that non-searchable activities return no searchable info (this would typically
     * trigger the use of the default searchable e.g. contacts)
     */
public void testNonSearchable() {
    // test basic array & hashmap
    Searchables searchables = new Searchables(mContext, 0);
    searchables.updateSearchableList();
    // confirm that we return null for non-searchy activities
    ComponentName nonActivity = new ComponentName("com.android.frameworks.coretests", "com.android.frameworks.coretests.activity.NO_SEARCH_ACTIVITY");
    SearchableInfo si = searchables.getSearchableInfo(nonActivity);
    assertNull(si);
}
Also used : SearchableInfo(android.app.SearchableInfo) Searchables(com.android.server.search.Searchables) ComponentName(android.content.ComponentName)

Aggregations

SearchableInfo (android.app.SearchableInfo)15 Searchables (com.android.server.search.Searchables)15 ComponentName (android.content.ComponentName)5