1 /* 2 * Copyright (C) The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.globalsearch; 18 19 import android.app.SearchManager; 20 import android.content.ComponentName; 21 import android.content.Context; 22 import android.server.search.SearchableInfo; 23 import android.test.AndroidTestCase; 24 import android.test.suitebuilder.annotation.MediumTest; 25 26 /** 27 * Tests for {@link GlobalSearch} 28 */ 29 @MediumTest 30 public class GlobalSearchTest extends AndroidTestCase { 31 32 private static final ComponentName GLOBAL_SEARCH_COMPONENT 33 = new ComponentName("com.android.globalsearch", 34 "com.android.globalsearch.GlobalSearch"); 35 testDefaultSearchable()36 public void testDefaultSearchable() { 37 SearchManager searchManager = (SearchManager) 38 getContext().getSystemService(Context.SEARCH_SERVICE); 39 SearchableInfo si = searchManager.getSearchableInfo(null, true); 40 assertNotNull("No default searchable.", si); 41 assertEquals("GlobalSearch is not the default searchable.", 42 GLOBAL_SEARCH_COMPONENT, si.getSearchActivity()); 43 } 44 45 } 46