am 5b1ec907: Fix more broken large Email tests (#2087413)

Merge commit '5b1ec907612642b1c92363e14c0d1aa296ae0c49' into eclair-plus-aosp

* commit '5b1ec907612642b1c92363e14c0d1aa296ae0c49':
  Fix more broken large Email tests (#2087413)
This commit is contained in:
Marc Blank 2009-09-08 13:37:52 -07:00 committed by Android Git Automerger
commit ea9f7a662a

View File

@ -20,8 +20,6 @@ import com.android.email.Email;
import com.android.email.MessagingController; import com.android.email.MessagingController;
import com.android.email.R; import com.android.email.R;
import com.android.email.mail.internet.BinaryTempFileBody; import com.android.email.mail.internet.BinaryTempFileBody;
import com.android.email.provider.EmailContent;
import com.android.email.provider.EmailContent.Account;
import android.app.Application; import android.app.Application;
import android.content.Context; import android.content.Context;
@ -60,8 +58,6 @@ public class MessageViewTests
private static final String FOLDER_NAME = "folder"; private static final String FOLDER_NAME = "folder";
private static final String MESSAGE_UID = "message_uid"; private static final String MESSAGE_UID = "message_uid";
private EmailContent.Account mAccount;
private long mAccountId;
private TextView mToView; private TextView mToView;
private TextView mSubjectView; private TextView mSubjectView;
private WebView mMessageContentView; private WebView mMessageContentView;
@ -76,9 +72,6 @@ public class MessageViewTests
super.setUp(); super.setUp();
mContext = getInstrumentation().getTargetContext(); mContext = getInstrumentation().getTargetContext();
// Force assignment of a default account, and retrieve it
mAccountId = Account.getDefaultAccountId(mContext);
mAccount = Account.restoreAccountWithId(mContext, mAccountId);
Email.setServicesEnabled(mContext); Email.setServicesEnabled(mContext);
// setup an intent to spin up this activity with something useful // setup an intent to spin up this activity with something useful
@ -86,7 +79,7 @@ public class MessageViewTests
Arrays.asList(new String[]{ "why", "is", "java", "so", "ugly?" })); Arrays.asList(new String[]{ "why", "is", "java", "so", "ugly?" }));
// Log.d("MessageViewTest", "--- folder:" + FOLDER_UIDS); // Log.d("MessageViewTest", "--- folder:" + FOLDER_UIDS);
Intent i = new Intent() Intent i = new Intent()
.putExtra(EXTRA_ACCOUNT_ID, mAccountId) .putExtra(EXTRA_ACCOUNT_ID, -1)
.putExtra(EXTRA_FOLDER, FOLDER_NAME) .putExtra(EXTRA_FOLDER, FOLDER_NAME)
.putExtra(EXTRA_MESSAGE, MESSAGE_UID) .putExtra(EXTRA_MESSAGE, MESSAGE_UID)
.putStringArrayListExtra(EXTRA_FOLDER_UIDS, FOLDER_UIDS); .putStringArrayListExtra(EXTRA_FOLDER_UIDS, FOLDER_UIDS);
@ -126,6 +119,10 @@ public class MessageViewTests
public void testAttachmentWritePermissions() throws FileNotFoundException, IOException { public void testAttachmentWritePermissions() throws FileNotFoundException, IOException {
File file = null; File file = null;
try { try {
// If there's no storage available, this test is moot
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
return;
}
file = MessageView.createUniqueFile(Environment.getExternalStorageDirectory(), file = MessageView.createUniqueFile(Environment.getExternalStorageDirectory(),
"write-test"); "write-test");
OutputStream out = new FileOutputStream(file); OutputStream out = new FileOutputStream(file);