diff options
| author | Makoto Onuki <omakoto@google.com> | 2010-02-02 15:06:52 -0800 |
|---|---|---|
| committer | Makoto Onuki <omakoto@google.com> | 2010-02-03 11:39:46 -0800 |
| commit | 91237e9dcb0a948f17488b464edabcea0f259d31 (patch) | |
| tree | e2f27908e4f21b68123a0c21bd76354a5f46f208 /tests | |
| parent | 8bb0ee3b924f6b0e948733dacac3228f88bd50dc (diff) | |
| download | android_packages_apps_Email-91237e9dcb0a948f17488b464edabcea0f259d31.tar.gz android_packages_apps_Email-91237e9dcb0a948f17488b464edabcea0f259d31.tar.bz2 android_packages_apps_Email-91237e9dcb0a948f17488b464edabcea0f259d31.zip | |
Adding script for building Email app without exchange.
remove-exchange-support.sh makes it possible to build the email app without
exchange support.
This script:
- removes all packages under com.android.exchange.
- removes all lines surrounded by EXCHANGE-REMOVE-SECTION-START and
EXCHANGE-REMOVE-SECTION-END
And the resulting source should still build and run fine.
Bug: 2369784
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/src/com/android/email/activity/setup/AccountSetupAccountTypeUnitTests.java | 30 | ||||
| -rw-r--r-- | tests/src/com/android/email/activity/setup/AccountSetupExchangeTests.java | 28 |
2 files changed, 33 insertions, 25 deletions
diff --git a/tests/src/com/android/email/activity/setup/AccountSetupAccountTypeUnitTests.java b/tests/src/com/android/email/activity/setup/AccountSetupAccountTypeUnitTests.java index d5c5d6277..13ea7551a 100644 --- a/tests/src/com/android/email/activity/setup/AccountSetupAccountTypeUnitTests.java +++ b/tests/src/com/android/email/activity/setup/AccountSetupAccountTypeUnitTests.java @@ -35,16 +35,16 @@ import java.util.HashSet; * This is a series of unit tests for the AccountSetupAccountType class. */ @SmallTest -public class AccountSetupAccountTypeUnitTests +public class AccountSetupAccountTypeUnitTests extends ActivityUnitTestCase<AccountSetupAccountType> { // Borrowed from AccountSetupAccountType private static final String EXTRA_ACCOUNT = "account"; Context mContext; - + private HashSet<Account> mAccounts = new HashSet<Account>(); - + public AccountSetupAccountTypeUnitTests() { super(AccountSetupAccountType.class); } @@ -52,7 +52,7 @@ public class AccountSetupAccountTypeUnitTests @Override protected void setUp() throws Exception { super.setUp(); - + mContext = this.getInstrumentation().getTargetContext(); } @@ -65,11 +65,11 @@ public class AccountSetupAccountTypeUnitTests Uri uri = ContentUris.withAppendedId(Account.CONTENT_URI, account.mId); mContext.getContentResolver().delete(uri, null, null); } - + // must call last because it scrubs member variables super.tearDown(); } - + /** * Test store type limit enforcement */ @@ -77,7 +77,7 @@ public class AccountSetupAccountTypeUnitTests EmailContent.Account acct1 = createTestAccount("scheme1"); EmailContent.Account acct2 = createTestAccount("scheme1"); EmailContent.Account acct3 = createTestAccount("scheme2"); - + AccountSetupAccountType activity = startActivity(getTestIntent(acct1), null, null); // Test with no limit @@ -85,24 +85,30 @@ public class AccountSetupAccountTypeUnitTests info.mAccountInstanceLimit = -1; info.mScheme = "scheme1"; assertTrue("no limit", activity.checkAccountInstanceLimit(info)); - + // Test with limit, but not reached info.mAccountInstanceLimit = 3; assertTrue("limit, but not reached", activity.checkAccountInstanceLimit(info)); - + // Test with limit, reached info.mAccountInstanceLimit = 2; assertFalse("limit, reached", activity.checkAccountInstanceLimit(info)); } /** - * Confirm that EAS is presented (supported in this release) + * Confirm that EAS is presented, when supported. */ public void testEasOffered() { Account acct1 = createTestAccount("scheme1"); AccountSetupAccountType activity = startActivity(getTestIntent(acct1), null, null); View exchangeButton = activity.findViewById(R.id.exchange); - assertEquals(View.VISIBLE, exchangeButton.getVisibility()); + + int expected = View.GONE; // Default is hidden + //EXCHANGE-REMOVE-SECTION-START + expected = View.VISIBLE; // Will be visible if supported. + //EXCHANGE-REMOVE-SECTION-END + + assertEquals(expected, exchangeButton.getVisibility()); } /** @@ -115,7 +121,7 @@ public class AccountSetupAccountTypeUnitTests mAccounts.add(account); return account; } - + /** * Create an intent with the Account in it */ diff --git a/tests/src/com/android/email/activity/setup/AccountSetupExchangeTests.java b/tests/src/com/android/email/activity/setup/AccountSetupExchangeTests.java index 45413e380..d64ff10aa 100644 --- a/tests/src/com/android/email/activity/setup/AccountSetupExchangeTests.java +++ b/tests/src/com/android/email/activity/setup/AccountSetupExchangeTests.java @@ -37,17 +37,19 @@ import android.widget.EditText; @MediumTest public class AccountSetupExchangeTests extends ActivityInstrumentationTestCase2<AccountSetupExchange> { - + //EXCHANGE-REMOVE-SECTION-START private AccountSetupExchange mActivity; private EditText mServerView; private Button mNextButton; private CheckBox mSslRequiredCheckbox; private CheckBox mTrustAllCertificatesCheckbox; - + //EXCHANGE-REMOVE-SECTION-END + public AccountSetupExchangeTests() { super("com.android.email", AccountSetupExchange.class); } + //EXCHANGE-REMOVE-SECTION-START /** * Common setup code for all tests. Sets up a default launch intent, which some tests * will use (others will override). @@ -62,7 +64,7 @@ public class AccountSetupExchangeTests extends Intent i = getTestIntent("eas://user:password@server.com"); setActivityIntent(i); } - + /** * Test processing with a complete, good URI -> good fields */ @@ -72,7 +74,7 @@ public class AccountSetupExchangeTests extends getActivityAndFields(); assertTrue(mNextButton.isEnabled()); } - + // TODO Add tests for valid usernames in eas // They would be <name> or <name>\<domain> or <name>/<domain> or a valid email address @@ -85,7 +87,7 @@ public class AccountSetupExchangeTests extends getActivityAndFields(); assertFalse(mNextButton.isEnabled()); } - + /** * No password is not OK - not enabled */ @@ -95,7 +97,7 @@ public class AccountSetupExchangeTests extends getActivityAndFields(); assertFalse(mNextButton.isEnabled()); } - + /** * Test for non-standard but OK server names */ @@ -103,11 +105,11 @@ public class AccountSetupExchangeTests extends public void testGoodServerVariants() { getActivityAndFields(); assertTrue(mNextButton.isEnabled()); - + mServerView.setText(" server.com "); assertTrue(mNextButton.isEnabled()); } - + /** * Test for non-empty but non-OK server names */ @@ -115,10 +117,10 @@ public class AccountSetupExchangeTests extends public void testBadServerVariants() { getActivityAndFields(); assertTrue(mNextButton.isEnabled()); - + mServerView.setText(" "); assertFalse(mNextButton.isEnabled()); - + mServerView.setText("serv$er.com"); assertFalse(mNextButton.isEnabled()); } @@ -161,7 +163,7 @@ public class AccountSetupExchangeTests extends /** * TODO: Directly test validateFields() checking boolean result */ - + /** * Get the activity (which causes it to be started, using our intent) and get the UI fields */ @@ -173,7 +175,7 @@ public class AccountSetupExchangeTests extends mTrustAllCertificatesCheckbox = (CheckBox) mActivity.findViewById(R.id.account_trust_certificates); } - + /** * Create an intent with the Account in it */ @@ -185,5 +187,5 @@ public class AccountSetupExchangeTests extends i.putExtra(AccountSetupExchange.EXTRA_DISABLE_AUTO_DISCOVER, true); return i; } - + //EXCHANGE-REMOVE-SECTION-END } |
