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