• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     public static final String TYPE_DEFAULT = "android.accounts.test.default";
32 
33     public static final String TYPE_STANDARD_UNAFFILIATED =
34             "android.accounts.test.standard.unaffiliated";
35 
36     public static final String PREFIX_TOKEN = "token:";
37     public static final String PREFIX_PASSWORD = "password:";
38     public static final String PREFIX_STATUS_TOKEN = "status_token:";
39 
40     public static final String SUFFIX_NAME_FIXTURE = "fixture.com";
41     public static final String SUFFIX_NAME_TEST = "test.com";
42 
43     public static final String PREFIX_NAME_SUCCESS = "success_on_return";
44     public static final String PREFIX_NAME_ERROR = "error";
45     public static final String PREFIX_NAME_INTERVENE = "intervene";
46 
47     private static final String[] accountNamePrefixes = new String[] {
48             PREFIX_NAME_SUCCESS,
49             PREFIX_NAME_ERROR,
50             PREFIX_NAME_INTERVENE
51     };
52 
53     public static final Account ACCOUNT_UNAFFILIATED_FIXTURE_SUCCESS = new Account(
54             PREFIX_NAME_SUCCESS + "@" + SUFFIX_NAME_FIXTURE,
55             TYPE_STANDARD_UNAFFILIATED);
56 
57     public static final Account ACCOUNT_DEFAULT = new Account(
58             PREFIX_NAME_SUCCESS + "@" + SUFFIX_NAME_FIXTURE,
59             TYPE_DEFAULT);
60 
getFixtureAccountNames()61     public static List<String> getFixtureAccountNames() {
62         List<String> accountNames = new ArrayList<>(accountNamePrefixes.length);
63         for (String prefix : accountNamePrefixes) {
64             accountNames.add(prefix + "@" + SUFFIX_NAME_FIXTURE);
65         }
66         return accountNames;
67     }
68 
69     public static final int TEST_SUPPORT_RESULT_SUCCESS = 1;
70     public static final int TEST_SUPPORT_RESULT_FAIL = 2;
71 
72     public static final String KEY_ACCOUNT_NAME = "test:account_name";
73 
74     public static final String KEY_CALLBACK = "test:callback";
75     public static final String KEY_CALLBACK_REQUIRED = "test:callback_required";
76     public static final String KEY_RESULT = "test:result";
77     public static final String KEY_TOKEN_EXPIRY = "test:token_duration";
78 
79     public static final String KEY_ACCOUNT_SESSION_BUNDLE = "test:account_session_bundle";
80     public static final String ACCOUNT_STATUS_TOKEN_UNAFFILIATED =
81             "android.accounts.cts.unaffiliated.account.status.token";
82 
Fixtures()83     private Fixtures() {}
84 }
85