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.database.Cursor; 20 import android.net.Uri; 21 import android.test.AndroidTestCase; 22 import android.test.suitebuilder.annotation.MediumTest; 23 24 /** 25 * Tests for {@link SuggestionProvider} 26 */ 27 @MediumTest 28 public class SuggestionProviderTest extends AndroidTestCase { 29 30 private static final String URI_PREFIX = 31 "content://com.android.globalsearch.SuggestionProvider/search_suggest_query/"; 32 testZeroQuery()33 public void testZeroQuery() { 34 Uri uri = Uri.parse(URI_PREFIX); 35 Cursor cursor = getContext().getContentResolver().query(uri, null, null, null, null); 36 assertNotNull(cursor); 37 } 38 testShortQuery()39 public void testShortQuery() { 40 Uri uri = Uri.parse(URI_PREFIX + "a"); 41 Cursor cursor = getContext().getContentResolver().query(uri, null, null, null, null); 42 assertNotNull(cursor); 43 } 44 testLongQuery()45 public void testLongQuery() { 46 Uri uri = Uri.parse(URI_PREFIX + "android"); 47 Cursor cursor = getContext().getContentResolver().query(uri, null, null, null, null); 48 assertNotNull(cursor); 49 } 50 51 } 52