Search in sources :

Example 1 with ComposeMessageActivity

use of com.android.mms.ui.ComposeMessageActivity in project android-aosp-mms by slvn.

the class LongThreadTest method testSendManyMessages.

/**
 * Send a flurry of SMS and MMS messages
 */
@LargeTest
public void testSendManyMessages() throws Throwable {
    // BTW, sending 50 messages brings up the "Sending too many messages" alert so
    // backing down to a smaller number.
    final int MAXSEND = 30;
    final int MSG_PER_RECIPIENT = MAXSEND / mRecipients.size();
    final int MMS_FREQ = Math.min(MSG_PER_RECIPIENT / 10, 1);
    final ComposeMessageActivity a = getActivity();
    for (String recipient : mRecipients) {
        mActivity.runOnUiThread(new Runnable() {

            public void run() {
                a.initialize(null, 0);
                a.loadMessageContent();
            }
        });
        for (int i = 0; i < MSG_PER_RECIPIENT; i++) {
            Log.v(TAG, "Sending msg: " + i);
            if (i % MMS_FREQ == 0) {
                mSendMmsMessage.setRecipient(recipient);
                runTestOnUiThread(mSendMmsMessage);
            } else {
                mSendSmsMessage.setRecipient(recipient);
                runTestOnUiThread(mSendSmsMessage);
            }
            // wait 5 seconds between messages
            Thread.sleep(5000);
        }
    }
    assertTrue(true);
}
Also used : ComposeMessageActivity(com.android.mms.ui.ComposeMessageActivity) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Aggregations

LargeTest (android.test.suitebuilder.annotation.LargeTest)1 ComposeMessageActivity (com.android.mms.ui.ComposeMessageActivity)1