Home | History | Annotate | Download | only in testutils
      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 package com.android.vcard.tests.testutils;
     17 
     18 import android.content.ContentValues;
     19 import android.provider.ContactsContract.Data;
     20 import android.test.AndroidTestCase;
     21 
     22 import com.android.vcard.VCardEntry;
     23 import com.android.vcard.VCardEntryCommitter;
     24 import com.android.vcard.VCardEntryHandler;
     25 
     26 public class ContentValuesVerifierElem {
     27     private final ImportTestResolver mResolver;
     28     private final VCardEntryHandler mHandler;
     29 
     30     public ContentValuesVerifierElem(AndroidTestCase androidTestCase) {
     31         mResolver = new ImportTestResolver(androidTestCase);
     32         mHandler = new VCardEntryCommitter(mResolver);
     33     }
     34 
     35     public ContentValuesBuilder addExpected(String mimeType) {
     36         ContentValues contentValues = new ContentValues();
     37         contentValues.put(Data.MIMETYPE, mimeType);
     38         mResolver.addExpectedContentValues(contentValues);
     39         return new ContentValuesBuilder(contentValues);
     40     }
     41 
     42     public void verifyResolver() {
     43         mResolver.verify();
     44     }
     45 
     46     public void onParsingStart() {
     47         mHandler.onStart();
     48     }
     49 
     50     public void onEntryCreated(VCardEntry entry) {
     51         mHandler.onEntryCreated(entry);
     52     }
     53 
     54     public void onParsingEnd() {
     55         mHandler.onEnd();
     56     }
     57 }
     58