Andrii Kulian | 9c5ea9c | 2017-12-07 09:31:01 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 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.app.servertransaction; |
| 18 | |
| 19 | import static android.content.res.Configuration.ORIENTATION_LANDSCAPE; |
| 20 | |
| 21 | import android.app.ResultInfo; |
| 22 | import android.content.Intent; |
| 23 | import android.content.res.Configuration; |
| 24 | |
| 25 | import com.android.internal.content.ReferrerIntent; |
| 26 | |
| 27 | import java.util.ArrayList; |
| 28 | import java.util.List; |
| 29 | |
| 30 | class TestUtils { |
| 31 | |
| 32 | static Configuration config() { |
| 33 | Configuration config = new Configuration(); |
| 34 | config.densityDpi = 10; |
| 35 | config.fontScale = 0.3f; |
| 36 | config.screenHeightDp = 15; |
| 37 | config.orientation = ORIENTATION_LANDSCAPE; |
| 38 | return config; |
| 39 | } |
| 40 | |
| 41 | static List<ResultInfo> resultInfoList() { |
| 42 | String resultWho1 = "resultWho1"; |
| 43 | int requestCode1 = 7; |
| 44 | int resultCode1 = 4; |
| 45 | Intent data1 = new Intent("action1"); |
| 46 | ResultInfo resultInfo1 = new ResultInfo(resultWho1, requestCode1, resultCode1, data1); |
| 47 | |
| 48 | String resultWho2 = "resultWho2"; |
| 49 | int requestCode2 = 8; |
| 50 | int resultCode2 = 6; |
| 51 | Intent data2 = new Intent("action2"); |
| 52 | ResultInfo resultInfo2 = new ResultInfo(resultWho2, requestCode2, resultCode2, data2); |
| 53 | |
| 54 | List<ResultInfo> resultInfoList = new ArrayList<>(); |
| 55 | resultInfoList.add(resultInfo1); |
| 56 | resultInfoList.add(resultInfo2); |
| 57 | |
| 58 | return resultInfoList; |
| 59 | } |
| 60 | |
| 61 | static List<ReferrerIntent> referrerIntentList() { |
| 62 | Intent intent1 = new Intent("action1"); |
| 63 | ReferrerIntent referrerIntent1 = new ReferrerIntent(intent1, "referrer1"); |
| 64 | |
| 65 | Intent intent2 = new Intent("action2"); |
| 66 | ReferrerIntent referrerIntent2 = new ReferrerIntent(intent2, "referrer2"); |
| 67 | |
| 68 | List<ReferrerIntent> referrerIntents = new ArrayList<>(); |
| 69 | referrerIntents.add(referrerIntent1); |
| 70 | referrerIntents.add(referrerIntent2); |
| 71 | |
| 72 | return referrerIntents; |
| 73 | } |
| 74 | } |