From 951eb080f98e86d50cb549ee52fb72d8f07196c3 Mon Sep 17 00:00:00 2001 From: Tony Mantler Date: Fri, 28 Feb 2014 14:21:41 -0800 Subject: [PATCH] Fix tests b/13244976 Change-Id: I8aa00e32b1a2155242ed30a61b27db16fe15b605 --- .../activity/setup/AccountSetupOutgoingTests.java | 12 +++++++++++- .../android/emailcommon/provider/HostAuthTests.java | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/src/com/android/email/activity/setup/AccountSetupOutgoingTests.java b/tests/src/com/android/email/activity/setup/AccountSetupOutgoingTests.java index 1dc78e8f5..5bae429cf 100644 --- a/tests/src/com/android/email/activity/setup/AccountSetupOutgoingTests.java +++ b/tests/src/com/android/email/activity/setup/AccountSetupOutgoingTests.java @@ -21,6 +21,7 @@ import android.content.Intent; import android.test.ActivityInstrumentationTestCase2; import android.test.UiThreadTest; import android.test.suitebuilder.annotation.MediumTest; +import android.widget.CheckBox; import android.widget.EditText; import com.android.email.R; @@ -68,6 +69,7 @@ public class AccountSetupOutgoingTests extends /** * Test processing with a complete, good URI -> good fields */ + @UiThreadTest public void testGoodUri() { getActivityAndFields(); assertTrue(isNextButtonEnabled()); @@ -77,10 +79,18 @@ public class AccountSetupOutgoingTests extends * No user is not OK - not enabled */ public void testBadUriNoUser() - throws URISyntaxException { + throws Throwable { Intent i = getTestIntent("smtp://:password@server.com:999"); setActivityIntent(i); getActivityAndFields(); + runTestOnUiThread(new Runnable() { + @Override + public void run() { + final CheckBox requireLoginView = (CheckBox) + mActivity.findViewById(R.id.account_require_login); + requireLoginView.setChecked(true); + } + }); assertFalse(isNextButtonEnabled()); } diff --git a/tests/src/com/android/emailcommon/provider/HostAuthTests.java b/tests/src/com/android/emailcommon/provider/HostAuthTests.java index 2cef32623..c319fcb93 100644 --- a/tests/src/com/android/emailcommon/provider/HostAuthTests.java +++ b/tests/src/com/android/emailcommon/provider/HostAuthTests.java @@ -80,9 +80,9 @@ public class HostAuthTests extends AndroidTestCase { ha.setLogin("user", ""); assertEquals(HostAuth.FLAG_AUTHENTICATE, ha.mFlags); - ha.mFlags = 0x00000000; + ha.mFlags = 0xffffffff; ha.setLogin("", "password"); - assertEquals(HostAuth.FLAG_AUTHENTICATE, ha.mFlags); + assertEquals(~HostAuth.FLAG_AUTHENTICATE, ha.mFlags); ha.mFlags = 0x00000000; ha.setLogin("user", null);