1540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor/*
2540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor * Copyright (C) 2008 The Android Open Source Project
3540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor *
4540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor * Licensed under the Apache License, Version 2.0 (the "License");
5540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor * you may not use this file except in compliance with the License.
6540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor * You may obtain a copy of the License at
7540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor *
8540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor *      http://www.apache.org/licenses/LICENSE-2.0
9540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor *
10540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor * Unless required by applicable law or agreed to in writing, software
11540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor * distributed under the License is distributed on an "AS IS" BASIS,
12540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor * See the License for the specific language governing permissions and
14540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor * limitations under the License.
15540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor */
16540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor
17540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylorpackage com.android.mms.ui;
18540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor
19540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylorimport static com.android.mms.ui.MessageListAdapter.COLUMN_ID;
20540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylorimport static com.android.mms.ui.MessageListAdapter.COLUMN_MSG_TYPE;
21540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor
22540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylorimport com.android.mms.R;
23540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylorimport com.android.mms.ui.ComposeMessageActivity;
244a082ceeba3674fe9f08cd344689443ed70dcf31Xia Wangimport com.android.mms.ui.RecipientsEditor;
254a082ceeba3674fe9f08cd344689443ed70dcf31Xia Wangimport android.os.SystemClock;
26540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylorimport android.database.Cursor;
271f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wangimport android.content.Context;
281f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wangimport android.content.Intent;
291f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wangimport android.telephony.PhoneNumberUtils;
30540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylorimport android.test.ActivityInstrumentationTestCase2;
31540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylorimport android.test.suitebuilder.annotation.LargeTest;
32540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylorimport android.view.View;
334a082ceeba3674fe9f08cd344689443ed70dcf31Xia Wangimport android.view.ViewStub;
34540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylorimport android.widget.EditText;
35540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylorimport android.widget.TextView;
36540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylorimport android.widget.Button;
374a082ceeba3674fe9f08cd344689443ed70dcf31Xia Wangimport android.widget.ImageButton;
384a082ceeba3674fe9f08cd344689443ed70dcf31Xia Wangimport android.util.Log;
391f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wangimport android.text.TextUtils;
40540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor
41540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor/**
42540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor * Test threads with thousands of messages
43540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor * To run just this test:
44540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor *       runtest --test-class=com.android.mms.ui.MultiPartSmsTests mms
45540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor */
461f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wangpublic class MultiPartSmsTests extends SmsTest {
474a082ceeba3674fe9f08cd344689443ed70dcf31Xia Wang    private static final String TAG = "MultiPartSmsTests";
48540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor
491f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang    /* (non-Javadoc)
501f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang     * @see com.android.mms.ui.SmsTest#setUp()
511f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang     */
52540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor    @Override
53540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor    protected void setUp() throws Exception {
54540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor        super.setUp();
551f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang        // NOTE: the longer the message, the longer is takes to send and get back the
561f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang        // received message. You'll have to adjust the timeout in testLongSmsMessage().
571f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang        // I eventually paired down the message to make the test more reasonable to test.
581f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang        mMessage =
591f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang            "Is this a dagger which I see before me,"
601f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang            +" The handle toward my hand? Come, let me clutch thee."
611f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang            +" I have thee not, and yet I see thee still."
621f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang            +" Art thou not, fatal vision, sensible"
631f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang            +" To feeling as to sight? or art thou but"
641f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang            +" A dagger of the mind, a false creation,"
651f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang            +" Proceeding from the heat-oppressed brain?"
661f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang            +" I see thee yet, in form as palpable"
671f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang            +" As this which now I draw.";
681f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" Thou marshall'st me the way that I was going;"
691f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" And such an instrument I was to use."
701f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" Mine eyes are made the fools o' the other senses,"
711f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" Or else worth all the rest; I see thee still,"
721f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" And on thy blade and dudgeon gouts of blood,"
731f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" Which was not so before. There's no such thing:"
741f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" It is the bloody business which informs"
751f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" Thus to mine eyes. Now o'er the one halfworld"
761f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" Nature seems dead, and wicked dreams abuse"
771f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" The curtain'd sleep; witchcraft celebrates"
781f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" Pale Hecate's offerings, and wither'd murder,"
791f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" Alarum'd by his sentinel, the wolf,"
801f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" Whose howl's his watch, thus with his stealthy pace."
811f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" With Tarquin's ravishing strides, towards his design"
821f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" Moves like a ghost. Thou sure and firm-set earth,"
831f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" Hear not my steps, which way they walk, for fear"
841f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" Thy very stones prate of my whereabout,"
851f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" And take the present horror from the time,"
861f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" Which now suits with it. Whiles I threat, he lives:"
871f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" Words to the heat of deeds too cold breath gives."
881f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" A bell rings"
891f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" I go, and it is done; the bell invites me."
901f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" Hear it not, Duncan; for it is a knell"
911f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang//            +" That summons thee to heaven or to hell.";
924a082ceeba3674fe9f08cd344689443ed70dcf31Xia Wang    }
934a082ceeba3674fe9f08cd344689443ed70dcf31Xia Wang
94540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor    /**
95540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor     * Send a a long multi-part SMS message
96540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor     */
97540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor    @LargeTest
98540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor    public void testLongSmsMessage() throws Throwable {
991f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang        assertTrue("send & receive message failed",
1001f530d377f9ec84723d9658a9ec8c9a396a32474Xia Wang                sendAndReceiveMessage());
101540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor    }
102540d263efa2830c154fc32bbad2a7e703cf5747dTom Taylor}
103