1 /*
2  * Copyright (C) 2015 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 android.accounts.cts.common;
18 
19 import android.accounts.Account;
20 
21 import java.util.ArrayList;
22 import java.util.List;
23 
24 /**
25  * Constants shared amongst account hostside tests.
26  */
27 public final class Fixtures {
28 
29     public static final String TYPE_CUSTOM = "android.accounts.test.custom";
30     public static final String TYPE_STANDARD = "android.accounts.test.standard";
31 
32     public static final String TYPE_STANDARD_UNAFFILIATED =
33             "android.accounts.test.standard.unaffiliated";
34 
35     public static final String PREFIX_TOKEN = "token:";
36     public static final String PREFIX_PASSWORD = "password:";
37 
38     public static final String SUFFIX_NAME_FIXTURE = "fixture.com";
39     public static final String SUFFIX_NAME_TEST = "test.com";
40 
41     public static final String PREFIX_NAME_SUCCESS = "success_on_return";
42     public static final String PREFIX_NAME_ERROR = "error";
43     public static final String PREFIX_NAME_INTERVENE = "intervene";
44 
45     private static final String[] accountNamePrefixes = new String[] {
46             PREFIX_NAME_SUCCESS,
47             PREFIX_NAME_ERROR,
48             PREFIX_NAME_INTERVENE
49     };
50 
51     public static final Account ACCOUNT_UNAFFILIATED_FIXTURE_SUCCESS = new Account(
52             PREFIX_NAME_SUCCESS + "@" + SUFFIX_NAME_FIXTURE,
53             TYPE_STANDARD_UNAFFILIATED);
54 
getFixtureAccountNames()55     public static List<String> getFixtureAccountNames() {
56         List<String> accountNames = new ArrayList<>(accountNamePrefixes.length);
57         for (String prefix : accountNamePrefixes) {
58             accountNames.add(prefix + "@" + SUFFIX_NAME_FIXTURE);
59         }
60         return accountNames;
61     }
62 
63     public static final int TEST_SUPPORT_RESULT_SUCCESS = 1;
64     public static final int TEST_SUPPORT_RESULT_FAIL = 2;
65 
66     public static final String KEY_ACCOUNT_NAME = "test:account_name";
67 
68     public static final String KEY_CALLBACK = "test:callback";
69     public static final String KEY_CALLBACK_REQUIRED = "test:callback_required";
70     public static final String KEY_RESULT = "test:result";
71     public static final String KEY_TOKEN_EXPIRY = "test:token_duration";
72 
Fixtures()73     private Fixtures() {}
74 }
75