2 * Copyright (C) 2009 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package android.pim.vcard.test_utils;
18 import android.content.ContentValues;
19 import android.pim.vcard.VCardConfig;
20 import android.test.AndroidTestCase;
23 * BaseClass for vCard unit tests with utility classes.
24 * Please do not add each unit test here.
26 public class VCardTestsBase extends AndroidTestCase {
27 public static final int V21 = VCardConfig.VCARD_TYPE_V21_GENERIC;
28 public static final int V30 = VCardConfig.VCARD_TYPE_V30_GENERIC;
29 public static final int V40 = VCardConfig.VCARD_TYPE_V40_GENERIC;
31 // Do not modify these during tests.
32 protected final ContentValues mContentValuesForQP;
33 protected final ContentValues mContentValuesForSJis;
34 protected final ContentValues mContentValuesForUtf8;
35 protected final ContentValues mContentValuesForQPAndSJis;
36 protected final ContentValues mContentValuesForQPAndUtf8;
37 protected final ContentValues mContentValuesForBase64V21;
38 protected final ContentValues mContentValuesForBase64V30;
40 protected VCardVerifier mVerifier;
41 private boolean mSkipVerification;
43 public VCardTestsBase() {
45 // Not using constants in vCard code since it may be wrong.
46 mContentValuesForQP = new ContentValues();
47 mContentValuesForQP.put("ENCODING", "QUOTED-PRINTABLE");
48 mContentValuesForSJis = new ContentValues();
49 mContentValuesForSJis.put("CHARSET", "SHIFT_JIS");
50 mContentValuesForUtf8 = new ContentValues();
51 mContentValuesForUtf8.put("CHARSET", "UTF-8");
52 mContentValuesForQPAndSJis = new ContentValues();
53 mContentValuesForQPAndSJis.put("ENCODING", "QUOTED-PRINTABLE");
54 mContentValuesForQPAndSJis.put("CHARSET", "SHIFT_JIS");
55 mContentValuesForQPAndUtf8 = new ContentValues();
56 mContentValuesForQPAndUtf8.put("ENCODING", "QUOTED-PRINTABLE");
57 mContentValuesForQPAndUtf8.put("CHARSET", "UTF-8");
58 mContentValuesForBase64V21 = new ContentValues();
59 mContentValuesForBase64V21.put("ENCODING", "BASE64");
60 mContentValuesForBase64V30 = new ContentValues();
61 mContentValuesForBase64V30.put("ENCODING", "b");
65 public void testAndroidTestCaseSetupProperly() {
66 super.testAndroidTestCaseSetupProperly();
67 mSkipVerification = true;
71 public void setUp() throws Exception{
73 mVerifier = new VCardVerifier(this);
74 mSkipVerification = false;
78 public void tearDown() throws Exception {
80 if (!mSkipVerification) {