Home | History | Annotate | Download | only in helpers
      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.platform.test.helpers;
     18 
     19 import android.app.Instrumentation;
     20 import android.support.test.uiautomator.Direction;
     21 
     22 public abstract class AbstractRedditHelper extends AbstractStandardAppHelper {
     23 
     24     public AbstractRedditHelper(Instrumentation instr) {
     25         super(instr);
     26     }
     27 
     28     /*
     29      * Setup expectations: Reddit app is open.
     30      *
     31      * This method moves the Reddit app to the front page.
     32      */
     33     public abstract void goToFrontPage();
     34 
     35     /*
     36      * Setup expectations: Reddit app is on the front pages.
     37      *
     38      * This method moves the Reddit app to the first visible article's comment page.
     39      */
     40     public abstract void goToFirstArticleComments();
     41 
     42     /*
     43      * Setup expectations: Reddit app is on the front page.
     44      *
     45      * This method scrolls the front page.
     46      *
     47      * @param direction Direction in which to scroll, must be UP or DOWN
     48      * @param percent   Percent of page to scroll
     49      * @return boolean  Whether the page can still scroll in the given direction
     50      */
     51     public abstract boolean scrollFrontPage(Direction direction, float percent);
     52 
     53     /*
     54      * Setup expectations: Reddit app is on an article's comment page.
     55      *
     56      * This method scrolls the comment page.
     57      *
     58      * @param direction Direction in which to scroll, must be UP or DOWN
     59      * @param percent   Percent of page to scroll
     60      * @return boolean  Whether the page can still scroll in the given direction
     61      */
     62     public abstract boolean scrollCommentPage(Direction direction, float percent);
     63 }
     64