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 21 public abstract class AbstractDownloadsHelper extends AbstractStandardAppHelper { 22 23 public static enum Category { 24 AUDIO, 25 IMAGES, 26 RECENT, 27 VIDEOS 28 } 29 30 public AbstractDownloadsHelper(Instrumentation instr) { 31 super(instr); 32 } 33 34 /** 35 * Setup expectation: Downloads app's Navigation Drawer is open 36 * <p> 37 * This method will select an item from the navigation drawer's list 38 * 39 * @param category - menu item to select (click) 40 */ 41 public abstract void selectMenuCategory(Category category); 42 43 /** 44 * Setup expectation: Item has been selected from Navigation Drawer's list 45 * <p> 46 * This method opens a directory from the directories list 47 * 48 * @param directoryName - name of directory to open 49 */ 50 public abstract void selectDirectory(String directoryName); 51 52 /** 53 * Setup expectation: Navigated to the right folder 54 * <p> 55 * This method clicks a specific file with name 'filename' 56 * 57 * @param filename - name of file to open 58 */ 59 public abstract void openFile(String filename); 60 61 /** 62 * Setup expectation: Video is playing 63 * <p> 64 * This method will wait for the video to stop playing or until timeoutInSeconds occur, 65 * whichever comes first. Function will just exit, no test failure in either case. 66 * 67 * @param timeoutInSeconds - timeout value in seconds the test will wait for video to end 68 */ 69 public abstract void waitForVideoToStopPlaying(long timeoutInSeconds); 70 71 /** 72 * Setup expectation: Audio is playing 73 * <p> 74 * This method will wait for the audio to stop playing or until timeoutInSeconds occur, 75 * whichever comes first. Function will just exit, no test failure in either case. 76 * 77 * @param timeoutInSeconds - timeout value in seconds the test will wait for audio to end 78 */ 79 public abstract void waitForAudioToStopPlaying(long timeoutInSeconds); 80 81 /** 82 * Setup expectation: Video is playing 83 * <p> 84 * This method will enable or disable video looping. It will bring up the options menu and 85 * check the "Loop video" option 86 * 87 * @param enableVideoLooping - true for continuous looping video, false for not looping video 88 */ 89 public abstract void enableVideoLooping(boolean enableVideoLooping); 90 } 91