本文整理匯總了Java中com.robotium.solo.Solo.sleep方法的典型用法代碼示例。如果您正苦於以下問題:Java Solo.sleep方法的具體用法?Java Solo.sleep怎麽用?Java Solo.sleep使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.robotium.solo.Solo
的用法示例。
在下文中一共展示了Solo.sleep方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setUp
import com.robotium.solo.Solo; //導入方法依賴的package包/類
public void setUp() throws Exception {
List<Integer> allDays = new ArrayList<>();
for (int i = 1; i <= 7; ++i){
allDays.add(i);
}
Profile profile = new TestProfile("xyz");
Habit habit = new Habit("T1", "", new Date(), allDays, "");
habit.setId("one");
profile.addHabit(habit);
Habit habit2 = new Habit("T55", "", new Date(), allDays, "");
habit2.setId("h2");
habit2.addHabitEvent(new HabitEvent("one"));
profile.addHabit(habit2);
Intent intent = new Intent();
intent.putExtra(HistoryActivity.ID_PROFILE, profile);
setActivityIntent(intent);
solo = new Solo(getInstrumentation(), getActivity());
Log.d("SETUP", "setUp()");
solo.sleep(1000);
solo.clickOnButton("Habits");
solo.sleep(2000);
}
示例2: mIsPlay
import com.robotium.solo.Solo; //導入方法依賴的package包/類
public static boolean mIsPlay(Solo solo, String videoPlayerClass) throws NoSuchFieldException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, ClassNotFoundException {
solo.sleep(3000);
Class activityVideoPlayer = Class.forName(videoPlayerClass);
Field[] declaredFields = activityVideoPlayer.getDeclaredFields();
Field mPlayerHelperField = null;
for (Field field : declaredFields) {
if (field.getType().getName().equals("com.ifeng.newvideo.videoplayer.player.NormalVideoHelper")) {
mPlayerHelperField = field;
mPlayerHelperField.setAccessible(true);
break;
}
}
Object mPlayerHelper = null;
if (videoPlayerClass.contains("UniversalChannelFragment")) {
FragmentActivity fragmentActivity = (FragmentActivity) solo.getCurrentActivity();
List<Fragment> fragments = fragmentActivity.getSupportFragmentManager().getFragments();
for (android.support.v4.app.Fragment fragment : fragments) {
if (fragment.getClass().getName().equals("com.ifeng.newvideo.ui.FragmentHomePage")) {
List<android.support.v4.app.Fragment> childFragments = fragment.getChildFragmentManager().getFragments();
for (int i = 0; i < childFragments.size(); i++) {
if (childFragments.get(i) != null && childFragments.get(i).getClass().getName().equals(("com.ifeng.newvideo.ui.UniversalChannelFragment"))) {
mPlayerHelper = mPlayerHelperField.get(childFragments.get(i));
break;
}
}
break;
}
}
} else {
Activity currentActivity = solo.getCurrentActivity();
mPlayerHelper = mPlayerHelperField.get(currentActivity);
}
Field mPlayerField = mPlayerHelper.getClass().getDeclaredField("mPlayer");
mPlayerField.setAccessible(true);
Object mPlayer = mPlayerField.get(mPlayerHelper);
Method isPlayingMethod = mPlayer.getClass().getDeclaredMethod("isPlaying");
isPlayingMethod.setAccessible(true);
boolean isPlay = (boolean) isPlayingMethod.invoke(mPlayer);
return isPlay;
}
示例3: setUp
import com.robotium.solo.Solo; //導入方法依賴的package包/類
@Override
protected void setUp() throws Exception {
solo = new Solo(getInstrumentation(), getActivity());
Fragment fragment = getActivity().getSupportFragmentManager().findFragmentById(R.id.container);
if (fragment instanceof FodexBaseFragment) {
fodexFragment = (FodexBaseFragment) fragment;
fodexFragment.injectMock(true);
scrollDown(); // refresh
solo.sleep(3000);
} else {
throw new RuntimeException("Invalid fragment, expecting fragment to be an instance of FodexBaseFragment");
}
}