1 /* 2 * Copyright (C) 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.autofillservice.cts; 18 19 /** 20 * Timeouts for common tasks. 21 */ 22 final class Timeouts { 23 24 /** 25 * Timeout until framework binds / unbinds from service. 26 */ 27 static final Timeout CONNECTION_TIMEOUT = new Timeout("CONNECTION_TIMEOUT", 5000, 2F, 10000); 28 29 /** 30 * Timeout until framework unbinds from a service. 31 */ 32 // TODO: must be higher than RemoteFillService.TIMEOUT_IDLE_BIND_MILLIS, so we should use a 33 // @hidden @Testing constants instead... 34 static final Timeout IDLE_UNBIND_TIMEOUT = new Timeout("IDLE_UNBIND_TIMEOUT", 10000, 2F, 10000); 35 36 /** 37 * Timeout to get the expected number of fill events. 38 */ 39 static final Timeout FILL_EVENTS_TIMEOUT = new Timeout("FILL_EVENTS_TIMEOUT", 5000, 2F, 10000); 40 41 /** 42 * Timeout for expected autofill requests. 43 */ 44 static final Timeout FILL_TIMEOUT = new Timeout("FILL_TIMEOUT", 5000, 2F, 10000); 45 46 /** 47 * Timeout for expected save requests. 48 */ 49 static final Timeout SAVE_TIMEOUT = new Timeout("SAVE_TIMEOUT", 5000, 2F, 10000); 50 51 /** 52 * Timeout used when save is not expected to be shown - test will sleep for that amount of time 53 * as there is no callback that be received to assert it's not shown. 54 */ 55 static final long SAVE_NOT_SHOWN_NAPTIME_MS = 5000; 56 57 /** 58 * Timeout for UI operations. Typically used by {@link UiBot}. 59 */ 60 static final Timeout UI_TIMEOUT = new Timeout("UI_TIMEOUT", 5000, 2F, 10000); 61 62 /** 63 * Timeout for webview operations. Typically used by {@link UiBot}. 64 */ 65 static final Timeout WEBVIEW_TIMEOUT = new Timeout("WEBVIEW_TIMEOUT", 8000, 2F, 16000); 66 67 /** 68 * Timeout for showing the autofill dataset picker UI. 69 * 70 * <p>The value is usually higher than {@link #UI_TIMEOUT} because the performance of the 71 * dataset picker UI can be affect by external factors in some low-level devices. 72 * 73 * <p>Typically used by {@link UiBot}. 74 */ 75 static final Timeout UI_DATASET_PICKER_TIMEOUT = 76 new Timeout("UI_DATASET_PICKER_TIMEOUT", 5000, 2F, 10000); 77 78 /** 79 * Timeout used when the dataset picker is not expected to be shown - test will sleep for that 80 * amount of time as there is no callback that be received to assert it's not shown. 81 */ 82 static final long DATASET_PICKER_NOT_SHOWN_NAPTIME_MS = 5000; 83 84 /** 85 * Timeout (in milliseconds) for an activity to be brought out to top. 86 */ 87 static final Timeout ACTIVITY_RESURRECTION = 88 new Timeout("ACTIVITY_RESURRECTION", 6000, 3F, 20000); 89 90 /** 91 * Timeout for changing the screen orientation. 92 */ 93 static final Timeout UI_SCREEN_ORIENTATION_TIMEOUT = 94 new Timeout("UI_SCREEN_ORIENTATION_TIMEOUT", 5000, 2F, 10000); 95 Timeouts()96 private Timeouts() { 97 throw new UnsupportedOperationException("contain static methods only"); 98 } 99 } 100