1 /*
2  * Copyright (C) 2008 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.mms.ui;
18 
19 import static com.android.mms.ui.MessageListAdapter.COLUMN_ID;
20 import static com.android.mms.ui.MessageListAdapter.COLUMN_MSG_TYPE;
21 
22 import com.android.mms.R;
23 import com.android.mms.ui.ComposeMessageActivity;
24 import com.android.mms.ui.RecipientsEditor;
25 import android.os.SystemClock;
26 import android.database.Cursor;
27 import android.content.Context;
28 import android.content.Intent;
29 import android.telephony.PhoneNumberUtils;
30 import android.test.ActivityInstrumentationTestCase2;
31 import android.test.suitebuilder.annotation.LargeTest;
32 import android.view.View;
33 import android.view.ViewStub;
34 import android.widget.EditText;
35 import android.widget.TextView;
36 import android.widget.Button;
37 import android.widget.ImageButton;
38 import android.util.Log;
39 import android.text.TextUtils;
40 
41 /**
42  * Test threads with thousands of messages
43  * To run just this test:
44  *       runtest --test-class=com.android.mms.ui.MultiPartSmsTests mms
45  */
46 public class MultiPartSmsTests extends SmsTest {
47     private static final String TAG = "MultiPartSmsTests";
48 
49     /* (non-Javadoc)
50      * @see com.android.mms.ui.SmsTest#setUp()
51      */
52     @Override
setUp()53     protected void setUp() throws Exception {
54         super.setUp();
55         // NOTE: the longer the message, the longer is takes to send and get back the
56         // received message. You'll have to adjust the timeout in testLongSmsMessage().
57         // I eventually paired down the message to make the test more reasonable to test.
58         mMessage =
59             "Is this a dagger which I see before me,"
60             +" The handle toward my hand? Come, let me clutch thee."
61             +" I have thee not, and yet I see thee still."
62             +" Art thou not, fatal vision, sensible"
63             +" To feeling as to sight? or art thou but"
64             +" A dagger of the mind, a false creation,"
65             +" Proceeding from the heat-oppressed brain?"
66             +" I see thee yet, in form as palpable"
67             +" As this which now I draw.";
68 //            +" Thou marshall'st me the way that I was going;"
69 //            +" And such an instrument I was to use."
70 //            +" Mine eyes are made the fools o' the other senses,"
71 //            +" Or else worth all the rest; I see thee still,"
72 //            +" And on thy blade and dudgeon gouts of blood,"
73 //            +" Which was not so before. There's no such thing:"
74 //            +" It is the bloody business which informs"
75 //            +" Thus to mine eyes. Now o'er the one halfworld"
76 //            +" Nature seems dead, and wicked dreams abuse"
77 //            +" The curtain'd sleep; witchcraft celebrates"
78 //            +" Pale Hecate's offerings, and wither'd murder,"
79 //            +" Alarum'd by his sentinel, the wolf,"
80 //            +" Whose howl's his watch, thus with his stealthy pace."
81 //            +" With Tarquin's ravishing strides, towards his design"
82 //            +" Moves like a ghost. Thou sure and firm-set earth,"
83 //            +" Hear not my steps, which way they walk, for fear"
84 //            +" Thy very stones prate of my whereabout,"
85 //            +" And take the present horror from the time,"
86 //            +" Which now suits with it. Whiles I threat, he lives:"
87 //            +" Words to the heat of deeds too cold breath gives."
88 //            +" A bell rings"
89 //            +" I go, and it is done; the bell invites me."
90 //            +" Hear it not, Duncan; for it is a knell"
91 //            +" That summons thee to heaven or to hell.";
92     }
93 
94     /**
95      * Send a a long multi-part SMS message
96      */
97     @LargeTest
testLongSmsMessage()98     public void testLongSmsMessage() throws Throwable {
99         assertTrue("send & receive message failed",
100                 sendAndReceiveMessage());
101     }
102 }
103