Merge "Temporarily disabling crashing test."
This commit is contained in:
commit
1abbc55a45
@ -14,120 +14,130 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.android.email.activity.setup;
|
// TODO Test crashes. Fix it.
|
||||||
|
|
||||||
import com.android.email.R;
|
/*
|
||||||
import com.android.email.provider.EmailContent;
|
The problem is that this test creates a partial account which will be
|
||||||
import com.android.email.provider.EmailContent.HostAuth;
|
used by the activity, but the account is picked up by MailService too
|
||||||
|
(which is probably not intentional), which crashes because the account
|
||||||
import android.content.ContentUris;
|
is not properly constructed. (empty address)
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.test.ActivityInstrumentationTestCase2;
|
|
||||||
import android.test.suitebuilder.annotation.MediumTest;
|
|
||||||
import android.widget.Button;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests of basic UI logic in the AccountSetupNamesTest screen.
|
|
||||||
* You can run this entire test case with:
|
|
||||||
* runtest -c com.android.email.activity.setup.AccountSetupNamesTests email
|
|
||||||
*/
|
*/
|
||||||
@MediumTest
|
|
||||||
public class AccountSetupNamesTests extends ActivityInstrumentationTestCase2<AccountSetupNames> {
|
|
||||||
private long mAccountId;
|
|
||||||
private EmailContent.Account mAccount;
|
|
||||||
|
|
||||||
private Context mContext;
|
//
|
||||||
private AccountSetupNames mActivity;
|
//package com.android.email.activity.setup;
|
||||||
private Button mDoneButton;
|
//
|
||||||
|
//import com.android.email.R;
|
||||||
public AccountSetupNamesTests() {
|
//import com.android.email.provider.EmailContent;
|
||||||
super(AccountSetupNames.class);
|
//import com.android.email.provider.EmailContent.HostAuth;
|
||||||
}
|
//
|
||||||
|
//import android.content.ContentUris;
|
||||||
/**
|
//import android.content.Context;
|
||||||
* Common setup code for all tests.
|
//import android.content.Intent;
|
||||||
*/
|
//import android.net.Uri;
|
||||||
@Override
|
//import android.test.ActivityInstrumentationTestCase2;
|
||||||
protected void setUp() throws Exception {
|
//import android.test.suitebuilder.annotation.MediumTest;
|
||||||
super.setUp();
|
//import android.widget.Button;
|
||||||
|
//
|
||||||
mContext = this.getInstrumentation().getTargetContext();
|
///**
|
||||||
}
|
// * Tests of basic UI logic in the AccountSetupNamesTest screen.
|
||||||
|
// * You can run this entire test case with:
|
||||||
/**
|
// * runtest -c com.android.email.activity.setup.AccountSetupNamesTests email
|
||||||
* Delete any dummy accounts we set up for this test
|
// */
|
||||||
*/
|
//@MediumTest
|
||||||
@Override
|
//public class AccountSetupNamesTests extends ActivityInstrumentationTestCase2<AccountSetupNames> {
|
||||||
protected void tearDown() throws Exception {
|
// private long mAccountId;
|
||||||
if (mAccount != null) {
|
// private EmailContent.Account mAccount;
|
||||||
Uri uri = ContentUris.withAppendedId(
|
//
|
||||||
EmailContent.Account.CONTENT_URI, mAccountId);
|
// private Context mContext;
|
||||||
mContext.getContentResolver().delete(uri, null, null);
|
// private AccountSetupNames mActivity;
|
||||||
}
|
// private Button mDoneButton;
|
||||||
|
//
|
||||||
// must call last because it scrubs member variables
|
// public AccountSetupNamesTests() {
|
||||||
super.tearDown();
|
// super(AccountSetupNames.class);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* Test a "good" account name (enables the button)
|
// * Common setup code for all tests.
|
||||||
*/
|
// */
|
||||||
public void testGoodAccountName() {
|
// @Override
|
||||||
Intent i = getTestIntent("imap", "GoodName");
|
// protected void setUp() throws Exception {
|
||||||
this.setActivityIntent(i);
|
// super.setUp();
|
||||||
|
//
|
||||||
getActivityAndFields();
|
// mContext = this.getInstrumentation().getTargetContext();
|
||||||
|
// }
|
||||||
assertTrue(mDoneButton.isEnabled());
|
//
|
||||||
}
|
// /**
|
||||||
|
// * Delete any dummy accounts we set up for this test
|
||||||
/**
|
// */
|
||||||
* Test a "bad" account name (disables the button)
|
// @Override
|
||||||
*/
|
// protected void tearDown() throws Exception {
|
||||||
public void testBadAccountName() {
|
// if (mAccount != null) {
|
||||||
Intent i = getTestIntent("imap", "");
|
// Uri uri = ContentUris.withAppendedId(
|
||||||
this.setActivityIntent(i);
|
// EmailContent.Account.CONTENT_URI, mAccountId);
|
||||||
|
// mContext.getContentResolver().delete(uri, null, null);
|
||||||
getActivityAndFields();
|
// }
|
||||||
|
//
|
||||||
assertFalse(mDoneButton.isEnabled());
|
// // must call last because it scrubs member variables
|
||||||
}
|
// super.tearDown();
|
||||||
|
// }
|
||||||
/**
|
//
|
||||||
* Test a "bad" account name (disables the button)
|
// /**
|
||||||
*/
|
// * Test a "good" account name (enables the button)
|
||||||
public void testEasAccountName() {
|
// */
|
||||||
Intent i = getTestIntent("eas", "");
|
// public void testGoodAccountName() {
|
||||||
this.setActivityIntent(i);
|
// Intent i = getTestIntent("imap", "GoodName");
|
||||||
|
// this.setActivityIntent(i);
|
||||||
getActivityAndFields();
|
//
|
||||||
|
// getActivityAndFields();
|
||||||
assertTrue(mDoneButton.isEnabled());
|
//
|
||||||
}
|
// assertTrue(mDoneButton.isEnabled());
|
||||||
|
// }
|
||||||
/**
|
//
|
||||||
* Get the activity (which causes it to be started, using our intent) and get the UI fields
|
// /**
|
||||||
*/
|
// * Test a "bad" account name (disables the button)
|
||||||
private void getActivityAndFields() {
|
// */
|
||||||
mActivity = getActivity();
|
// public void testBadAccountName() {
|
||||||
mDoneButton = (Button) mActivity.findViewById(R.id.done);
|
// Intent i = getTestIntent("imap", "");
|
||||||
}
|
// this.setActivityIntent(i);
|
||||||
|
//
|
||||||
/**
|
// getActivityAndFields();
|
||||||
* Create an intent with the Account in it, using protocol as the protocol and name as the
|
//
|
||||||
* user's sender name
|
// assertFalse(mDoneButton.isEnabled());
|
||||||
*/
|
// }
|
||||||
private Intent getTestIntent(String protocol, String name) {
|
//
|
||||||
mAccount = new EmailContent.Account();
|
// /**
|
||||||
mAccount.setSenderName(name);
|
// * Test a "bad" account name (disables the button)
|
||||||
HostAuth hostAuth = new HostAuth();
|
// */
|
||||||
hostAuth.mProtocol = protocol;
|
// public void testEasAccountName() {
|
||||||
mAccount.mHostAuthRecv = hostAuth;
|
// Intent i = getTestIntent("eas", "");
|
||||||
mAccount.save(mContext);
|
// this.setActivityIntent(i);
|
||||||
mAccountId = mAccount.mId;
|
//
|
||||||
SetupData.init(SetupData.FLOW_MODE_NORMAL, mAccount);
|
// getActivityAndFields();
|
||||||
return new Intent(Intent.ACTION_MAIN);
|
//
|
||||||
}
|
// assertTrue(mDoneButton.isEnabled());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Get the activity (which causes it to be started, using our intent) and get the UI fields
|
||||||
|
// */
|
||||||
|
// private void getActivityAndFields() {
|
||||||
|
// mActivity = getActivity();
|
||||||
|
// mDoneButton = (Button) mActivity.findViewById(R.id.done);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Create an intent with the Account in it, using protocol as the protocol and name as the
|
||||||
|
// * user's sender name
|
||||||
|
// */
|
||||||
|
// private Intent getTestIntent(String protocol, String name) {
|
||||||
|
// mAccount = new EmailContent.Account();
|
||||||
|
// mAccount.setSenderName(name);
|
||||||
|
// HostAuth hostAuth = new HostAuth();
|
||||||
|
// hostAuth.mProtocol = protocol;
|
||||||
|
// mAccount.mHostAuthRecv = hostAuth;
|
||||||
|
// mAccount.save(mContext);
|
||||||
|
// mAccountId = mAccount.mId;
|
||||||
|
// SetupData.init(SetupData.FLOW_MODE_NORMAL, mAccount);
|
||||||
|
// return new Intent(Intent.ACTION_MAIN);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
Loading…
Reference in New Issue
Block a user