ContactsLatency.java revision 02d897ec26d81fa1f3cb9e1b8f05c6bcb5d7b9db
1/* 2 * Copyright (C) 2009 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 17package com.android.quicksearchbox.benchmarks; 18 19import android.content.ComponentName; 20 21/* 22 23To build and run: 24 25mmm packages/apps/QuickSearchBox/benchmarks \ 26&& adb install -r $OUT/data/app/QuickSearchBoxBenchmarks.apk \ 27&& sleep 10 \ 28&& adb shell am start -a android.intent.action.MAIN \ 29 -n com.android.quicksearchbox.benchmarks/.ContactsLatency \ 30&& adb logcat 31 32*/ 33 34public class ContactsLatency extends SourceLatency { 35 36 private static final String[] queries = { "", "a", "s", "e", "r", "pub", "sanxjkashasrxae" }; 37 38 private static ComponentName CONTACTS_COMPONENT = 39 new ComponentName("com.android.contacts", 40 "com.android.contacts.ContactsListActivity"); 41 42 @Override 43 protected void onResume() { 44 super.onResume(); 45 46 testContacts(); 47 } 48 49 private void testContacts() { 50 for (String query : queries) { 51 checkSource("CONTACTS", CONTACTS_COMPONENT, query); 52 } 53 } 54 55} 56