本文整理汇总了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");
}
}