1 /*
2  * Copyright (C) 2016 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.support.test.launcherhelper;
18 
19 import android.support.test.uiautomator.BySelector;
20 import android.support.test.uiautomator.UiDevice;
21 import android.support.test.uiautomator.UiObject2;
22 
23 /**
24  * Defines the common use cases a leanback launcher UI automation helper should fulfill.
25  * <p>Class will be instantiated by {@link LauncherStrategyFactory} based on current launcher
26  * package, and a {@link UiDevice} instance will be provided via {@link #setUiDevice(UiDevice)}
27  * method.
28  */
29 public interface ILeanbackLauncherStrategy extends ILauncherStrategy {
30 
31     /**
32      * Searches for a given query on leanback launcher
33      */
search(String query)34     public void search(String query);
35 
36     /**
37      * Returns a {@link BySelector} describing the search row
38      * @return
39      */
getSearchRowSelector()40     public BySelector getSearchRowSelector();
41 
42     /**
43      * Returns a {@link BySelector} describing the notification row (or recommendation row)
44      * @return
45      */
getNotificationRowSelector()46     public BySelector getNotificationRowSelector();
47 
48     /**
49      * Returns a {@link BySelector} describing the apps row
50      * @return
51      */
getAppsRowSelector()52     public BySelector getAppsRowSelector();
53 
54     /**
55      * Returns a {@link BySelector} describing the games row
56      * @return
57      */
getGamesRowSelector()58     public BySelector getGamesRowSelector();
59 
60     /**
61      * Returns a {@link BySelector} describing the settings row
62      * @return
63      */
getSettingsRowSelector()64     public BySelector getSettingsRowSelector();
65 
66     /**
67      * Returns a {@link UiObject2} describing the focused search row
68      * @return
69      */
selectSearchRow()70     public UiObject2 selectSearchRow();
71 
72     /**
73      * Returns a {@link UiObject2} describing the focused notification row
74      * @return
75      */
selectNotificationRow()76     public UiObject2 selectNotificationRow();
77 
78     /**
79      * Returns a {@link UiObject2} describing the focused apps row
80      * @return
81      */
selectAppsRow()82     public UiObject2 selectAppsRow();
83 
84     /**
85      * Returns a {@link UiObject2} describing the focused games row
86      * @return
87      */
selectGamesRow()88     public UiObject2 selectGamesRow();
89 
90     /**
91      * Returns a {@link UiObject2} describing the focused settings row
92      * @return
93      */
selectSettingsRow()94     public UiObject2 selectSettingsRow();
95 }
96