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 java.io.IOException; 20 21 import android.app.Instrumentation; 22 import android.support.test.uiautomator.Direction; 23 24 public abstract class AbstractGoogleFitHelper extends AbstractStandardAppHelper { 25 AbstractGoogleFitHelper(Instrumentation instr)26 public AbstractGoogleFitHelper(Instrumentation instr) { 27 super(instr); 28 } 29 30 /** 31 * Setup expectations: Google Fit is open and idle. 32 * 33 * This method will open the "Home" page of Fit 34 */ goToHome()35 public abstract void goToHome(); 36 37 /** 38 * Setup expectations: Google Fit is open and idle. 39 * 40 * This method will open the "Timeline" page of Fit 41 */ goToTimeline()42 public abstract void goToTimeline(); 43 44 /** 45 * Setup expectations: Google Fit is open and idle. 46 * 47 * This method will open the "Challenges" page of Fit 48 */ goToChallenges()49 public abstract void goToChallenges(); 50 51 /** 52 * Setup expectations: Google Fit is open and idle on the home page. 53 * 54 * The method will add a goal with the supplied characteristics and return to the home page 55 * @param mode the goal type by steps (1), duration (2), or run times (3) 56 * @param value the method will set values for each type of goal 57 */ addGoal(int mode, int value)58 public abstract void addGoal(int mode, int value); 59 60 /** 61 * Setup expectations: Google Fit is open and idle on the home page or timeline page. 62 * 63 * This method will add an untracked activity record and set descriptions 64 * @param activity case-insensitive activity types, like: running, biking, walking 65 * @param duration value of time duration in minutes 66 * @param calories value of Calories 67 * @param steps value of Steps 68 * @param distance value of Distance in mile 69 */ addActivity(String activity, int duration, int calories, int steps, int distance)70 public abstract void addActivity(String activity, int duration, int calories, 71 int steps, int distance); 72 /** 73 * Setup expectations: Google Fit is open and idle on the home page or timeline page. 74 * 75 * This method will select an activity type and start an activity session 76 * @param activity case-insensitive activity types, like: running, biking, walking 77 */ startActivity(String activity)78 public abstract void startActivity(String activity) throws IOException; 79 80 /** 81 * Setup expectations: An activity session is started. 82 * 83 * This method will pause the current activity and end on the activity page. 84 */ pauseActivity()85 public abstract void pauseActivity(); 86 87 /** 88 * Setup expectations: An activity session is paused. 89 * 90 * This method will resume the current paused activity and end on the activity page. 91 */ resumeActivity()92 public abstract void resumeActivity(); 93 94 /** 95 * Setup expectations: An activity session is paused. 96 * 97 * This method will terminate and save the current activity and end on the activity summary page 98 */ saveActivity()99 public abstract void saveActivity(); 100 101 /** 102 * Setup expectations: An activity session is started. 103 * 104 * This method will stop the current activity and end on the activity page. 105 */ stopActivity()106 public abstract void stopActivity() throws IOException; 107 108 } 109