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 // TODO Test crashes. Fix it. 18 19 /* 20 The problem is that this test creates a partial account which will be 21 used by the activity, but the account is picked up by MailService too 22 (which is probably not intentional), which crashes because the account 23 is not properly constructed. (empty address) 24 */ 25 26 // 27 //package com.android.email.activity.setup; 28 // 29 //import com.android.email.R; 30 //import com.android.email.provider.EmailContent; 31 // 32 //import android.content.ContentUris; 33 //import android.content.Context; 34 //import android.content.Intent; 35 //import android.net.Uri; 36 //import android.test.ActivityInstrumentationTestCase2; 37 //import android.test.suitebuilder.annotation.MediumTest; 38 //import android.widget.Button; 39 // 40 ///** 41 // * Tests of basic UI logic in the AccountSetupNamesTest screen. 42 // * You can run this entire test case with: 43 // * runtest -c com.android.email.activity.setup.AccountSetupNamesTests email 44 // */ 45 //@MediumTest 46 //public class AccountSetupNamesTests extends ActivityInstrumentationTestCase2<AccountSetupNames> { 47 // private long mAccountId; 48 // private EmailContent.Account mAccount; 49 // 50 // private Context mContext; 51 // private AccountSetupNames mActivity; 52 // private Button mDoneButton; 53 // 54 // public AccountSetupNamesTests() { 55 // super(AccountSetupNames.class); 56 // } 57 // 58 // /** 59 // * Common setup code for all tests. 60 // */ 61 // @Override 62 // protected void setUp() throws Exception { 63 // super.setUp(); 64 // 65 // mContext = this.getInstrumentation().getTargetContext(); 66 // } 67 // 68 // /** 69 // * Delete any dummy accounts we set up for this test 70 // */ 71 // @Override 72 // protected void tearDown() throws Exception { 73 // if (mAccount != null) { 74 // Uri uri = ContentUris.withAppendedId( 75 // EmailContent.Account.CONTENT_URI, mAccountId); 76 // mContext.getContentResolver().delete(uri, null, null); 77 // } 78 // 79 // // must call last because it scrubs member variables 80 // super.tearDown(); 81 // } 82 // 83 // /** 84 // * Test a "good" account name (enables the button) 85 // */ 86 // public void testGoodAccountName() { 87 // Intent i = getTestIntent("imap", "GoodName"); 88 // this.setActivityIntent(i); 89 // 90 // getActivityAndFields(); 91 // 92 // assertTrue(mDoneButton.isEnabled()); 93 // } 94 // 95 // /** 96 // * Test a "bad" account name (disables the button) 97 // */ 98 // public void testBadAccountName() { 99 // Intent i = getTestIntent("imap", ""); 100 // this.setActivityIntent(i); 101 // 102 // getActivityAndFields(); 103 // 104 // assertFalse(mDoneButton.isEnabled()); 105 // } 106 // 107 // /** 108 // * Test a "bad" account name (disables the button) 109 // */ 110 // public void testEasAccountName() { 111 // Intent i = getTestIntent("eas", ""); 112 // this.setActivityIntent(i); 113 // 114 // getActivityAndFields(); 115 // 116 // assertTrue(mDoneButton.isEnabled()); 117 // } 118 // 119 // /** 120 // * Get the activity (which causes it to be started, using our intent) and get the UI fields 121 // */ 122 // private void getActivityAndFields() { 123 // mActivity = getActivity(); 124 // mDoneButton = (Button) mActivity.findViewById(R.id.done); 125 // } 126 // 127 // /** 128 // * Create an intent with the Account in it, using protocol as the protocol and name as the 129 // * user's sender name 130 // */ 131 // private Intent getTestIntent(String protocol, String name) { 132 // mAccount = new EmailContent.Account(); 133 // mAccount.setSenderName(name); 134 // HostAuth hostAuth = new HostAuth(); 135 // hostAuth.mProtocol = protocol; 136 // mAccount.mHostAuthRecv = hostAuth; 137 // mAccount.save(mContext); 138 // mAccountId = mAccount.mId; 139 // SetupData.init(SetupData.FLOW_MODE_NORMAL, mAccount); 140 // return new Intent(Intent.ACTION_MAIN); 141 // } 142 //} 143