Remove Broken ListActivityTest

Bug 3188260

It looks like there were efforts to fix this one in bug 2334738.

Change-Id: I590f92a9ea43cad2b1e7c9eba40bdea62e24410d
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index 43eb5fc..ff1582a 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -867,8 +867,6 @@
             </intent-filter>
         </service>
 
-        <activity android:name="android.app.cts.ListActivityTestHelper"
-            android:label="ListActivityTestHelper" />
         <activity android:name="android.app.ActivityGroup"
             android:label="ActivityGroup" />
 
diff --git a/tests/src/android/app/cts/ListActivityTestHelper.java b/tests/src/android/app/cts/ListActivityTestHelper.java
deleted file mode 100644
index 4e35bd8..0000000
--- a/tests/src/android/app/cts/ListActivityTestHelper.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.app.cts;
-
-import android.app.ListActivity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.View;
-import android.widget.ArrayAdapter;
-import android.widget.ListView;
-
-import com.android.cts.stub.R;
-
-public class ListActivityTestHelper extends ListActivity {
-    public ListView listView;
-    public View view;
-    public int itemPosition;
-    public long itemId;
-    public boolean isOnContentChangedCalled = false;
-    public static boolean isOnRestoreInstanceStateCalled = false;
-    public boolean isSubActivityFinished = false;
-
-    private static final int WAIT_BEFORE_FINISH = 1;
-
-    @Override
-    public void onListItemClick(ListView l, View v, int position, long id) {
-        super.onListItemClick(l, v, position, id);
-        listView = l;
-        view = v;
-        itemPosition = position;
-        itemId = id;
-    }
-
-    protected void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-        setListAdapter(new ArrayAdapter<String>(this,
-                R.layout.list_activity_layout, STRING_ITEMS));
-        Intent intent = new Intent(TestedScreen.WAIT_BEFORE_FINISH);
-        intent.setClass(this, LocalScreen.class);
-        startActivityForResult(intent, WAIT_BEFORE_FINISH);
-    }
-
-    @Override
-    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-        switch (requestCode) {
-            case WAIT_BEFORE_FINISH:
-                isSubActivityFinished = true;
-                break;
-            default:
-                break;
-        }
-    }
-
-    public static final String[] STRING_ITEMS = {
-            "Item 0", "Item 1", "Item 2", "Item 3", "Item 4", "Item 5"
-    };
-
-    @Override
-    public void onContentChanged() {
-        isOnContentChangedCalled = true;
-        super.onContentChanged();
-    }
-
-    @Override
-    protected void onRestoreInstanceState(Bundle state) {
-        isOnRestoreInstanceStateCalled = true;
-        super.onRestoreInstanceState(state);
-    }
-
-}
diff --git a/tests/tests/app/src/android/app/cts/ListActivityTest.java b/tests/tests/app/src/android/app/cts/ListActivityTest.java
deleted file mode 100644
index d3a43f9..0000000
--- a/tests/tests/app/src/android/app/cts/ListActivityTest.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.app.cts;
-
-import dalvik.annotation.BrokenTest;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
-import android.app.ListActivity;
-import android.test.ActivityInstrumentationTestCase2;
-import android.view.KeyEvent;
-import android.view.View;
-import android.widget.ArrayAdapter;
-import android.widget.ListView;
-import android.widget.TextView;
-
-@TestTargetClass(ListActivity.class)
-public class ListActivityTest extends ActivityInstrumentationTestCase2<ListActivityTestHelper> {
-    private ListActivityTestHelper mStubListActivity;
-
-    public ListActivityTest() {
-        super("com.android.cts.stub", ListActivityTestHelper.class);
-    }
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        mStubListActivity = getActivity();
-        assertNotNull(mStubListActivity);
-    }
-
-    protected void waitForAction() throws InterruptedException {
-        final long TIMEOUT_MSEC = 20000;
-        final int TIME_SLICE_MSEC = 100;
-        final long endTime = System.currentTimeMillis() + TIMEOUT_MSEC;
-        while (!mStubListActivity.isSubActivityFinished && System.currentTimeMillis() < endTime) {
-            Thread.sleep(TIME_SLICE_MSEC);
-        }
-    }
-
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "onListItemClick",
-            args = {ListView.class, View.class, int.class, long.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "getListView",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "getSelectedItemId",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "getSelectedItemPosition",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "setListAdapter",
-            args = {android.widget.ListAdapter.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "setSelection",
-            args = {int.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "getListAdapter",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "onContentChanged",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "onRestoreInstanceState",
-            args = {android.os.Bundle.class}
-        )
-    })
-    @BrokenTest(value="flaky test. bug 2334738")
-    public void testListActivity() throws Throwable {
-        waitForAction();
-        sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
-        getInstrumentation().waitForIdleSync();
-        // view should get created on list item click
-        assertNotNull(mStubListActivity.view);
-        String s = (String) ((TextView) mStubListActivity.view).getText();
-        int pos = mStubListActivity.itemPosition;
-        long id = mStubListActivity.itemId;
-        assertEquals(0, id);
-        assertEquals(0, pos);
-        assertEquals(ListActivityTestHelper.STRING_ITEMS[pos], s);
-        assertEquals(ListActivityTestHelper.STRING_ITEMS.length,
-                mStubListActivity.listView.getCount());
-        assertEquals(id, mStubListActivity.getSelectedItemId());
-        assertEquals(pos, mStubListActivity.getSelectedItemPosition());
-
-        sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
-        sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
-        s = (String) ((TextView) mStubListActivity.view).getText();
-        pos = mStubListActivity.itemPosition;
-        id = mStubListActivity.itemId;
-        assertEquals(1, id);
-        assertEquals(1, pos);
-        assertEquals(ListActivityTestHelper.STRING_ITEMS[pos], s);
-        assertEquals(ListActivityTestHelper.STRING_ITEMS.length,
-                mStubListActivity.listView.getCount());
-        assertEquals(id, mStubListActivity.getSelectedItemId());
-        assertEquals(pos, mStubListActivity.getSelectedItemPosition());
-
-        final int selectPos = 2;
-        assertTrue(mStubListActivity.isOnContentChangedCalled);
-        runTestOnUiThread(new Runnable() {
-            public void run() {
-                mStubListActivity.setSelection(selectPos);
-            }
-        });
-        sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
-        s = (String) ((TextView) mStubListActivity.view).getText();
-        pos = mStubListActivity.itemPosition;
-        id = mStubListActivity.itemId;
-        assertEquals(ListActivityTestHelper.STRING_ITEMS[selectPos], s);
-        assertEquals(ListActivityTestHelper.STRING_ITEMS.length,
-                mStubListActivity.listView.getCount());
-        assertEquals(selectPos, id);
-        assertEquals(selectPos, pos);
-        assertEquals(selectPos, mStubListActivity.getSelectedItemId());
-        assertEquals(selectPos, mStubListActivity.getSelectedItemPosition());
-
-        final ArrayAdapter<String> arrayAdapter = (ArrayAdapter<String>)
-                mStubListActivity.getListAdapter();
-        assertNotNull(arrayAdapter);
-        final String[] str = ListActivityTestHelper.STRING_ITEMS;
-        final int len = str.length;
-        assertEquals(len, arrayAdapter.getCount());
-        for (int i = 0; i < len; i++) {
-            assertEquals(str[i], arrayAdapter.getItem(i));
-        }
-
-        assertNotNull(mStubListActivity.getListView());
-        assertEquals(arrayAdapter, mStubListActivity.getListView().getAdapter());
-        assertTrue(mStubListActivity.isOnContentChangedCalled);
-        assertFalse(ListActivityTestHelper.isOnRestoreInstanceStateCalled);
-        OrientationTestUtils.toggleOrientationSync(mStubListActivity, getInstrumentation());
-        assertTrue(ListActivityTestHelper.isOnRestoreInstanceStateCalled);
-     }
-}