1fbb876392608a36ec1d23704f29d8b46d5d23991Daniel Lehmann/* 2fbb876392608a36ec1d23704f29d8b46d5d23991Daniel Lehmann * Copyright (C) 2010 The Android Open Source Project 3fbb876392608a36ec1d23704f29d8b46d5d23991Daniel Lehmann * 4fbb876392608a36ec1d23704f29d8b46d5d23991Daniel Lehmann * Licensed under the Apache License, Version 2.0 (the "License"); 5fbb876392608a36ec1d23704f29d8b46d5d23991Daniel Lehmann * you may not use this file except in compliance with the License. 6fbb876392608a36ec1d23704f29d8b46d5d23991Daniel Lehmann * You may obtain a copy of the License at 7fbb876392608a36ec1d23704f29d8b46d5d23991Daniel Lehmann * 8fbb876392608a36ec1d23704f29d8b46d5d23991Daniel Lehmann * http://www.apache.org/licenses/LICENSE-2.0 9fbb876392608a36ec1d23704f29d8b46d5d23991Daniel Lehmann * 10fbb876392608a36ec1d23704f29d8b46d5d23991Daniel Lehmann * Unless required by applicable law or agreed to in writing, software 11fbb876392608a36ec1d23704f29d8b46d5d23991Daniel Lehmann * distributed under the License is distributed on an "AS IS" BASIS, 12fbb876392608a36ec1d23704f29d8b46d5d23991Daniel Lehmann * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13fbb876392608a36ec1d23704f29d8b46d5d23991Daniel Lehmann * See the License for the specific language governing permissions and 14fbb876392608a36ec1d23704f29d8b46d5d23991Daniel Lehmann * limitations under the License. 15fbb876392608a36ec1d23704f29d8b46d5d23991Daniel Lehmann */ 16fbb876392608a36ec1d23704f29d8b46d5d23991Daniel Lehmann 1774a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmannpackage com.android.contacts; 1874a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann 19e0b2f1e2d01d1ac52ba207dc7ce76971d853298eChiao Chengimport android.test.ActivityUnitTestCase; 20e0b2f1e2d01d1ac52ba207dc7ce76971d853298eChiao Chengimport android.test.suitebuilder.annotation.SmallTest; 21e0b2f1e2d01d1ac52ba207dc7ce76971d853298eChiao Cheng 2274a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmannimport com.android.contacts.activities.ContactDetailActivity; 2334793c436c1f95a1c57b1227466fd929e5d64e17Chiao Chengimport com.android.contacts.common.test.mocks.ContactsMockContext; 2434793c436c1f95a1c57b1227466fd929e5d64e17Chiao Chengimport com.android.contacts.common.test.mocks.MockContentProvider; 2574a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann 26ac1bc8c58ba9d03ff5a24d1094f663042b7164d9Makoto Onuki@SmallTest 2774a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmannpublic class ContactDetailTest extends ActivityUnitTestCase<ContactDetailActivity> { 2874a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann private ContactsMockContext mContext; 2974a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann private MockContentProvider mContactsProvider; 3074a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann 3174a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann public ContactDetailTest() { 3274a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann super(ContactDetailActivity.class); 3374a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann } 3474a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann 3574a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann @Override 3674a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann protected void setUp() throws Exception { 3774a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann super.setUp(); 3874a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann mContext = new ContactsMockContext(getInstrumentation().getTargetContext()); 3974a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann mContactsProvider = mContext.getContactsProvider(); 4074a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann setActivityContext(mContext); 4174a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann } 4274a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann 4374a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann @Override 4474a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann protected void tearDown() throws Exception { 4574a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann super.tearDown(); 4674a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann } 4774a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann 4874a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann// public void testFoo() { 4974a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann// // Use lookup-style Uris that also contain the Contact-ID 5074a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann// //long rawContactId1 = mCreator.createRawContact("JohnDoe", "John", "Doe"); 5174a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann// //long contactId1 = mCreator.getContactIdByRawContactId(rawContactId1); 5274a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann// //Uri contactUri1 = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId1); 5374a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann// Intent intent = new Intent(Intent.ACTION_VIEW, 5474a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann// ContentUris.withAppendedId(Contacts.CONTENT_URI, 123)); 5574a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann// startActivity(intent, null, null); 5674a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann// ContactDetailActivity activity = getActivity(); 5774a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann// mContactsProvider.verify(); 5874a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann// } 5974a2dc5dd353aa724f3b4bcfc4694f15c4d0ff73Daniel Lehmann} 60