Fix an error of endtoend test.

This commit is contained in:
youtaol
2013-01-05 10:40:53 +08:00
parent d7b4eeb05b
commit e6b67d941e
@@ -56,7 +56,7 @@ public class EndToEndTestUtils {
private static final String ANDROID_LOCAL_IP = "10.0.2.2"; private static final String ANDROID_LOCAL_IP = "10.0.2.2";
// usually 5554. // usually 5554.
public static int emulatorPort = 5554; public static int emulatorPort = 5568;
private static final int ORIENTATION_PORTRAIT = 1; private static final int ORIENTATION_PORTRAIT = 1;
private static final int ORIENTATION_LANDSCAPE = 0; private static final int ORIENTATION_LANDSCAPE = 0;
@@ -787,12 +787,14 @@ public class EndToEndTestUtils {
*/ */
public static TextView findTextView(String text) { public static TextView findTextView(String text) {
ArrayList<View> allViews = SOLO.getViews(); ArrayList<View> allViews = SOLO.getViews();
for (View view : allViews) { if (allViews != null) {
if (view instanceof TextView) { for (View view : allViews) {
TextView textView = (TextView) view; if (view instanceof TextView) {
String textString = (String) textView.getText(); TextView textView = (TextView) view;
if (textView.isShown() && textString.endsWith(text)) { String textString = (String) textView.getText();
return textView; if (textView.isShown() && textString.endsWith(text)) {
return textView;
}
} }
} }
} }