From bd4288f41879d08dd33802f0429314afc30dc883 Mon Sep 17 00:00:00 2001 From: Brett Chabot Date: Thu, 1 Apr 2010 11:53:05 -0700 Subject: [PATCH] Remove FrameworkTest package. The only remaining test here was RingtonePickerActivityTes, which has been suppressed since pre-donut. Change-Id: I74c08c9c9447b67252430db3b462373af879bd1d --- CleanSpec.mk | 2 + tests/FrameworkTest/Android.mk | 15 -- tests/FrameworkTest/AndroidManifest.xml | 54 ----- tests/FrameworkTest/README | 8 - tests/FrameworkTest/res/values/styles.xml | 22 -- .../FrameworkTestApplication.java | 35 --- .../performance/InvalidateCycle.java | 65 ----- .../RingtonePickerActivityLauncher.java | 79 ------ tests/FrameworkTest/tests/Android.mk | 17 -- tests/FrameworkTest/tests/AndroidManifest.xml | 34 --- .../settings/RingtonePickerActivityTest.java | 227 ------------------ 11 files changed, 2 insertions(+), 556 deletions(-) delete mode 100644 tests/FrameworkTest/Android.mk delete mode 100644 tests/FrameworkTest/AndroidManifest.xml delete mode 100644 tests/FrameworkTest/README delete mode 100644 tests/FrameworkTest/res/values/styles.xml delete mode 100644 tests/FrameworkTest/src/com/android/frameworktest/FrameworkTestApplication.java delete mode 100644 tests/FrameworkTest/src/com/android/frameworktest/performance/InvalidateCycle.java delete mode 100644 tests/FrameworkTest/src/com/android/frameworktest/settings/RingtonePickerActivityLauncher.java delete mode 100644 tests/FrameworkTest/tests/Android.mk delete mode 100644 tests/FrameworkTest/tests/AndroidManifest.xml delete mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/settings/RingtonePickerActivityTest.java diff --git a/CleanSpec.mk b/CleanSpec.mk index 417f7646039ef..707404ba39811 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -50,6 +50,8 @@ $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framew $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/com/android/internal/backup) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/app) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/content) +$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/FrameworkTest_intermediates/) + # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST diff --git a/tests/FrameworkTest/Android.mk b/tests/FrameworkTest/Android.mk deleted file mode 100644 index 61cdbfa5617eb..0000000000000 --- a/tests/FrameworkTest/Android.mk +++ /dev/null @@ -1,15 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := tests - -# Only compile source java files in this apk. -LOCAL_SRC_FILES := $(call all-java-files-under, src) - -LOCAL_JAVA_LIBRARIES := android.test.runner - -LOCAL_PACKAGE_NAME := FrameworkTest - -include $(BUILD_PACKAGE) -# Use the following include to make our test apk. -include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/tests/FrameworkTest/AndroidManifest.xml b/tests/FrameworkTest/AndroidManifest.xml deleted file mode 100644 index 4db8952066600..0000000000000 --- a/tests/FrameworkTest/AndroidManifest.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/FrameworkTest/README b/tests/FrameworkTest/README deleted file mode 100644 index d6d0042605c5d..0000000000000 --- a/tests/FrameworkTest/README +++ /dev/null @@ -1,8 +0,0 @@ -FrameworkTestApplication should hold snippets of functionality that are -helpful for testing the UI framework code, but not appropriate for -sample code. For instance, a layout contrived to exercise an edge case -of scrolling behavior. - -InstrumentationTestCases should be added under tests and added to the -list of tests in FrameworkInstrumentationTestRunner. - diff --git a/tests/FrameworkTest/res/values/styles.xml b/tests/FrameworkTest/res/values/styles.xml deleted file mode 100644 index 7a90197c5b663..0000000000000 --- a/tests/FrameworkTest/res/values/styles.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - diff --git a/tests/FrameworkTest/src/com/android/frameworktest/FrameworkTestApplication.java b/tests/FrameworkTest/src/com/android/frameworktest/FrameworkTestApplication.java deleted file mode 100644 index c57b9973ca4c1..0000000000000 --- a/tests/FrameworkTest/src/com/android/frameworktest/FrameworkTestApplication.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2007 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 com.android.frameworktest; - -import android.app.LauncherActivity; -import android.content.Intent; - -/** - * Holds little snippets of functionality used as code under test for - * instrumentation tests of framework code. - */ -public class FrameworkTestApplication extends LauncherActivity { - - protected Intent getTargetIntent() { - // TODO: partition into categories by label like the sample code app - Intent targetIntent = new Intent(Intent.ACTION_MAIN, null); - targetIntent.addCategory(Intent.CATEGORY_FRAMEWORK_INSTRUMENTATION_TEST); - targetIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - return targetIntent; - } -} diff --git a/tests/FrameworkTest/src/com/android/frameworktest/performance/InvalidateCycle.java b/tests/FrameworkTest/src/com/android/frameworktest/performance/InvalidateCycle.java deleted file mode 100644 index 22bb46f993f17..0000000000000 --- a/tests/FrameworkTest/src/com/android/frameworktest/performance/InvalidateCycle.java +++ /dev/null @@ -1,65 +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 com.android.frameworktest.performance; - -import android.app.Activity; -import android.os.Bundle; -import android.os.Debug; -import android.os.Handler; -import android.view.View; -import android.view.ViewGroup; -import android.content.Context; -import android.graphics.Canvas; - -public class InvalidateCycle extends Activity { - private boolean mStartProfiling; - private InvalidateCycle.AutoInvalidateView mView; - - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - mView = new AutoInvalidateView(this); - mView.setLayoutParams(new ViewGroup.LayoutParams(16, 16)); - setContentView(mView); - - new Handler().postDelayed(new Runnable() { - public void run() { - mStartProfiling = true; - android.util.Log.d("Performance", "Profiling started"); - Debug.startMethodTracing("invalidateCycle"); - mView.invalidate(); - } - }, 15000); - } - - private class AutoInvalidateView extends View { - private boolean mFirstDraw; - - public AutoInvalidateView(Context context) { - super(context); - } - - protected void onDraw(Canvas canvas) { - if (mStartProfiling && !mFirstDraw) { - Debug.stopMethodTracing(); - android.util.Log.d("Performance", "Profiling ended"); - mFirstDraw = true; - } - canvas.drawColor(0xFFFF0000); - } - } -} diff --git a/tests/FrameworkTest/src/com/android/frameworktest/settings/RingtonePickerActivityLauncher.java b/tests/FrameworkTest/src/com/android/frameworktest/settings/RingtonePickerActivityLauncher.java deleted file mode 100644 index 19113dac6c14c..0000000000000 --- a/tests/FrameworkTest/src/com/android/frameworktest/settings/RingtonePickerActivityLauncher.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2007 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 com.android.frameworktest.settings; - -import com.android.internal.app.RingtonePickerActivity; - -import android.app.Activity; -import android.content.Intent; -import android.media.RingtoneManager; -import android.net.Uri; -import android.os.Bundle; - -/** - * Activity that will launch the RingtonePickerActivity as a subactivity, and - * waits for its result. - */ -public class RingtonePickerActivityLauncher extends Activity { - - private static final String TAG = "RingtonePickerActivityLauncher"; - - public boolean resultReceived = false; - - public int resultCode; - public Intent result; - - public Uri pickedUri; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setContentView(android.R.layout.simple_list_item_1); - } - - /** - * Launches the {@link RingtonePickerActivity} and blocks until it returns. - * - * @param showDefault {@link RingtonePickerActivity#EXTRA_SHOW_DEFAULT} - * @param existingUri {@link RingtonePickerActivity#EXTRA_EXISTING_URI} - * @param filterColumns {@link RingtonePickerActivity#EXTRA_RINGTONE_COLUMNS} - */ - public void launchRingtonePickerActivity(boolean showDefault, Uri existingUri, - int types) { - Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER); - intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, showDefault); - intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, existingUri); - intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, types); - startActivityForResult(intent, 0); - } - - @Override - protected void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - - resultReceived = true; - - this.resultCode = resultCode; - this.result = data; - - if (data != null) { - this.pickedUri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI); - } - } - -} diff --git a/tests/FrameworkTest/tests/Android.mk b/tests/FrameworkTest/tests/Android.mk deleted file mode 100644 index 5c546841e9437..0000000000000 --- a/tests/FrameworkTest/tests/Android.mk +++ /dev/null @@ -1,17 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -# We only want this apk build for tests. -LOCAL_MODULE_TAGS := tests - -# Include all test java files. -LOCAL_SRC_FILES := $(call all-subdir-java-files) - -LOCAL_JAVA_LIBRARIES := android.test.runner - -LOCAL_PACKAGE_NAME := FrameworkTestTests - -LOCAL_INSTRUMENTATION_FOR := FrameworkTest - -include $(BUILD_PACKAGE) - diff --git a/tests/FrameworkTest/tests/AndroidManifest.xml b/tests/FrameworkTest/tests/AndroidManifest.xml deleted file mode 100644 index 65aaebb455bc7..0000000000000 --- a/tests/FrameworkTest/tests/AndroidManifest.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/settings/RingtonePickerActivityTest.java b/tests/FrameworkTest/tests/src/com/android/frameworktest/settings/RingtonePickerActivityTest.java deleted file mode 100644 index 42888ff39270d..0000000000000 --- a/tests/FrameworkTest/tests/src/com/android/frameworktest/settings/RingtonePickerActivityTest.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright (C) 2007 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 com.android.frameworktest.settings; - -import com.android.frameworktest.settings.RingtonePickerActivityLauncher; - -import android.app.Instrumentation; -import android.database.Cursor; -import android.media.RingtoneManager; -import android.net.Uri; -import android.provider.MediaStore; -import android.test.ActivityInstrumentationTestCase; -import android.test.suitebuilder.annotation.Suppress; -import android.view.KeyEvent; - -/** - * Tests the RingtonePickerActivity. - *

- * There is a launcher for launching the RingtonePickerActivity (RPA) since the RPA needs - * to be a subactivity. We don't have a reference to the actual RPA. - *

- * This relies heavily on keypresses getting to the right widget. It depends on: - *

  • Less than NUM_RINGTONES_AND_SOME ringtones on the system - *
  • Pressing arrow-down a ton will eventually end up on the 'Cancel' button - *
  • From the 'Cancel' button, pressing arrow-left will end up on 'OK' button - */ -@Suppress -public class RingtonePickerActivityTest extends ActivityInstrumentationTestCase { - - private static final int NUM_RINGTONES_AND_SOME = 20; - private RingtonePickerActivityLauncher mActivity; - private Instrumentation mInstrumentation; - - public RingtonePickerActivityTest() { - super("com.android.frameworktest", RingtonePickerActivityLauncher.class); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - - mActivity = getActivity(); - mInstrumentation = getInstrumentation(); - assertNotNull(mActivity); - assertFalse(mActivity.resultReceived); - assertNotNull(mInstrumentation); - } - - public void testDefault() { - mActivity.launchRingtonePickerActivity(true, null, RingtoneManager.TYPE_ALL); - mInstrumentation.waitForIdleSync(); - - // Go to top - goTo(true); - // Select default ringtone - sendKeys(KeyEvent.KEYCODE_DPAD_CENTER); - // Go to bottom/cancel button - goTo(false); - // Select OK button - sendKeys(KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_DPAD_CENTER); - - mInstrumentation.waitForIdleSync(); - - assertTrue(mActivity.resultReceived); - assertNotNull(mActivity.result); - assertTrue(RingtoneManager.isDefault(mActivity.pickedUri)); - } - - public void testFirst() { - mActivity.launchRingtonePickerActivity(true, null, RingtoneManager.TYPE_ALL); - mInstrumentation.waitForIdleSync(); - - // Go to top - goTo(true); - // Select first (non-default) ringtone - sendKeys(KeyEvent.KEYCODE_DPAD_DOWN, KeyEvent.KEYCODE_DPAD_CENTER); - // Go to bottom/cancel button - goTo(false); - // Select OK button - sendKeys(KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_DPAD_CENTER); - - mInstrumentation.waitForIdleSync(); - - assertTrue(mActivity.resultReceived); - assertNotNull(mActivity.result); - assertNotNull(mActivity.pickedUri); - assertFalse(RingtoneManager.isDefault(mActivity.pickedUri)); - } - - public void testExisting() { - // We need to get an existing ringtone first, so launch it, pick first, - // and keep that URI - testFirst(); - Uri firstUri = mActivity.pickedUri; - - mActivity.launchRingtonePickerActivity(true, firstUri, RingtoneManager.TYPE_ALL); - mInstrumentation.waitForIdleSync(); - - //// Hit cancel: - - // Go to bottom - goTo(false); - // Select Cancel button - sendKeys(KeyEvent.KEYCODE_DPAD_CENTER); - - mInstrumentation.waitForIdleSync(); - - assertTrue(mActivity.resultReceived); - assertEquals(mActivity.pickedUri, firstUri); - } - - public void testExistingButDifferent() { - // We need to get an existing ringtone first, so launch it, pick first, - // and keep that URI - testFirst(); - Uri firstUri = mActivity.pickedUri; - - mActivity.launchRingtonePickerActivity(true, firstUri, RingtoneManager.TYPE_ALL); - mInstrumentation.waitForIdleSync(); - - //// Pick second: - - // Go to top - goTo(true); - // Select second (non-default) ringtone - sendKeys(KeyEvent.KEYCODE_DPAD_DOWN, KeyEvent.KEYCODE_DPAD_DOWN, - KeyEvent.KEYCODE_DPAD_CENTER); - // Go to bottom/cancel button - goTo(false); - // Select OK button - sendKeys(KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_DPAD_CENTER); - - mInstrumentation.waitForIdleSync(); - - assertTrue(mActivity.resultReceived); - assertNotNull(mActivity.result); - assertTrue(!firstUri.equals(mActivity.pickedUri)); - } - - public void testCancel() { - mActivity.launchRingtonePickerActivity(true, null, RingtoneManager.TYPE_ALL); - mInstrumentation.waitForIdleSync(); - - // Go to bottom - goTo(false); - // Select Cancel button - sendKeys(KeyEvent.KEYCODE_DPAD_CENTER); - - mInstrumentation.waitForIdleSync(); - - assertTrue(mActivity.resultReceived); - assertNull(mActivity.result); - } - - public void testNoDefault() { - mActivity.launchRingtonePickerActivity(false, null, RingtoneManager.TYPE_ALL); - mInstrumentation.waitForIdleSync(); - - // Go to top - goTo(true); - // Select first (non-default) ringtone - sendKeys(KeyEvent.KEYCODE_DPAD_CENTER); - // Go to bottom/cancel button - goTo(false); - // Select OK button - sendKeys(KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_DPAD_CENTER); - - mInstrumentation.waitForIdleSync(); - - assertTrue(mActivity.resultReceived); - assertNotNull(mActivity.result); - assertNotNull(mActivity.pickedUri); - assertFalse(RingtoneManager.isDefault(mActivity.pickedUri)); - } - - public void testNotifications() { - mActivity.launchRingtonePickerActivity(false, null, RingtoneManager.TYPE_NOTIFICATION); - mInstrumentation.waitForIdleSync(); - - // Move to top of list - goTo(true); - // Select first ringtone in list - sendKeys(KeyEvent.KEYCODE_DPAD_CENTER); - // Move all the way down (will focus 'Cancel') - goTo(false); - // Move left and click (will click 'Ok') - sendKeys(KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_DPAD_CENTER); - - // Wait until main thread is idle - mInstrumentation.waitForIdleSync(); - - assertTrue(mActivity.resultReceived); - assertNotNull(mActivity.result); - assertNotNull(mActivity.pickedUri); - - // Get the path of the picked ringtone - Uri uri = mActivity.pickedUri; - Cursor c = mActivity.getContentResolver().query(uri, new String[] { "_data" }, - null, null, null); - assertTrue("Query for selected ringtone URI does not have a result", c.moveToFirst()); - String path = c.getString(0); - // Quick check to see if the ringtone is a notification - assertTrue("The path of the selected ringtone did not contain \"notification\"", - path.contains("notifications")); - } - - private void goTo(boolean top) { - // Get to the buttons at the bottom (top == false), or the top (top == true) - for (int i = 0; i < NUM_RINGTONES_AND_SOME; i++) { - sendKeys(top ? KeyEvent.KEYCODE_DPAD_UP : KeyEvent.KEYCODE_DPAD_DOWN); - } - } -}