am 76b306d5: Merge "Specify Content Length in CtsTestServer" into froyo
Merge commit '76b306d57c03f860376006d8f1e23f0576145421' into gingerbread
* commit '76b306d57c03f860376006d8f1e23f0576145421':
Specify Content Length in CtsTestServer
diff --git a/development/ide/eclipse/.classpath b/development/ide/eclipse/.classpath
deleted file mode 100644
index 841158a..0000000
--- a/development/ide/eclipse/.classpath
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="cts/tests/ApiDemosReferenceTest/src"/>
- <classpathentry kind="src" path="cts/tests/ProcessTest/src"/>
- <classpathentry kind="src" path="cts/tests/ProcessTest/NoShareUidApp/src"/>
- <classpathentry kind="src" path="cts/tests/ProcessTest/ShareUidApp/src"/>
- <classpathentry kind="src" path="cts/tests/SignatureTest/src"/>
- <classpathentry kind="src" path="cts/tests/SignatureTest/tests/src"/>
- <classpathentry kind="src" path="cts/tests/accessibilityservice/src"/>
- <classpathentry kind="src" path="cts/tests/appsecurity-tests/src"/>
- <classpathentry kind="src" path="cts/tests/core/runner/src"/>
- <classpathentry kind="src" path="cts/tests/src"/>
- <classpathentry kind="src" path="cts/tests/tests/accessibilityservice/src"/>
- <classpathentry kind="src" path="cts/tests/tests/accounts/src"/>
- <classpathentry kind="src" path="cts/tests/tests/app/src"/>
- <classpathentry kind="src" path="cts/tests/tests/bluetooth/src"/>
- <classpathentry kind="src" path="cts/tests/tests/content/src"/>
- <classpathentry kind="src" path="cts/tests/tests/database/src"/>
- <classpathentry kind="src" path="cts/tests/tests/dpi/src"/>
- <classpathentry kind="src" path="cts/tests/tests/dpi2/src"/>
- <classpathentry kind="src" path="cts/tests/tests/example/src"/>
- <classpathentry kind="src" path="cts/tests/tests/gesture/src"/>
- <classpathentry kind="src" path="cts/tests/tests/graphics/src"/>
- <classpathentry kind="src" path="cts/tests/tests/hardware/src"/>
- <classpathentry kind="src" path="cts/tests/tests/jni/src"/>
- <classpathentry kind="src" path="cts/tests/tests/location/src"/>
- <classpathentry kind="src" path="cts/tests/tests/media/src"/>
- <classpathentry kind="src" path="cts/tests/tests/net/src"/>
- <classpathentry kind="src" path="cts/tests/tests/os/src"/>
- <classpathentry kind="src" path="cts/tests/tests/performance/src"/>
- <classpathentry kind="src" path="cts/tests/tests/performance2/src"/>
- <classpathentry kind="src" path="cts/tests/tests/performance3/src"/>
- <classpathentry kind="src" path="cts/tests/tests/performance4/src"/>
- <classpathentry kind="src" path="cts/tests/tests/performance5/src"/>
- <classpathentry kind="src" path="cts/tests/tests/permission/src"/>
- <classpathentry kind="src" path="cts/tests/tests/permission2/src"/>
- <classpathentry kind="src" path="cts/tests/tests/provider/src"/>
- <classpathentry kind="src" path="cts/tests/tests/speech/src"/>
- <classpathentry kind="src" path="cts/tests/tests/telephony/src"/>
- <classpathentry kind="src" path="cts/tests/tests/text/src"/>
- <classpathentry kind="src" path="cts/tests/tests/util/src"/>
- <classpathentry kind="src" path="cts/tests/tests/view/src"/>
- <classpathentry kind="src" path="cts/tests/tests/webkit/src"/>
- <classpathentry kind="src" path="cts/tests/tests/widget/src"/>
- <classpathentry kind="src" path="cts/tools/annotation-helper/src"/>
- <classpathentry kind="src" path="cts/tools/cts-reference-app-lib/src"/>
- <classpathentry kind="src" path="cts/tools/dasm/src"/>
- <classpathentry kind="src" path="cts/tools/device-setup/TestDeviceSetup/src"/>
- <classpathentry kind="src" path="cts/tools/dex-tools/src"/>
- <classpathentry kind="src" path="cts/tools/dx-tests/src"/>
- <classpathentry kind="src" path="cts/tools/host/src"/>
- <classpathentry kind="src" path="cts/tools/host/test"/>
- <classpathentry kind="src" path="cts/tools/signature-tools/src"/>
- <classpathentry kind="src" path="cts/tools/signature-tools/test"/>
- <classpathentry kind="src" path="cts/tools/spec-progress/src"/>
- <classpathentry kind="src" path="cts/tools/test-progress-new/src"/>
- <classpathentry kind="src" path="cts/tools/utils"/>
- <classpathentry kind="src" path="cts/tools/vm-tests/src"/>
- <classpathentry kind="src" path="out/target/common/obj/APPS/CtsTestStubs_intermediates/src/src"/>
- <classpathentry kind="src" path="out/target/common/obj/APPS/CtsAccessibilityServiceTestCases_intermediates/src/src"/>
-</classpath>
diff --git a/development/ide/eclipse/genclasspath.sh b/development/ide/eclipse/genclasspath.sh
deleted file mode 100755
index 00ee9b3..0000000
--- a/development/ide/eclipse/genclasspath.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-# Outputs a classpath file containing classpaths from development/ide/eclipse
-# and additional classpaths from cts/development/ide/eclipse.
-#
-# From your $ANDROID_BUILD_TOP directory:
-# ./cts/development/ide/eclipse/genclasspath.sh > .classpath
-
-if [[ -z $ANDROID_BUILD_TOP ]]; then
- echo "Run 'lunch' to set \$ANDROID_BUILD_TOP" >&2
- exit 1
-fi
-
-echo '<?xml version="1.0" encoding="UTF-8"?>'
-echo '<classpath>'
-cat $ANDROID_BUILD_TOP/cts/development/ide/eclipse/.classpath | grep classpathentry
-cat $ANDROID_BUILD_TOP/development/ide/eclipse/.classpath | grep classpathentry
-echo '</classpath>'
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index cdddffc..e5f1416 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -551,22 +551,6 @@
android:screenOrientation="landscape">
</activity>
- <activity android:name="android.view.inputmethod.cts.InputMethodStubActivity"
- android:label="InputMethodStubActivity">
- <intent-filter>
- <action android:name="android.intent.action.MAIN"/>
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
- <service android:name="android.view.inputmethod.cts.InputMethodInfoStub"
- android:label="InputMethodInfoStub">
- <intent-filter>
- <action android:name="android.view.InputMethod" />
- </intent-filter>
- <meta-data android:name="android.view.im"
- android:resource="@xml/method" />
- </service>
-
<activity android:name="android.view.cts.MenuInflaterStubActivity"
android:label="MenuInflaterStubActivity">
<intent-filter>
@@ -903,9 +887,7 @@
</service>
<service android:name="android.app.cts.IntentServiceStub"/>
- <activity android:name="android.app.cts.LaunchpadActivity"
- android:configChanges="keyboardHidden|orientation"
- android:multiprocess="true">
+ <activity android:name="android.app.cts.LaunchpadActivity" android:multiprocess="true">
</activity>
<service android:name="android.content.cts.MockSyncAdapterService" android:exported="true">
@@ -927,9 +909,6 @@
android:resource="@xml/authenticator" />
</service>
- <activity android:name="android.opengl.cts.GLSurfaceViewStubActivity"
- android:label="GLSurfaceViewStub"/>
-
</application>
<!--Test for PackageManager, please put this at the very beginning-->
diff --git a/tests/ProcessTest/Android.mk b/tests/ProcessTest/Android.mk
index be1e7de..ba58e87 100644
--- a/tests/ProcessTest/Android.mk
+++ b/tests/ProcessTest/Android.mk
@@ -20,7 +20,7 @@
# and when built explicitly put it in the data partition
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_JAVA_LIBRARIES := framework-tests android.test.runner
+LOCAL_JAVA_LIBRARIES := android.test.runner
LOCAL_AAPT_FLAGS = -c xx_YY -c cs
diff --git a/tests/accessibilityservice/Android.mk b/tests/accessibilityservice/Android.mk
deleted file mode 100644
index 50fe6b0..0000000
--- a/tests/accessibilityservice/Android.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SRC_FILES += \
- src/android/accessibilityservice/IAccessibilityServiceDelegate.aidl \
- src/android/accessibilityservice/IAccessibilityServiceDelegateConnection.aidl
-
-LOCAL_PACKAGE_NAME := CtsDelegatingAccessibilityService
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/tests/accessibilityservice/AndroidManifest.xml b/tests/accessibilityservice/AndroidManifest.xml
deleted file mode 100644
index 29164bc..0000000
--- a/tests/accessibilityservice/AndroidManifest.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
- * Copyright (C) 2010 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.
- -->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="android.accessibilityservice.delegate">
-
- <application>
-
- <uses-library android:name="android.test.runner"/>
-
- <service android:name=".DelegatingAccessibilityService"
- android:label="@string/title_delegating_accessibility_service">
- <intent-filter>
- <action android:name="android.accessibilityservice.AccessibilityService"/>
- </intent-filter>
- </service>
-
- <service android:name=".DelegatingAccessibilityService$DelegatingConnectionService"
- android:exported="true"/>
-
- </application>
-
-</manifest>
diff --git a/tests/accessibilityservice/res/values/strings.xml b/tests/accessibilityservice/res/values/strings.xml
deleted file mode 100644
index 4c717c1..0000000
--- a/tests/accessibilityservice/res/values/strings.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright (C) 2010 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.
--->
-
-<resources>
-
- <!-- String title of the mock accessibility service -->
- <string name="title_delegating_accessibility_service">Delegating Accessibility Service</string>
-
- <!-- String title of the accessibility end-to-end test activity -->
- <string name="accessibility_end_to_end_test_activity">End-to-end test</string>
-
- <!-- String value of used as text input -->
- <string name="text_input_blah">Blah</string>
-
- <!-- String value of used as text input -->
- <string name="text_input_blah_blah">Blah blah</string>
-
- <!-- String title of the button -->
- <string name="button_title">Click me</string>
-
- <!-- String value of the first list item -->
- <string name="first_list_item">First list item</string>
-
- <!-- String value of the second list item -->
- <string name="second_list_item">Second list item</string>
-
- <!-- String alert title -->
- <string name="alert_title">Alert title</string>
-
- <!-- String alert message -->
- <string name="alert_message">Alert message</string>
-
- <!-- String notification message -->
- <string name="notification_message">Notification message</string>
-
-</resources>
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegate.aidl b/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegate.aidl
deleted file mode 100644
index b5ebf19..0000000
--- a/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegate.aidl
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2010 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.accessibilityservice;
-
-import android.view.accessibility.AccessibilityEvent;
-
-/**
- * Interface for interacting with the accessibility service mock.
- */
-interface IAccessibilityServiceDelegate {
-
- /**
- * Delegate an {@link android.view.accessibility.AccessibilityEvent}.
- */
- void onAccessibilityEvent(in AccessibilityEvent event);
-
- /**
- * Delegate an interrupt request.
- */
- void onInterrupt();
-}
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegateConnection.aidl b/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegateConnection.aidl
deleted file mode 100644
index 62703dc..0000000
--- a/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegateConnection.aidl
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2010 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.accessibilityservice;
-
-import android.os.IBinder;
-
-/**
- * Interface for registering an accessibility service delegate.
- */
-oneway interface IAccessibilityServiceDelegateConnection {
-
- /**
- * Sets the delegate interface to which the
- * {@link DelegatingAccessibilityService} to delegate.
- */
- void setAccessibilityServiceDelegate(in IBinder binder);
-}
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/delegate/DelegatingAccessibilityService.java b/tests/accessibilityservice/src/android/accessibilityservice/delegate/DelegatingAccessibilityService.java
deleted file mode 100644
index 37a9c54..0000000
--- a/tests/accessibilityservice/src/android/accessibilityservice/delegate/DelegatingAccessibilityService.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (C) 2010 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.accessibilityservice.delegate;
-
-import android.accessibilityservice.AccessibilityService;
-import android.accessibilityservice.AccessibilityServiceInfo;
-import android.accessibilityservice.IAccessibilityServiceDelegate;
-import android.accessibilityservice.IAccessibilityServiceDelegateConnection;
-import android.app.Service;
-import android.content.Intent;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.util.Log;
-import android.view.accessibility.AccessibilityEvent;
-
-/**
- * This class is an accessibility service mock to which the system is bound and
- * exposes a mock interface to the CTS accessibility tests.
- * </p>
- * Note: The end-to-end test is composed of two APKs, one with a mock accessibility
- * service, another with the instrumented activity and test cases. The
- * motivation for two APKs design is that CTS tests cannot access the secure
- * settings which is required for enabling accessibility and accessibility
- * services. Therefore, manual installation of this package is required. Once
- * the package has been installed accessibility must be enabled (Settings ->
- * Accessibility), the mock service must be enabled (Settings -> Accessibility
- * -> Mock Accessibility Service), and then the CTS tests in this package
- * <strong>CtsAccessibilityServiceTestCases.apk</strong> located in
- * <strong>cts/tests/tests/accessibility</strong> can be successfully run.
- * Further, the mock and tests run in separate processes since the
- * instrumentation restarts the process in which it is running and this breaks
- * the binding between the mock accessibility service and the system.
- */
-public class DelegatingAccessibilityService extends AccessibilityService {
-
- /**
- * Tag used for logging.
- */
- private static final String LOG_TAG = "AccessibilityServiceDelegate";
-
- /**
- * Handle to the instance used by the accessibility service connection.
- */
- static DelegatingAccessibilityService sServiceDelegate;
-
- /**
- * Interface for delegating events and interrupt requests.
- */
- private IAccessibilityServiceDelegate mDelegateInterface;
-
- @Override
- protected void onServiceConnected() {
- AccessibilityServiceInfo info = new AccessibilityServiceInfo();
- info.eventTypes = AccessibilityEvent.TYPES_ALL_MASK;
- info.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC;
- info.packageNames = new String[] {
- "com.android.cts.accessibilityservice"
- };
- setServiceInfo(info);
-
- // the service is ready to be used only
- // after the system has bound to it
- sServiceDelegate = this;
- }
-
- @Override
- public void onAccessibilityEvent(AccessibilityEvent event) {
- if (mDelegateInterface == null) {
- return;
- }
-
- try {
- mDelegateInterface.onAccessibilityEvent(event);
- } catch (RemoteException re) {
- Log.i(LOG_TAG, "Dead: " + mDelegateInterface.toString() + " cleaning up.");
- mDelegateInterface = null;
- }
- }
-
- @Override
- public void onInterrupt() {
- if (mDelegateInterface == null) {
- return;
- }
-
- try {
- mDelegateInterface.onInterrupt();
- } catch (RemoteException re) {
- Log.i(LOG_TAG, "Dead: " + mDelegateInterface.toString() + " cleaning up.");
- mDelegateInterface = null;
- }
- }
-
- /**
- * Sets the interface to which to delegate.
- *
- * @param delegateInterface The delegate interface.
- */
- private void setDelegateInterface(IAccessibilityServiceDelegate delegateInterface) {
- mDelegateInterface = delegateInterface;
- }
-
- /**
- * This is a service to which the end-to-end CTS test connects to pass a
- * delegate interface to which the {@link DelegatingAccessibilityService}
- * to delegate.
- */
- public static class DelegatingConnectionService extends Service {
-
- @Override
- public IBinder onBind(Intent intent) {
- if (sServiceDelegate == null) {
- return null;
- }
- return new AccessibilityServiceDelegateConnection();
- }
-
- /**
- * This class is the connection wrapper passed to the end-to-end CTS
- * test, so the latter can pass a delegating interface.
- */
- private class AccessibilityServiceDelegateConnection extends
- IAccessibilityServiceDelegateConnection.Stub {
-
- public void setAccessibilityServiceDelegate(IBinder binder) {
- sServiceDelegate.setDelegateInterface(IAccessibilityServiceDelegate.Stub
- .asInterface(binder));
- }
- }
- }
-}
diff --git a/tests/appsecurity-tests/src/com/android/cts/appsecurity/AppSecurityTests.java b/tests/appsecurity-tests/src/com/android/cts/appsecurity/AppSecurityTests.java
index f528ee1..a4f85a1 100644
--- a/tests/appsecurity-tests/src/com/android/cts/appsecurity/AppSecurityTests.java
+++ b/tests/appsecurity-tests/src/com/android/cts/appsecurity/AppSecurityTests.java
@@ -166,15 +166,18 @@
getTestAppFilePath(TARGET_INSTRUMENT_APK), false);
assertNull("failed to install target instrumentation app", installResult);
- // the app will install, but will get error at runtime when starting instrumentation
+ // the app will install, but will get error at runtime
installResult = getDevice().installPackage(getTestAppFilePath(INSTRUMENT_DIFF_CERT_APK),
false);
assertNull("failed to install instrumentation app with diff cert", installResult);
- // run INSTRUMENT_DIFF_CERT_PKG tests
- // this test will attempt to call startInstrumentation directly and verify
- // SecurityException is thrown
- assertTrue("running instrumentation with diff cert unexpectedly succeeded",
- runDeviceTests(INSTRUMENT_DIFF_CERT_PKG));
+ // run INSTRUMENT_DIFF_CERT_PKG tests - expect the test run to fail
+ String runResults = runDeviceTestsWithRunResult(INSTRUMENT_DIFF_CERT_PKG);
+ assertNotNull("running instrumentation with diff cert unexpectedly succeeded",
+ runResults);
+ String msg = String.format("Unexpected error message result from %s. Received %s",
+ "instrumentation with diff cert. Expected starts with Permission Denial",
+ runResults);
+ assertTrue(msg, runResults.startsWith("Permission Denial"));
}
finally {
getDevice().uninstallPackage(TARGET_INSTRUMENT_PKG);
@@ -225,8 +228,9 @@
*
* @param pkgName Android application package for tests
* @return <code>true</code> if all tests passed.
+ * @throws IOException if connection to device was lost
*/
- private boolean runDeviceTests(String pkgName) {
+ private boolean runDeviceTests(String pkgName) throws IOException {
CollectingTestRunListener listener = doRunTests(pkgName);
return listener.didAllTestsPass();
}
@@ -235,14 +239,27 @@
* Helper method to run tests and return the listener that collected the results.
* @param pkgName Android application package for tests
* @return the {@link CollectingTestRunListener}
+ * @throws IOException if connection to device was lost
*/
- private CollectingTestRunListener doRunTests(String pkgName) {
+ private CollectingTestRunListener doRunTests(String pkgName) throws IOException {
RemoteAndroidTestRunner testRunner = new RemoteAndroidTestRunner(pkgName, getDevice());
CollectingTestRunListener listener = new CollectingTestRunListener();
testRunner.run(listener);
return listener;
}
+ /**
+ * Helper method to run the specified packages tests, and return the test run error message.
+ *
+ * @param pkgName Android application package for tests
+ * @return the test run error message or <code>null</code> if test run completed.
+ * @throws IOException if connection to device was lost
+ */
+ private String runDeviceTestsWithRunResult(String pkgName) throws IOException {
+ CollectingTestRunListener listener = doRunTests(pkgName);
+ return listener.getTestRunErrorMessage();
+ }
+
private static class CollectingTestRunListener implements ITestRunListener {
private boolean mAllTestsPassed = true;
diff --git a/tests/appsecurity-tests/test-apps/InstrumentationAppDiffCert/AndroidManifest.xml b/tests/appsecurity-tests/test-apps/InstrumentationAppDiffCert/AndroidManifest.xml
index 8102656..e62f968 100644
--- a/tests/appsecurity-tests/test-apps/InstrumentationAppDiffCert/AndroidManifest.xml
+++ b/tests/appsecurity-tests/test-apps/InstrumentationAppDiffCert/AndroidManifest.xml
@@ -26,15 +26,7 @@
</application>
<!-- assumes com.android.cts.targetinstrumentationapp is signed with diff cert -->
- <instrumentation android:name="android.app.Instrumentation"
- android:targetPackage="com.android.cts.targetinstrumentationapp"
- android:label="Instrumentation that targets app with different cert" />
-
- <!--
- A self-instrumenting test runner, that will try to start the above instrumentation and
- verify it fails.
- -->
<instrumentation android:name="android.test.InstrumentationTestRunner"
- android:targetPackage="com.android.cts.instrumentationdiffcertapp"
+ android:targetPackage="com.android.cts.targetinstrumentationapp"
android:label="Test for instrumentation with different cert" />
</manifest>
diff --git a/tests/appsecurity-tests/test-apps/InstrumentationAppDiffCert/src/com/android/cts/instrumentationdiffcertapp/InstrumentationFailToRunTest.java b/tests/appsecurity-tests/test-apps/InstrumentationAppDiffCert/src/com/android/cts/instrumentationdiffcertapp/InstrumentationFailToRunTest.java
index 9c320d9..bd5de8c 100644
--- a/tests/appsecurity-tests/test-apps/InstrumentationAppDiffCert/src/com/android/cts/instrumentationdiffcertapp/InstrumentationFailToRunTest.java
+++ b/tests/appsecurity-tests/test-apps/InstrumentationAppDiffCert/src/com/android/cts/instrumentationdiffcertapp/InstrumentationFailToRunTest.java
@@ -16,29 +16,17 @@
package com.android.cts.instrumentationdiffcertapp;
-import android.app.Instrumentation;
-import android.content.ComponentName;
-import android.content.Context;
-import android.os.Bundle;
-import android.test.InstrumentationTestCase;
+import junit.framework.TestCase;
/**
- * Test that a instrumentation targeting another app with a different cert fails.
+ * Test that is expected not to run
*/
-public class InstrumentationFailToRunTest extends InstrumentationTestCase {
+public class InstrumentationFailToRunTest extends TestCase {
+ /**
+ * Test method that is expected not to run.
+ */
public void testInstrumentationNotAllowed() {
- Context myContext = getInstrumentation().getContext();
- // assumes android.app.Instrumentation has been defined in this app's AndroidManifest.xml
- // as targeting an app with a different cert
- ComponentName appDiffCertInstrumentation = new ComponentName(myContext,
- Instrumentation.class);
- try {
- getInstrumentation().getContext().startInstrumentation(appDiffCertInstrumentation,
- null, new Bundle());
- fail("could launch instrumentation");
- } catch (SecurityException e) {
- // expected
- }
+ fail("instrumentating app with different cert should fail");
}
}
diff --git a/tests/core/annotation/Android.mk b/tests/core/annotation/Android.mk
index 4778710..94eafea 100644
--- a/tests/core/annotation/Android.mk
+++ b/tests/core/annotation/Android.mk
@@ -23,9 +23,9 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/annotation/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/annotation/src/test/java) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/junit) \
+ ../../../../libcore/luni/src/test/java/tests/TestSuiteFactory.java
LOCAL_PACKAGE_NAME := android.core.tests.annotation
diff --git a/tests/core/archive/Android.mk b/tests/core/archive/Android.mk
index 78edd09..08100cf 100644
--- a/tests/core/archive/Android.mk
+++ b/tests/core/archive/Android.mk
@@ -23,10 +23,10 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/archive/src/test/java/org) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/archive/src/test/java/org) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/junit) \
+ $(call all-java-files-under,../../../../libcore/support/src/test/java) \
+ ../../../../libcore/luni/src/test/java/tests/TestSuiteFactory.java
LOCAL_PACKAGE_NAME := android.core.tests.archive
diff --git a/tests/core/concurrent/Android.mk b/tests/core/concurrent/Android.mk
index d42c6da..1a66d0a 100644
--- a/tests/core/concurrent/Android.mk
+++ b/tests/core/concurrent/Android.mk
@@ -28,9 +28,9 @@
# and when built explicitly put it in the data partition
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/concurrent/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/concurrent/src/test/java) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/junit) \
+ ../../../../libcore/luni/src/test/java/tests/TestSuiteFactory.java
LOCAL_PACKAGE_NAME := android.core.tests.concurrent
diff --git a/tests/core/crypto/Android.mk b/tests/core/crypto/Android.mk
index 2450ad1..f566d5a 100644
--- a/tests/core/crypto/Android.mk
+++ b/tests/core/crypto/Android.mk
@@ -23,10 +23,10 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/crypto/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java/) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/crypto/src/test/java) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/junit) \
+ $(call all-java-files-under,../../../../libcore/support/src/test/java/) \
+ ../../../../libcore/luni/src/test/java/tests/TestSuiteFactory.java
LOCAL_PACKAGE_NAME := android.core.tests.crypto
diff --git a/tests/core/dom/Android.mk b/tests/core/dom/Android.mk
index 47b3dbb..4dd81f8 100644
--- a/tests/core/dom/Android.mk
+++ b/tests/core/dom/Android.mk
@@ -23,9 +23,9 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/dom/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/dom/src/test/java) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/junit) \
+ ../../../../libcore/luni/src/test/java/tests/TestSuiteFactory.java
LOCAL_PACKAGE_NAME := android.core.tests.dom
diff --git a/tests/core/logging/Android.mk b/tests/core/logging/Android.mk
index 89d1ca9..2c741a8 100644
--- a/tests/core/logging/Android.mk
+++ b/tests/core/logging/Android.mk
@@ -23,10 +23,10 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/logging/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/logging/src/test/java) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/junit) \
+ $(call all-java-files-under,../../../../libcore/support/src/test/java) \
+ ../../../../libcore/luni/src/test/java/tests/TestSuiteFactory.java
LOCAL_PACKAGE_NAME := android.core.tests.logging
diff --git a/tests/core/luni-io/Android.mk b/tests/core/luni-io/Android.mk
index f2aae36..f6d4bcb 100644
--- a/tests/core/luni-io/Android.mk
+++ b/tests/core/luni-io/Android.mk
@@ -23,13 +23,13 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/tests/api/java/io) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/io) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java/) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/pkg1) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/pkg2) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/luni/AllTestsIo.java \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/luni/src/test/java/tests/api/java/io) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/io) \
+ $(call all-java-files-under,../../../../libcore/support/src/test/java/) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/org/apache/harmony/luni/tests/pkg1) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/org/apache/harmony/luni/tests/pkg2) \
+ ../../../../libcore/luni/src/test/java/tests/luni/AllTestsIo.java \
+ ../../../../libcore/luni/src/test/java/tests/TestSuiteFactory.java
LOCAL_PACKAGE_NAME := android.core.tests.luni.io
diff --git a/tests/core/luni-lang/Android.mk b/tests/core/luni-lang/Android.mk
index 225bdf9..f84bd81 100644
--- a/tests/core/luni-lang/Android.mk
+++ b/tests/core/luni-lang/Android.mk
@@ -23,11 +23,11 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/lang) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/tests/api/java/lang) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java/) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/luni/AllTestsLang.java \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/lang) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/tests/api/java/lang) \
+ $(call all-java-files-under,../../../../libcore/support/src/test/java/) \
+ ../../../../libcore/luni/src/test/java/tests/luni/AllTestsLang.java \
+ ../../../../libcore/luni/src/test/java/tests/TestSuiteFactory.java
LOCAL_PACKAGE_NAME := android.core.tests.luni.lang
diff --git a/tests/core/luni-net/Android.mk b/tests/core/luni-net/Android.mk
index 1092ff1..a9aafb6 100644
--- a/tests/core/luni-net/Android.mk
+++ b/tests/core/luni-net/Android.mk
@@ -23,13 +23,13 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/net) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/tests/api/java/net) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/http) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/https) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java/) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/luni/AllTestsNet.java \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/net) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/tests/api/java/net) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/http) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/https) \
+ $(call all-java-files-under,../../../../libcore/support/src/test/java/) \
+ ../../../../libcore/luni/src/test/java/tests/luni/AllTestsNet.java \
+ ../../../../libcore/luni/src/test/java/tests/TestSuiteFactory.java
LOCAL_PACKAGE_NAME := android.core.tests.luni.net
diff --git a/tests/core/luni-util/Android.mk b/tests/core/luni-util/Android.mk
index 101cde8..b5f0605 100644
--- a/tests/core/luni-util/Android.mk
+++ b/tests/core/luni-util/Android.mk
@@ -23,11 +23,11 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/util) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/tests/api/java/util) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java/) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/luni/AllTestsUtil.java \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/util) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/tests/api/java/util) \
+ $(call all-java-files-under,../../../../libcore/support/src/test/java/) \
+ ../../../../libcore/luni/src/test/java/tests/luni/AllTestsUtil.java \
+ ../../../../libcore/luni/src/test/java/tests/TestSuiteFactory.java
LOCAL_PACKAGE_NAME := android.core.tests.luni.util
diff --git a/tests/core/math/Android.mk b/tests/core/math/Android.mk
index 4c559cd..9918510 100644
--- a/tests/core/math/Android.mk
+++ b/tests/core/math/Android.mk
@@ -23,10 +23,10 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/math/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/math/src/test/java) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/junit) \
+ $(call all-java-files-under,../../../../libcore/support/src/test/java) \
+ ../../../../libcore/luni/src/test/java/tests/TestSuiteFactory.java
LOCAL_PACKAGE_NAME := android.core.tests.math
diff --git a/tests/core/nio/Android.mk b/tests/core/nio/Android.mk
index 6ebd1bc..3b82211 100644
--- a/tests/core/nio/Android.mk
+++ b/tests/core/nio/Android.mk
@@ -23,10 +23,10 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/nio/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/nio/src/test/java) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/junit) \
+ $(call all-java-files-under,../../../../libcore/support/src/test/java) \
+ ../../../../libcore/luni/src/test/java/tests/TestSuiteFactory.java
LOCAL_PACKAGE_NAME := android.core.tests.nio
diff --git a/tests/core/nio_char/Android.mk b/tests/core/nio_char/Android.mk
index e3b463a..3132de9 100644
--- a/tests/core/nio_char/Android.mk
+++ b/tests/core/nio_char/Android.mk
@@ -23,10 +23,10 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/nio_char/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/nio_char/src/test/java) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/junit) \
+ $(call all-java-files-under,../../../../libcore/support/src/test/java) \
+ ../../../../libcore/luni/src/test/java/tests/TestSuiteFactory.java
LOCAL_PACKAGE_NAME := android.core.tests.nio_char
diff --git a/tests/core/prefs/Android.mk b/tests/core/prefs/Android.mk
index f8f225c..e72154b 100644
--- a/tests/core/prefs/Android.mk
+++ b/tests/core/prefs/Android.mk
@@ -23,10 +23,10 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/prefs/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/prefs/src/test/java) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/junit) \
+ $(call all-java-files-under,../../../../libcore/support/src/test/java) \
+ ../../../../libcore/luni/src/test/java/tests/TestSuiteFactory.java
LOCAL_PACKAGE_NAME := android.core.tests.prefs
diff --git a/tests/core/regex/Android.mk b/tests/core/regex/Android.mk
index 70927a0..b877e7a 100644
--- a/tests/core/regex/Android.mk
+++ b/tests/core/regex/Android.mk
@@ -23,10 +23,10 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/regex/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/regex/src/test/java) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/junit) \
+ $(call all-java-files-under,../../../../libcore/support/src/test/java) \
+ ../../../../libcore/luni/src/test/java/tests/TestSuiteFactory.java
LOCAL_PACKAGE_NAME := android.core.tests.regex
diff --git a/tests/core/security/Android.mk b/tests/core/security/Android.mk
index 76c0ca5..2c4c83a 100644
--- a/tests/core/security/Android.mk
+++ b/tests/core/security/Android.mk
@@ -23,10 +23,10 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/security/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/security/src/test/java) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/junit) \
+ $(call all-java-files-under,../../../../libcore/support/src/test/java) \
+ ../../../../libcore/luni/src/test/java/tests/TestSuiteFactory.java
LOCAL_PACKAGE_NAME := android.core.tests.security
diff --git a/tests/core/sql/Android.mk b/tests/core/sql/Android.mk
index fe9b4cc..cace588 100644
--- a/tests/core/sql/Android.mk
+++ b/tests/core/sql/Android.mk
@@ -23,10 +23,10 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/sql/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/sql/src/test/java) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/junit) \
+ $(call all-java-files-under,../../../../libcore/support/src/test/java) \
+ ../../../../libcore/luni/src/test/java/tests/TestSuiteFactory.java
LOCAL_PACKAGE_NAME := android.core.tests.sql
diff --git a/tests/core/text/Android.mk b/tests/core/text/Android.mk
index 8b9fd1f..d08edb5 100644
--- a/tests/core/text/Android.mk
+++ b/tests/core/text/Android.mk
@@ -23,10 +23,10 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/text/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/text/src/test/java) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/junit) \
+ $(call all-java-files-under,../../../../libcore/support/src/test/java) \
+ ../../../../libcore/luni/src/test/java/tests/TestSuiteFactory.java
LOCAL_PACKAGE_NAME := android.core.tests.text
diff --git a/tests/core/xml/Android.mk b/tests/core/xml/Android.mk
index ba784b9..f1c63e3 100644
--- a/tests/core/xml/Android.mk
+++ b/tests/core/xml/Android.mk
@@ -23,11 +23,11 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/xml/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/dom/src/test) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/xml/src/test/java) \
+ $(call all-java-files-under,../../../../libcore/dom/src/test) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/junit) \
+ $(call all-java-files-under,../../../../libcore/support/src/test/java) \
+ ../../../../libcore/luni/src/test/java/tests/TestSuiteFactory.java
LOCAL_PACKAGE_NAME := android.core.tests.xml
diff --git a/tests/core/xnet/Android.mk b/tests/core/xnet/Android.mk
index 2415f38..cf255e8 100644
--- a/tests/core/xnet/Android.mk
+++ b/tests/core/xnet/Android.mk
@@ -23,10 +23,10 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/x-net/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/x-net/src/test/java) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/junit) \
+ $(call all-java-files-under,../../../../libcore/support/src/test/java) \
+ ../../../../libcore/luni/src/test/java/tests/TestSuiteFactory.java
LOCAL_PACKAGE_NAME := android.core.tests.xnet
diff --git a/tests/res/layout/gridlayout_anim_controller_layout.xml b/tests/res/layout/gridlayout_anim_controller_layout.xml
index 0ff2d46..4fe4237 100644
--- a/tests/res/layout/gridlayout_anim_controller_layout.xml
+++ b/tests/res/layout/gridlayout_anim_controller_layout.xml
@@ -21,7 +21,7 @@
android:padding="10dp"
android:verticalSpacing="20dp"
android:horizontalSpacing="20dp"
- android:numColumns="3"
+ android:numColumns="auto_fit"
android:columnWidth="60dp"
android:stretchMode="columnWidth"
android:gravity="center"
diff --git a/tests/res/layout/inputmethod_edittext.xml b/tests/res/layout/inputmethod_edittext.xml
deleted file mode 100755
index 849b411..0000000
--- a/tests/res/layout/inputmethod_edittext.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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.
--->
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:background="@drawable/blue"
- android:padding="10px">
-
- <EditText android:id="@+id/entry"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:background="@android:drawable/editbox_background"/>
-
-</RelativeLayout>
diff --git a/tests/tests/accessibilityservice/res/layout/list_view_row.xml b/tests/res/values-large/configVarying.xml
old mode 100644
new mode 100755
similarity index 66%
copy from tests/tests/accessibilityservice/res/layout/list_view_row.xml
copy to tests/res/values-large/configVarying.xml
index 05163c5..7b2df7c
--- a/tests/tests/accessibilityservice/res/layout/list_view_row.xml
+++ b/tests/res/values-large/configVarying.xml
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright (C) 2010 The Android Open Source Project
+<!-- Copyright (C) 2009 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.
@@ -15,8 +14,10 @@
limitations under the License.
-->
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="20px">
-</TextView>
+<resources>
+ <item type="configVarying" name="simple">simple large</item>
+ <bag type="configVarying" name="bag">
+ <item name="testString">bag large</item>
+ </bag>
+ <item type="configVarying" name="large">large</item>
+</resources>
diff --git a/tests/tests/accessibilityservice/res/layout/list_view_row.xml b/tests/res/values-normal/configVarying.xml
old mode 100644
new mode 100755
similarity index 66%
copy from tests/tests/accessibilityservice/res/layout/list_view_row.xml
copy to tests/res/values-normal/configVarying.xml
index 05163c5..b45ee49
--- a/tests/tests/accessibilityservice/res/layout/list_view_row.xml
+++ b/tests/res/values-normal/configVarying.xml
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright (C) 2010 The Android Open Source Project
+<!-- Copyright (C) 2009 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.
@@ -15,8 +14,10 @@
limitations under the License.
-->
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="20px">
-</TextView>
+<resources>
+ <item type="configVarying" name="simple">simple normal</item>
+ <bag type="configVarying" name="bag">
+ <item name="testString">bag normal</item>
+ </bag>
+ <item type="configVarying" name="normal">normal</item>
+</resources>
diff --git a/tests/tests/accessibilityservice/res/layout/list_view_row.xml b/tests/res/values-small/configVarying.xml
old mode 100644
new mode 100755
similarity index 66%
copy from tests/tests/accessibilityservice/res/layout/list_view_row.xml
copy to tests/res/values-small/configVarying.xml
index 05163c5..15a9f8f
--- a/tests/tests/accessibilityservice/res/layout/list_view_row.xml
+++ b/tests/res/values-small/configVarying.xml
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright (C) 2010 The Android Open Source Project
+<!-- Copyright (C) 2009 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.
@@ -15,8 +14,10 @@
limitations under the License.
-->
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="20px">
-</TextView>
+<resources>
+ <item type="configVarying" name="simple">simple small</item>
+ <bag type="configVarying" name="bag">
+ <item name="testString">bag small</item>
+ </bag>
+ <item type="configVarying" name="small">small</item>
+</resources>
diff --git a/tests/tests/accessibilityservice/res/layout/list_view_row.xml b/tests/res/values-xlarge/configVarying.xml
old mode 100644
new mode 100755
similarity index 66%
rename from tests/tests/accessibilityservice/res/layout/list_view_row.xml
rename to tests/res/values-xlarge/configVarying.xml
index 05163c5..fb9cad7
--- a/tests/tests/accessibilityservice/res/layout/list_view_row.xml
+++ b/tests/res/values-xlarge/configVarying.xml
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright (C) 2010 The Android Open Source Project
+<!-- Copyright (C) 2009 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.
@@ -15,8 +14,10 @@
limitations under the License.
-->
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="20px">
-</TextView>
+<resources>
+ <item type="configVarying" name="simple">simple xlarge</item>
+ <bag type="configVarying" name="bag">
+ <item name="testString">bag xlarge</item>
+ </bag>
+ <item type="configVarying" name="xlarge">xlarge</item>
+</resources>
diff --git a/tests/res/values/configVarying.xml b/tests/res/values/configVarying.xml
index a2d5b97..de1b09e 100755
--- a/tests/res/values/configVarying.xml
+++ b/tests/res/values/configVarying.xml
@@ -19,4 +19,8 @@
<bag type="configVarying" name="bag">
<item name="testString">bag default</item>
</bag>
+ <item type="configVarying" name="small">default</item>
+ <item type="configVarying" name="normal">default</item>
+ <item type="configVarying" name="large">default</item>
+ <item type="configVarying" name="xlarge">default</item>
</resources>
diff --git a/tests/res/xml/method.xml b/tests/res/xml/method.xml
deleted file mode 100644
index 763faa5..0000000
--- a/tests/res/xml/method.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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.
--->
-
-<input-method xmlns:android="http://schemas.android.com/apk/res/android"
- android:settingsActivity="android.view.inputmethod.cts.InputMethodInfoStub"
-/>
diff --git a/tests/src/android/app/cts/ActivityTestsBase.java b/tests/src/android/app/cts/ActivityTestsBase.java
index 426a8b8..7bbedd8 100644
--- a/tests/src/android/app/cts/ActivityTestsBase.java
+++ b/tests/src/android/app/cts/ActivityTestsBase.java
@@ -27,8 +27,6 @@
public static final String PERMISSION_GRANTED = "android.app.cts.permission.TEST_GRANTED";
public static final String PERMISSION_DENIED = "android.app.cts.permission.TEST_DENIED";
- private static final int TIMEOUT_MS = 60 * 1000;
-
protected Intent mIntent;
private PerformanceTestCase.Intermediates mIntermediates;
@@ -127,11 +125,6 @@
}
public int runLaunchpad(String action) {
- startLaunchpadActivity(action);
- return waitForResultOrThrow(TIMEOUT_MS);
- }
-
- private void startLaunchpadActivity(String action) {
LaunchpadActivity.setCallingTest(this);
synchronized (this) {
@@ -140,6 +133,8 @@
mIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(mIntent);
}
+
+ return waitForResultOrThrow(60 * 1000);
}
public int waitForResultOrThrow(int timeoutMs) {
@@ -191,7 +186,6 @@
return mResultCode;
}
-
public int getResultCode() {
return mResultCode;
}
diff --git a/tests/src/android/app/cts/LaunchpadActivity.java b/tests/src/android/app/cts/LaunchpadActivity.java
index fa18ec5..566e7b7 100644
--- a/tests/src/android/app/cts/LaunchpadActivity.java
+++ b/tests/src/android/app/cts/LaunchpadActivity.java
@@ -30,12 +30,6 @@
import android.os.Parcel;
import android.os.Parcelable;
import android.test.PerformanceTestCase;
-import android.util.Log;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
class MyBadParcelable implements Parcelable {
public MyBadParcelable() {
@@ -92,6 +86,8 @@
public static final String LIFECYCLE_BASIC = "android.app.cts.activity.LIFECYCLE_BASIC";
public static final String LIFECYCLE_SCREEN = "android.app.cts.activity.LIFECYCLE_SCREEN";
public static final String LIFECYCLE_DIALOG = "android.app.cts.activity.LIFECYCLE_DIALOG";
+ public static final String LIFECYCLE_FINISH_CREATE = "android.app.cts.activity.LIFECYCLE_FINISH_CREATE";
+ public static final String LIFECYCLE_FINISH_START = "android.app.cts.activity.LIFECYCLE_FINISH_START";
public static final String BROADCAST_REGISTERED = "android.app.cts.activity.BROADCAST_REGISTERED";
public static final String BROADCAST_LOCAL = "android.app.cts.activity.BROADCAST_LOCAL";
@@ -123,15 +119,13 @@
public static final String ON_RESUME = "onResume";
public static final String ON_FREEZE = "onSaveInstanceState";
public static final String ON_PAUSE = "onPause";
-
- // ON_STOP and ON_DESTROY are not tested because they may not be called.
+ public static final String ON_STOP = "onStop";
+ public static final String ON_DESTROY = "onDestroy";
public static final String DO_FINISH = "finish";
public static final String DO_LOCAL_SCREEN = "local-screen";
public static final String DO_LOCAL_DIALOG = "local-dialog";
- private static final String TAG = "LaunchpadActivity";
-
private boolean mBadParcelable = false;
private boolean mStarted = false;
@@ -140,18 +134,9 @@
private Intent mData = new Intent().setAction("No result received");
private RuntimeException mResultStack = null;
- /** Index into the {@link #mNextLifecycle} array. */
+ private String[] mExpectedLifecycle = null;
private int mNextLifecycle;
- /** Current lifecycle expected to be followed. */
- private String[] mExpectedLifecycle;
-
- /** Other possible lifecycles. Never includes the current {@link #mExpectedLifecycle}. */
- private List<String[]> mOtherPossibleLifecycles = new ArrayList<String[]>(2);
-
- /** Map from lifecycle arrays to debugging log names. */
- private Map<String[], String> mLifecycleNames = new HashMap<String[], String>(2);
-
private String[] mExpectedReceivers = null;
private int mNextReceiver;
@@ -172,85 +157,40 @@
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
-
- resetLifecycles();
-
- // ON_STOP and ON_DESTROY are not tested because they may not be called.
-
final String action = getIntent().getAction();
if (LIFECYCLE_BASIC.equals(action)) {
- addPossibleLifecycle(LIFECYCLE_BASIC, new String[] {
- ON_START, ON_RESUME, DO_FINISH, ON_PAUSE
+ setExpectedLifecycle(new String[] {
+ ON_START, ON_RESUME, DO_FINISH, ON_PAUSE, ON_STOP, ON_DESTROY
});
} else if (LIFECYCLE_SCREEN.equals(action)) {
- addPossibleLifecycle(LIFECYCLE_SCREEN + "_RESTART", new String[] {
- ON_START, ON_RESUME, DO_LOCAL_SCREEN, ON_FREEZE, ON_PAUSE,
- ON_RESTART, ON_START, ON_RESUME, DO_FINISH, ON_PAUSE
- });
- addPossibleLifecycle(LIFECYCLE_SCREEN + "_RESUME", new String[] {
- ON_START, ON_RESUME, DO_LOCAL_SCREEN, ON_FREEZE, ON_PAUSE,
- ON_RESUME, DO_FINISH, ON_PAUSE
+ setExpectedLifecycle(new String[] {
+ ON_START, ON_RESUME, DO_LOCAL_SCREEN, ON_FREEZE, ON_PAUSE, ON_STOP, ON_RESTART,
+ ON_START, ON_RESUME, DO_FINISH, ON_PAUSE, ON_STOP, ON_DESTROY
});
} else if (LIFECYCLE_DIALOG.equals(action)) {
- addPossibleLifecycle(LIFECYCLE_DIALOG + "_RESTART", new String[] {
- ON_START, ON_RESUME, DO_LOCAL_DIALOG, ON_FREEZE, ON_PAUSE,
- ON_RESTART, ON_START, ON_RESUME, DO_FINISH, ON_PAUSE
+ setExpectedLifecycle(new String[] {
+ ON_START, ON_RESUME, DO_LOCAL_DIALOG, ON_FREEZE, ON_PAUSE, ON_RESUME,
+ DO_FINISH, ON_PAUSE, ON_STOP, ON_DESTROY
});
- addPossibleLifecycle(LIFECYCLE_DIALOG + "_RESUME", new String[] {
- ON_START, ON_RESUME, DO_LOCAL_DIALOG, ON_FREEZE, ON_PAUSE,
- ON_RESUME, DO_FINISH, ON_PAUSE
+ } else if (LIFECYCLE_FINISH_CREATE.equals(action)) {
+ // This one behaves a little differently when running in a group.
+ if (getParent() == null) {
+ setExpectedLifecycle(new String[] {
+ ON_DESTROY
+ });
+ } else {
+ setExpectedLifecycle(new String[] {
+ ON_START, ON_STOP, ON_DESTROY
+ });
+ }
+ finish();
+ } else if (LIFECYCLE_FINISH_START.equals(action)) {
+ setExpectedLifecycle(new String[] {
+ ON_START, DO_FINISH, ON_STOP, ON_DESTROY
});
}
}
- private void resetLifecycles() {
- mNextLifecycle = 0;
- mExpectedLifecycle = null;
- mOtherPossibleLifecycles.clear();
- mLifecycleNames.clear();
- }
-
- /**
- * Add a potential lifecycle that this activity may follow, since there
- * are usually multiple valid lifecycles. For instance, sometimes onPause
- * will lead to onResume rather than onStop when another activity is
- * raised over the current one.
- *
- * @param debugName for the lifecycle shown in the logs
- * @param lifecycle array containing tokens indicating the expected lifecycle
- */
- private void addPossibleLifecycle(String debugName, String[] lifecycle) {
- mLifecycleNames.put(lifecycle, debugName);
- if (mExpectedLifecycle == null) {
- mExpectedLifecycle = lifecycle;
- } else {
- mOtherPossibleLifecycles.add(lifecycle);
- }
- }
-
- /**
- * Switch to the next possible lifecycle and return if switching was
- * successful. Call this method when mExpectedLifecycle doesn't match
- * the current lifecycle and you need to check another possible lifecycle.
- *
- * @return whether on not there was a lifecycle to switch to
- */
- private boolean switchToNextPossibleLifecycle() {
- if (!mOtherPossibleLifecycles.isEmpty()) {
- String[] newLifecycle = mOtherPossibleLifecycles.remove(0);
- Log.w(TAG, "Switching expected lifecycles from "
- + mLifecycleNames.get(mExpectedLifecycle) + " to "
- + mLifecycleNames.get(newLifecycle));
- mExpectedLifecycle = newLifecycle;
- return true;
- } else {
- Log.w(TAG, "No more lifecycles after "
- + mLifecycleNames.get(mExpectedLifecycle));
- mExpectedLifecycle = null;
- return false;
- }
- }
-
@Override
protected void onStart() {
super.onStart();
@@ -412,6 +352,12 @@
}
@Override
+ protected void onStop() {
+ super.onStop();
+ checkLifecycle(ON_STOP);
+ }
+
+ @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case LAUNCHED_RESULT:
@@ -435,42 +381,50 @@
}
}
- private void checkLifecycle(String where) {
- String action = getIntent().getAction();
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ checkLifecycle(ON_DESTROY);
+ sCallingTest.activityFinished(mResultCode, mData, mResultStack);
+ }
+ private void setExpectedLifecycle(String[] lifecycle) {
+ mExpectedLifecycle = lifecycle;
+ mNextLifecycle = 0;
+ }
+
+ private void checkLifecycle(String where) {
if (mExpectedLifecycle == null) {
return;
}
if (mNextLifecycle >= mExpectedLifecycle.length) {
- finishBad("Activity lifecycle for " + action + " incorrect: received " + where
+ finishBad("Activity lifecycle incorrect: received " + where
+ " but don't expect any more calls");
mExpectedLifecycle = null;
return;
}
-
- do {
- if (mExpectedLifecycle[mNextLifecycle].equals(where)) {
- break;
- }
- } while (switchToNextPossibleLifecycle());
-
- if (mExpectedLifecycle == null) {
- finishBad("Activity lifecycle for " + action + " incorrect: received " + where
- + " but expected " + mExpectedLifecycle[mNextLifecycle]
- + " at " + mNextLifecycle);
+ if (!mExpectedLifecycle[mNextLifecycle].equals(where)) {
+ finishBad("Activity lifecycle incorrect: received " + where + " but expected "
+ + mExpectedLifecycle[mNextLifecycle] + " at " + mNextLifecycle);
+ mExpectedLifecycle = null;
return;
}
mNextLifecycle++;
if (mNextLifecycle >= mExpectedLifecycle.length) {
- finishGood();
+ setTestResult(RESULT_OK, null);
return;
}
final String next = mExpectedLifecycle[mNextLifecycle];
- if (next.equals(DO_FINISH)) {
+ if (where.equals(ON_DESTROY)) {
+ finishBad("Activity lifecycle incorrect: received " + where
+ + " but expected more actions (next is " + next + ")");
+ mExpectedLifecycle = null;
+ return;
+ } else if (next.equals(DO_FINISH)) {
mNextLifecycle++;
if (mNextLifecycle >= mExpectedLifecycle.length) {
setTestResult(RESULT_OK, null);
@@ -519,9 +473,6 @@
private void finishWithResult(int resultCode, Intent data) {
setTestResult(resultCode, data);
finish();
-
- // Member fields set by calling setTestResult above...
- sCallingTest.activityFinished(mResultCode, mData, mResultStack);
}
private void setTestResult(int resultCode, Intent data) {
diff --git a/tests/src/android/hardware/cts/CameraStubActivity.java b/tests/src/android/hardware/cts/CameraStubActivity.java
index 50bd13b..8ab7fbd 100644
--- a/tests/src/android/hardware/cts/CameraStubActivity.java
+++ b/tests/src/android/hardware/cts/CameraStubActivity.java
@@ -24,9 +24,7 @@
import com.android.cts.stub.R;
public class CameraStubActivity extends Activity {
-
- public static SurfaceView mSurfaceView;
-
+ private SurfaceView mSurfaceView;
private final int LAYOUT_WIDTH = 480;
private final int LAYOUT_HEIGHT = 320;
@@ -43,4 +41,8 @@
mSurfaceView.getHolder().setFixedSize(LAYOUT_WIDTH, LAYOUT_HEIGHT);
mSurfaceView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
+
+ public SurfaceView getSurfaceView() {
+ return mSurfaceView;
+ }
}
diff --git a/tests/src/android/opengl/cts/GLSurfaceViewStubActivity.java b/tests/src/android/opengl/cts/GLSurfaceViewStubActivity.java
deleted file mode 100644
index 5a8f310..0000000
--- a/tests/src/android/opengl/cts/GLSurfaceViewStubActivity.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2010 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.opengl.cts;
-
-import android.app.Activity;
-import android.opengl.GLSurfaceView;
-import android.os.Bundle;
-
-import javax.microedition.khronos.egl.EGLConfig;
-import javax.microedition.khronos.opengles.GL10;
-
-/**
- * A minimal activity for testing {@link android.opengl.GLSurfaceView}.
- */
-public class GLSurfaceViewStubActivity extends Activity {
-
- private static class Renderer implements GLSurfaceView.Renderer {
-
- public void onDrawFrame(GL10 gl) {
- // Do nothing.
- }
-
- public void onSurfaceChanged(GL10 gl, int width, int height) {
- // Do nothing.
- }
-
- public void onSurfaceCreated(GL10 gl, EGLConfig config) {
- // Do nothing.
- }
- }
-
- private GLSurfaceView mView;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- mView = new GLSurfaceView(this);
- mView.setRenderer(new Renderer());
- setContentView(mView);
- }
-
- public GLSurfaceView getView() {
- return mView;
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- mView.onResume();
- }
-
- @Override
- protected void onPause() {
- super.onPause();
- mView.onPause();
- }
-}
diff --git a/tests/src/android/view/cts/SurfaceViewStubActivity.java b/tests/src/android/view/cts/SurfaceViewStubActivity.java
index 75d5ff6..319af05 100644
--- a/tests/src/android/view/cts/SurfaceViewStubActivity.java
+++ b/tests/src/android/view/cts/SurfaceViewStubActivity.java
@@ -54,6 +54,7 @@
private SurfaceHolder mHolder;
private MockCanvas mCanvas;
+ private Thread mSurfaceViewThread;
private boolean mIsDraw;
private boolean mIsAttachedToWindow;
@@ -170,23 +171,32 @@
}
public void surfaceCreated(SurfaceHolder holder) {
- // Use mock canvas listening to the drawColor() calling.
- mCanvas = new MockCanvas(Bitmap.createBitmap( BITMAP_WIDTH,
- BITMAP_HEIGHT,
- Bitmap.Config.ARGB_8888));
- draw(mCanvas);
+ // The Surface has been created, start our drawing thread.
+ mSurfaceViewThread = new Thread() {
+ @Override
+ public void run() {
+ // Use mock canvas listening to the drawColor() calling.
+ mCanvas = new MockCanvas(Bitmap.createBitmap( BITMAP_WIDTH,
+ BITMAP_HEIGHT,
+ Bitmap.Config.ARGB_8888));
+ draw(mCanvas);
- // Lock the surface, this returns a Canvas that can be used to render into.
- Canvas canvas = mHolder.lockCanvas();
- Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
- paint.setColor(Color.BLUE);
- canvas.drawRect(RECT_LEFT, RECT_TOP, RECT_RIGHT, RECT_BOTTOM, paint);
+ // Lock the surface, this returns a Canvas that can be used to render into.
+ Canvas canvas = mHolder.lockCanvas();
+ Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ paint.setColor(Color.BLUE);
+ canvas.drawRect(RECT_LEFT, RECT_TOP, RECT_RIGHT, RECT_BOTTOM, paint);
- // And finally unlock and post the surface.
- mHolder.unlockCanvasAndPost(canvas);
+ // And finally unlock and post the surface.
+ mHolder.unlockCanvasAndPost(canvas);
+ }
+ };
+
+ mSurfaceViewThread.start();
}
public void surfaceDestroyed(SurfaceHolder holder) {
+ mSurfaceViewThread = null;
}
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
diff --git a/tests/src/android/view/inputmethod/cts/InputMethodInfoStub.java b/tests/src/android/view/inputmethod/cts/InputMethodInfoStub.java
deleted file mode 100644
index 0eeefbe..0000000
--- a/tests/src/android/view/inputmethod/cts/InputMethodInfoStub.java
+++ /dev/null
@@ -1,23 +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.view.inputmethod.cts;
-
-import android.inputmethodservice.InputMethodService;
-
-public class InputMethodInfoStub extends InputMethodService {
-
-}
diff --git a/tests/src/android/view/inputmethod/cts/InputMethodStubActivity.java b/tests/src/android/view/inputmethod/cts/InputMethodStubActivity.java
deleted file mode 100644
index 8117918..0000000
--- a/tests/src/android/view/inputmethod/cts/InputMethodStubActivity.java
+++ /dev/null
@@ -1,28 +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.view.inputmethod.cts;
-
-import android.app.Activity;
-import android.os.Bundle;
-import com.android.cts.stub.R;
-
-public class InputMethodStubActivity extends Activity {
- @Override
- protected void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- setContentView(R.layout.inputmethod_edittext);
- }
-}
diff --git a/tests/src/android/widget/cts/WidgetTestUtils.java b/tests/src/android/widget/cts/WidgetTestUtils.java
index 0a8f6dc..b6e0140 100644
--- a/tests/src/android/widget/cts/WidgetTestUtils.java
+++ b/tests/src/android/widget/cts/WidgetTestUtils.java
@@ -103,12 +103,6 @@
actual, 3);
}
- /** Converts dips into pixels using the {@link Context}'s density. */
- public static int convertDipToPixels(Context context, int dip) {
- float density = context.getResources().getDisplayMetrics().density;
- return Math.round(density * dip);
- }
-
/**
* Retrieve a bitmap that can be used for comparison on any density
* @param resources
diff --git a/tests/tests/accessibilityservice/Android.mk b/tests/tests/accessibilityservice/Android.mk
deleted file mode 100644
index 401f7a4..0000000
--- a/tests/tests/accessibilityservice/Android.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SRC_FILES += \
- src/android/accessibilityservice/IAccessibilityServiceDelegate.aidl \
- src/android/accessibilityservice/IAccessibilityServiceDelegateConnection.aidl
-
-LOCAL_PACKAGE_NAME := CtsAccessibilityServiceTestCases
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/tests/tests/accessibilityservice/AndroidManifest.xml b/tests/tests/accessibilityservice/AndroidManifest.xml
deleted file mode 100644
index 811c87f..0000000
--- a/tests/tests/accessibilityservice/AndroidManifest.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
- * Copyright (C) 2010 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.
- -->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.cts.accessibilityservice">
-
- <application>
-
- <uses-library android:name="android.test.runner"/>
-
- <activity android:label="@string/accessibility_end_to_end_test_activity"
- android:name="android.accessibilityservice.cts.AccessibilityEndToEndTestActivity"/>
-
- </application>
-
- <instrumentation android:name="android.test.InstrumentationTestRunner"
- android:targetPackage="com.android.cts.accessibilityservice"
- android:label="Tests for the accessibility APIs."/>
-
-</manifest>
diff --git a/tests/tests/accessibilityservice/res/layout/end_to_end_test.xml b/tests/tests/accessibilityservice/res/layout/end_to_end_test.xml
deleted file mode 100644
index 351ea24..0000000
--- a/tests/tests/accessibilityservice/res/layout/end_to_end_test.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright (C) 2010 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.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:gravity="center" android:orientation="vertical">
-
- <ListView android:id="@+id/listview"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content">
- </ListView>
-
- <EditText android:id="@+id/edittext"
- android:text="@string/text_input_blah"
- android:layout_height="wrap_content"
- android:layout_width="fill_parent">
- </EditText>
-
- <LinearLayout android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:gravity="center">
- <Button android:id="@+id/button"
- android:text="@string/button_title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:bufferType="normal">
- </Button>
- </LinearLayout>
-
-</LinearLayout>
diff --git a/tests/tests/accessibilityservice/res/values/strings.xml b/tests/tests/accessibilityservice/res/values/strings.xml
deleted file mode 100644
index e86d3cc..0000000
--- a/tests/tests/accessibilityservice/res/values/strings.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright (C) 2010 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.
--->
-
-<resources>
-
- <!-- String title of the accessibility end-to-end test activity -->
- <string name="accessibility_end_to_end_test_activity">End-to-end test</string>
-
- <!-- String value of used as text input -->
- <string name="text_input_blah">Blah</string>
-
- <!-- String value of used as text input -->
- <string name="text_input_blah_blah">Blah blah</string>
-
- <!-- String title of the button -->
- <string name="button_title">Click me</string>
-
- <!-- String value of the first list item -->
- <string name="first_list_item">First list item</string>
-
- <!-- String value of the second list item -->
- <string name="second_list_item">Second list item</string>
-
- <!-- String alert title -->
- <string name="alert_title">Alert title</string>
-
- <!-- String alert message -->
- <string name="alert_message">Alert message</string>
-
- <!-- String notification message -->
- <string name="notification_message">Notification message</string>
-
-</resources>
diff --git a/tests/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegate.aidl b/tests/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegate.aidl
deleted file mode 100644
index b5ebf19..0000000
--- a/tests/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegate.aidl
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2010 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.accessibilityservice;
-
-import android.view.accessibility.AccessibilityEvent;
-
-/**
- * Interface for interacting with the accessibility service mock.
- */
-interface IAccessibilityServiceDelegate {
-
- /**
- * Delegate an {@link android.view.accessibility.AccessibilityEvent}.
- */
- void onAccessibilityEvent(in AccessibilityEvent event);
-
- /**
- * Delegate an interrupt request.
- */
- void onInterrupt();
-}
diff --git a/tests/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegateConnection.aidl b/tests/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegateConnection.aidl
deleted file mode 100644
index 62703dc..0000000
--- a/tests/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegateConnection.aidl
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2010 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.accessibilityservice;
-
-import android.os.IBinder;
-
-/**
- * Interface for registering an accessibility service delegate.
- */
-oneway interface IAccessibilityServiceDelegateConnection {
-
- /**
- * Sets the delegate interface to which the
- * {@link DelegatingAccessibilityService} to delegate.
- */
- void setAccessibilityServiceDelegate(in IBinder binder);
-}
diff --git a/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java b/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java
deleted file mode 100644
index 5259753..0000000
--- a/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java
+++ /dev/null
@@ -1,791 +0,0 @@
-/*
- * Copyright (C) 2010 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.accessibilityservice.cts;
-
-import android.accessibilityservice.AccessibilityService;
-import android.accessibilityservice.IAccessibilityServiceDelegate;
-import android.accessibilityservice.IAccessibilityServiceDelegateConnection;
-import android.app.Activity;
-import android.app.ActivityManager;
-import android.app.AlertDialog;
-import android.app.Notification;
-import android.app.NotificationManager;
-import android.app.PendingIntent;
-import android.app.Service;
-import android.app.ActivityManager.RunningServiceInfo;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.Message;
-import android.os.RemoteException;
-import android.os.SystemClock;
-import android.test.ActivityInstrumentationTestCase2;
-import android.test.suitebuilder.annotation.LargeTest;
-import android.util.Log;
-import android.view.accessibility.AccessibilityEvent;
-import android.view.accessibility.AccessibilityManager;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.ListView;
-
-import com.android.cts.accessibilityservice.R;
-
-import junit.framework.TestCase;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Queue;
-
-/**
- * This class performs end-to-end testing of the accessibility feature by
- * creating an {@link Activity} and poking around so {@link AccessibilityEvent}s
- * are generated and their correct dispatch verified.
- * </p>
- * Note: The end-to-end test is composed of two APKs, one with a delegating accessibility
- * service, another with the instrumented activity and test cases. The motivation for
- * two APKs design is that CTS tests cannot access the secure settings which is
- * required for enabling accessibility and accessibility services. Therefore, manual
- * installation of the <strong>CtsDelegatingAccessibilityService.apk</strong>
- * whose source is located at <strong>cts/tests/accessibilityservice</strong> is required.
- * Once the former package has been installed accessibility must be enabled (Settings ->
- * Accessibility), the delegating service must be enabled (Settings -> Accessibility
- * -> Delegating Accessibility Service), and then the CTS tests in this package can be
- * successfully run. Further, the delegate and tests run in separate processes since
- * the instrumentation restarts the process in which it is running and this
- * breaks the binding between the delegating accessibility service and the system.
- */
-public class AccessibilityEndToEndTest extends
- ActivityInstrumentationTestCase2<AccessibilityEndToEndTestActivity> {
-
- /**
- * Timeout required for pending Binder calls or event processing to
- * complete.
- */
- private static final long MAX_TIMEOUT_ASYNCHRONOUS_PROCESSING = 1000;
-
- /**
- * The count of the polling attempts during {@link #MAX_TIMEOUT_ASYNCHRONOUS_PROCESSING}
- */
- private static final long COUNT_POLLING_ATTEMPTS = 10;
-
- /**
- * The package of the accessibility service mock interface.
- */
- private static final String DELEGATING_SERVICE_PACKAGE =
- "android.accessibilityservice.delegate";
-
- /**
- * The package of the delegating accessibility service interface.
- */
- private static final String DELEGATING_SERVICE_CLASS_NAME =
- "android.accessibilityservice.delegate.DelegatingAccessibilityService";
-
- /**
- * The package of the delegating accessibility service connection interface.
- */
- private static final String DELEGATING_SERVICE_CONNECTION_CLASS_NAME =
- "android.accessibilityservice.delegate."
- + "DelegatingAccessibilityService$DelegatingConnectionService";
-
- /**
- * Creates a new instance for testing
- * {@link AccessibilityEndToEndTestActivity}.
- *
- * @throws Exception If any error occurs.
- */
- public AccessibilityEndToEndTest() throws Exception {
- super("com.android.cts.accessibilityservice", AccessibilityEndToEndTestActivity.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- // wait for the activity to settle down so we do not receive
- // the event for its start, thus breaking the tests
- getInstrumentation().waitForIdleSync();
- }
-
- @LargeTest
- public void testTypeViewSelectedAccessibilityEvent() throws Throwable {
- Activity activity = getActivity();
-
- // create and populate the expected event
- AccessibilityEvent selectedEvent = AccessibilityEvent.obtain();
- selectedEvent.setEventType(AccessibilityEvent.TYPE_VIEW_SELECTED);
- selectedEvent.setClassName(ListView.class.getName());
- selectedEvent.setPackageName(getActivity().getPackageName());
- selectedEvent.getText().add(activity.getString(R.string.second_list_item));
- selectedEvent.setItemCount(2);
- selectedEvent.setCurrentItemIndex(1);
- selectedEvent.setEnabled(true);
-
- // set expectations
- MockAccessibilityService service = MockAccessibilityService.getInstance(activity);
- service.expectEvent(selectedEvent);
- service.replay();
-
- // trigger the event
- final ListView listView = (ListView) activity.findViewById(R.id.listview);
- getActivity().runOnUiThread(new Runnable() {
- public void run() {
- listView.setSelection(1);
- }
- });
-
- // verify if all expected methods have been called
- assertMockServiceVerifiedWithinTimeout(service);
- }
-
- @LargeTest
- public void testTypeViewClickedAccessibilityEvent() throws Throwable {
- Activity activity = getActivity();
-
- // create and populate the expected event
- AccessibilityEvent clickedEvent = AccessibilityEvent.obtain();
- clickedEvent.setEventType(AccessibilityEvent.TYPE_VIEW_CLICKED);
- clickedEvent.setClassName(Button.class.getName());
- clickedEvent.setPackageName(getActivity().getPackageName());
- clickedEvent.getText().add(activity.getString(R.string.button_title));
- clickedEvent.setEnabled(true);
-
- // set expectations
- MockAccessibilityService service = MockAccessibilityService.getInstance(activity);
- service.expectEvent(clickedEvent);
- service.replay();
-
- // trigger the event
- final Button button = (Button) activity.findViewById(R.id.button);
- activity.runOnUiThread(new Runnable() {
- public void run() {
- button.performClick();
- }
- });
-
- // verify if all expected methods have been called
- assertMockServiceVerifiedWithinTimeout(service);
- }
-
- @LargeTest
- public void testTypeViewLongClickedAccessibilityEvent() throws Throwable {
- Activity activity = getActivity();
-
- // create and populate the expected event
- AccessibilityEvent longClickedEvent = AccessibilityEvent.obtain();
- longClickedEvent.setEventType(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED);
- longClickedEvent.setClassName(Button.class.getName());
- longClickedEvent.setPackageName(getActivity().getPackageName());
- longClickedEvent.getText().add(activity.getString(R.string.button_title));
- longClickedEvent.setEnabled(true);
-
- // set expectations
- MockAccessibilityService service = MockAccessibilityService.getInstance(activity);
- service.expectEvent(longClickedEvent);
- service.replay();
-
- // trigger the event
- final Button button = (Button) activity.findViewById(R.id.button);
- activity.runOnUiThread(new Runnable() {
- public void run() {
- button.performLongClick();
- }
- });
-
- // verify if all expected methods have been called
- assertMockServiceVerifiedWithinTimeout(service);
- }
-
- @LargeTest
- public void testTypeViewFocusedAccessibilityEvent() throws Throwable {
- Activity activity = getActivity();
-
- // create and populate the expected event
- AccessibilityEvent focusedEvent = AccessibilityEvent.obtain();
- focusedEvent.setEventType(AccessibilityEvent.TYPE_VIEW_FOCUSED);
- focusedEvent.setClassName(Button.class.getName());
- focusedEvent.setPackageName(getActivity().getPackageName());
- focusedEvent.getText().add(activity.getString(R.string.button_title));
- focusedEvent.setItemCount(3);
- focusedEvent.setCurrentItemIndex(2);
- focusedEvent.setEnabled(true);
-
- // set expectations
- MockAccessibilityService service = MockAccessibilityService.getInstance(activity);
- service.expectEvent(focusedEvent);
- service.replay();
-
- // trigger the event
- final Button button = (Button) activity.findViewById(R.id.button);
- activity.runOnUiThread(new Runnable() {
- public void run() {
- button.requestFocus();
- }
- });
-
- // verify if all expected methods have been called
- assertMockServiceVerifiedWithinTimeout(service);
- }
-
- @LargeTest
- public void testTypeViewTextChangedAccessibilityEvent() throws Throwable {
- Activity activity = getActivity();
-
- // focus the edit text
- final EditText editText = (EditText) activity.findViewById(R.id.edittext);
- activity.runOnUiThread(new Runnable() {
- public void run() {
- editText.requestFocus();
- }
- });
-
- // wait for the generated focus event to be dispatched
- Thread.sleep(MAX_TIMEOUT_ASYNCHRONOUS_PROCESSING);
-
- final String beforeText = activity.getString(R.string.text_input_blah);
- final String newText = activity.getString(R.string.text_input_blah_blah);
- final String afterText = beforeText.substring(0, 3) + newText;
-
- // create and populate the expected event
- AccessibilityEvent textChangedEvent = AccessibilityEvent.obtain();
- textChangedEvent.setEventType(AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED);
- textChangedEvent.setClassName(EditText.class.getName());
- textChangedEvent.setPackageName(getActivity().getPackageName());
- textChangedEvent.getText().add(afterText);
- textChangedEvent.setBeforeText(beforeText);
- textChangedEvent.setFromIndex(3);
- textChangedEvent.setAddedCount(9);
- textChangedEvent.setRemovedCount(1);
- textChangedEvent.setEnabled(true);
-
- // set expectations
- MockAccessibilityService service = MockAccessibilityService.getInstance(activity);
- service.expectEvent(textChangedEvent);
- service.replay();
-
- // trigger the event
- activity.runOnUiThread(new Runnable() {
- public void run() {
- editText.getEditableText().replace(3, 4, newText);
- }
- });
-
- // verify if all expected methods have been called
- assertMockServiceVerifiedWithinTimeout(service);
- }
-
- @LargeTest
- public void testTypeWindowStateChangedAccessibilityEvent() throws Throwable {
- Activity activity = getActivity();
- String title = activity.getString(R.string.alert_title);
- String message = activity.getString(R.string.alert_message);
-
- // create and populate the expected event
- AccessibilityEvent windowStateChangedEvent = AccessibilityEvent.obtain();
- windowStateChangedEvent.setEventType(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
- windowStateChangedEvent.setClassName(AlertDialog.class.getName());
- windowStateChangedEvent.setPackageName(getActivity().getPackageName());
- windowStateChangedEvent.getText().add(title);
- windowStateChangedEvent.getText().add(message);
- windowStateChangedEvent.setEnabled(true);
-
- // set expectations
- MockAccessibilityService service = MockAccessibilityService.getInstance(activity);
- service.expectEvent(windowStateChangedEvent);
- service.replay();
-
- // trigger the event
- final EditText editText = (EditText) activity.findViewById(R.id.edittext);
- activity.runOnUiThread(new Runnable() {
- public void run() {
- AlertDialog dialog = (new AlertDialog.Builder(getActivity())
- .setTitle(R.string.alert_title).setMessage(R.string.alert_message))
- .create();
- dialog.show();
- }
- });
-
- // verify if all expected methods have been called
- assertMockServiceVerifiedWithinTimeout(service);
- }
-
- @LargeTest
- public void testTypeNotificationStateChangedAccessibilityEvent() throws Throwable {
- Activity activity = getActivity();
- String message = activity.getString(R.string.notification_message);
-
- // create the notification to send
- int notificationId = 1;
- Notification notification = new Notification();
- notification.icon = android.R.drawable.stat_notify_call_mute;
- notification.contentIntent = PendingIntent.getActivity(getActivity(), 0, new Intent(),
- PendingIntent.FLAG_CANCEL_CURRENT);
- notification.tickerText = message;
- notification.setLatestEventInfo(getActivity(), "", "", notification.contentIntent);
-
- // create and populate the expected event
- AccessibilityEvent notificationChangedEvent = AccessibilityEvent.obtain();
- notificationChangedEvent.setEventType(AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED);
- notificationChangedEvent.setClassName(Notification.class.getName());
- notificationChangedEvent.setPackageName(getActivity().getPackageName());
- notificationChangedEvent.getText().add(message);
- notificationChangedEvent.setParcelableData(notification);
-
- // set expectations
- MockAccessibilityService service = MockAccessibilityService.getInstance(activity);
- service.expectEvent(notificationChangedEvent);
- service.replay();
-
- // trigger the event
- NotificationManager notificationManager = (NotificationManager) activity
- .getSystemService(Service.NOTIFICATION_SERVICE);
- notificationManager.notify(notificationId, notification);
-
- // verify if all expected methods have been called
- assertMockServiceVerifiedWithinTimeout(service);
-
- // remove the notification
- notificationManager.cancel(notificationId);
- }
-
- /**
- * Asserts the the mock accessibility service has been successfully verified
- * (which is it has received the expected method calls with expected
- * arguments) within the {@link #MAX_TIMEOUT_ASYNCHRONOUS_PROCESSING}. The
- * verified state is checked by polling upon small intervals.
- *
- * @param service The service to verify.
- * @throws Exception If the verification has failed with exception after the
- * {@link #MAX_TIMEOUT_ASYNCHRONOUS_PROCESSING}.
- */
- private void assertMockServiceVerifiedWithinTimeout(MockAccessibilityService service)
- throws Throwable {
- Throwable lastVerifyThrowable = null;
- long beginTime = SystemClock.uptimeMillis();
- long pollTmeout = MAX_TIMEOUT_ASYNCHRONOUS_PROCESSING / COUNT_POLLING_ATTEMPTS;
-
- // poll until the timeout has elapsed
- while (SystemClock.uptimeMillis() - beginTime < MAX_TIMEOUT_ASYNCHRONOUS_PROCESSING) {
- // sleep first since immediate call will always fail
- try {
- Thread.sleep(pollTmeout);
- } catch (InterruptedException ie) {
- /* ignore */
- }
-
- try {
- service.verify();
- // success - reset so it is not accept more events
- service.reset();
- return;
- } catch (IllegalStateException ise) {
- // this exception is thrown if the expected event is not
- // received yet, so we will keep trying within the timeout
- lastVerifyThrowable = ise;
- continue;
- } catch (Throwable t) {
- // we have just failed
- lastVerifyThrowable = t;
- break;
- }
- }
-
- // failure - reset so it is not accept more events
- service.reset();
- throw lastVerifyThrowable;
- }
-
- static class MockAccessibilityService extends AccessibilityService implements
- ServiceConnection {
-
- /**
- * The singleton instance.
- */
- private static MockAccessibilityService sInstance;
-
- /**
- * The events this service expects to receive.
- */
- private final Queue<AccessibilityEvent> mExpectedEvents =
- new LinkedList<AccessibilityEvent>();
-
- /**
- * Interruption call this service expects to receive.
- */
- private boolean mExpectedInterrupt;
-
- /**
- * Flag if the mock is currently replaying.
- */
- private boolean mReplaying;
-
- /**
- * Flag indicating if this mock is initialized.
- */
- private boolean mInitialized;
-
- /**
- * The {@link Context} whose services to utilize.
- */
- private Context mContext;
-
- /**
- * Gets the {@link MockAccessibilityService} singleton.
- *
- * @param context A context handle.
- * @return The mock service.
- */
- public static MockAccessibilityService getInstance(Context context) {
- if (sInstance == null) {
- // since we do bind once and do not unbind from the delegating
- // service and JUnit3 does not support @BeforeTest and @AfterTest,
- // we will leak a service connection after the test but this
- // does not affect the test results and the test is twice as fast
- sInstance = new MockAccessibilityService(context);
- }
- return sInstance;
- }
-
- /**
- * Creates a new instance.
- */
- private MockAccessibilityService(Context context) {
- mContext = context;
- ensureSetupAndBoundToDelegatingAccessibilityService();
- }
-
- /**
- * Ensures the required setup for the test performed and that it is bound to the
- * DelegatingAccessibilityService which runs in another process. The setup is
- * enabling accessibility and installing and enabling the delegating accessibility
- * service this test binds to.
- * </p>
- * Note: Please look at the class description for information why such an
- * approach is taken.
- */
- public void ensureSetupAndBoundToDelegatingAccessibilityService() {
- // check if accessibility is enabled
- AccessibilityManager accessibilityManager = (AccessibilityManager) mContext
- .getSystemService(Service.ACCESSIBILITY_SERVICE);
-
- if (!accessibilityManager.isEnabled()) {
- throw new IllegalStateException("Accessibility not enabled. "
- + "(Settings -> Accessibility)");
- }
-
- // check if the delegating service is running
- ComponentName delegatingServiceName = new ComponentName(
- DELEGATING_SERVICE_PACKAGE, DELEGATING_SERVICE_CLASS_NAME);
- ActivityManager activityManager = (ActivityManager) mContext
- .getSystemService(Service.ACTIVITY_SERVICE);
- boolean delegatingServiceRunning = false;
-
- for (RunningServiceInfo runningServiceInfo : activityManager.getRunningServices(100)) {
- if (delegatingServiceName.equals(runningServiceInfo.service)) {
- delegatingServiceRunning = true;
- break;
- }
- }
-
- if (!delegatingServiceRunning) {
- // delegating service not running, so check if it is installed at all
- try {
- PackageManager packageManager = mContext.getPackageManager();
- packageManager.getServiceInfo(delegatingServiceName, 0);
- } catch (NameNotFoundException nnfe) {
- throw new IllegalStateException("CtsDelegatingAccessibilityService.apk" +
- " not installed.");
- }
-
- throw new IllegalStateException("Delegating Accessibility Service not running."
- + "(Settings -> Accessibility -> Delegating Accessibility Service)");
- }
-
- Intent intent = new Intent().setClassName(DELEGATING_SERVICE_PACKAGE,
- DELEGATING_SERVICE_CONNECTION_CLASS_NAME);
- mContext.bindService(intent, this, Context.BIND_AUTO_CREATE);
-
- long beginTime = SystemClock.uptimeMillis();
- long pollTmeout = MAX_TIMEOUT_ASYNCHRONOUS_PROCESSING / COUNT_POLLING_ATTEMPTS;
-
- // bind to the delegating service which runs in another process by
- // polling until the binder connection is established
- while (SystemClock.uptimeMillis() - beginTime < MAX_TIMEOUT_ASYNCHRONOUS_PROCESSING) {
- if (mInitialized) {
- // success
- return;
- }
- try {
- Thread.sleep(pollTmeout);
- } catch (InterruptedException ie) {
- /* ignore */
- }
- }
- }
-
- /**
- * Starts replaying the mock.
- */
- private void replay() {
- mReplaying = true;
- }
-
- /**
- * Verifies if all expected service methods have been called.
- */
- private void verify() {
- synchronized (this) {
- if (!mReplaying) {
- throw new IllegalStateException("Did you forget to call replay()");
- }
- if (mExpectedInterrupt) {
- throw new IllegalStateException("Expected call to #interrupt() not received");
- }
- if (!mExpectedEvents.isEmpty()) {
- throw new IllegalStateException("Expected a call to onAccessibilityEvent() for "
- + "events \"" + mExpectedEvents + "\" not received");
- }
- }
- }
-
- /**
- * Resets this instance so it can be reused.
- */
- private void reset() {
- synchronized (this) {
- mExpectedEvents.clear();
- mExpectedInterrupt = false;
- mReplaying = false;
- }
- }
-
- /**
- * Sets an expected call to
- * {@link #onAccessibilityEvent(AccessibilityEvent)} with given event as
- * argument.
- *
- * @param expectedEvent The expected event argument.
- */
- private void expectEvent(AccessibilityEvent expectedEvent) {
- mExpectedEvents.add(expectedEvent);
- }
-
- /**
- * Sets an expected call of {@link #onInterrupt()}.
- */
- public void expectInterrupt() {
- mExpectedInterrupt = true;
- }
-
- @Override
- public void onAccessibilityEvent(AccessibilityEvent receivedEvent) {
- synchronized (this) {
- if (!mReplaying) {
- return;
- }
- if (mExpectedEvents.isEmpty()) {
- throw new IllegalStateException("Unexpected event: " + receivedEvent);
- }
- AccessibilityEvent expectedEvent = mExpectedEvents.poll();
- assertEqualsAccessiblityEvent(expectedEvent, receivedEvent);
-
- }
- }
-
- @Override
- public void onInterrupt() {
- synchronized (this) {
- if (!mReplaying) {
- return;
- }
-
- if (!mExpectedInterrupt) {
- throw new IllegalStateException("Unexpected call to onInterrupt()");
- }
-
- mExpectedInterrupt = false;
- }
- }
-
- /**
- * {@inheritDoc ServiceConnection#onServiceConnected(ComponentName,IBinder)}
- */
- public void onServiceConnected(ComponentName name, IBinder service) {
- IAccessibilityServiceDelegateConnection connection =
- IAccessibilityServiceDelegateConnection.Stub
- .asInterface(service);
- try {
- connection.setAccessibilityServiceDelegate(new AccessibilityServiceDelegate(this));
- mInitialized = true;
- } catch (RemoteException re) {
- fail("Could not set delegate to the delegating service.");
- }
- }
-
- /**
- * {@inheritDoc ServiceConnection#onServiceDisconnected(ComponentName)}
- */
- public void onServiceDisconnected(ComponentName name) {
- mInitialized = false;
- /* do nothing */
- }
-
- /**
- * Compares all properties of the <code>expectedEvent</code> and the
- * <code>receviedEvent</code> to verify that the received event is the
- * one that is expected.
- */
- private void assertEqualsAccessiblityEvent(AccessibilityEvent expectedEvent,
- AccessibilityEvent receivedEvent) {
- TestCase.assertEquals("addedCount has incorrect value", expectedEvent.getAddedCount(),
- receivedEvent.getAddedCount());
- TestCase.assertEquals("beforeText has incorrect value", expectedEvent.getBeforeText(),
- receivedEvent.getBeforeText());
- TestCase.assertEquals("checked has incorrect value", expectedEvent.isChecked(),
- receivedEvent.isChecked());
- TestCase.assertEquals("className has incorrect value", expectedEvent.getClassName(),
- receivedEvent.getClassName());
- TestCase.assertEquals("contentDescription has incorrect value", expectedEvent
- .getContentDescription(), receivedEvent.getContentDescription());
- TestCase.assertEquals("currentItemIndex has incorrect value", expectedEvent
- .getCurrentItemIndex(), receivedEvent.getCurrentItemIndex());
- TestCase.assertEquals("enabled has incorrect value", expectedEvent.isEnabled(),
- receivedEvent.isEnabled());
- TestCase.assertEquals("eventType has incorrect value", expectedEvent.getEventType(),
- receivedEvent.getEventType());
- TestCase.assertEquals("fromIndex has incorrect value", expectedEvent.getFromIndex(),
- receivedEvent.getFromIndex());
- TestCase.assertEquals("fullScreen has incorrect value", expectedEvent.isFullScreen(),
- receivedEvent.isFullScreen());
- TestCase.assertEquals("itemCount has incorrect value", expectedEvent.getItemCount(),
- receivedEvent.getItemCount());
- // This will fail due to a bug fixed in Gingerbread. Bug 2593810 (removed the method).
- // assertEqualsNotificationAsParcelableData(expectedEvent, receivedEvent);
- TestCase.assertEquals("password has incorrect value", expectedEvent.isPassword(),
- receivedEvent.isPassword());
- TestCase.assertEquals("removedCount has incorrect value", expectedEvent
- .getRemovedCount(), receivedEvent.getRemovedCount());
- assertEqualsText(expectedEvent, receivedEvent);
- }
-
- /**
- * Compares the text of the <code>expectedEvent</code> and
- * <code>receivedEvent</code> by comparing the string representation of
- * the corresponding {@link CharSequence}s.
- */
- private void assertEqualsText(AccessibilityEvent expectedEvent,
- AccessibilityEvent receivedEvent) {
- String message = "text has incorrect value";
- List<CharSequence> expectedText = expectedEvent.getText();
- List<CharSequence> receivedText = receivedEvent.getText();
-
- TestCase.assertEquals(message, expectedText.size(), receivedText.size());
-
- Iterator<CharSequence> expectedTextIterator = expectedText.iterator();
- Iterator<CharSequence> receivedTextIterator = receivedText.iterator();
-
- for (int i = 0; i < expectedText.size(); i++) {
- // compare the string representation
- TestCase.assertEquals(message, expectedTextIterator.next().toString(),
- receivedTextIterator.next().toString());
- }
- }
-
- /**
- * This class is the delegate called by the DelegatingAccessibilityService.
- */
- private class AccessibilityServiceDelegate extends
- IAccessibilityServiceDelegate.Stub implements Handler.Callback {
-
- /**
- * Tag for logging.
- */
- private static final String LOG_TAG = "AccessibilityServiceDelegate";
-
- /**
- * Message type for calling {@link #onInterrupt()}
- */
- private static final int DO_ON_INTERRUPT = 10;
-
- /**
- * Message type for calling {@link #onAccessibilityEvent(AccessibilityEvent)}
- */
- private static final int DO_ON_ACCESSIBILITY_EVENT = 20;
-
- /**
- * Caller for handling {@link Message}s
- */
- private final Handler mHandler;
-
- /**
- * The {@link MockAccessibilityService} to which to delegate;
- */
- private MockAccessibilityService mMockAccessibilityService;
-
- /**
- * Creates a new instance.
- *
- * @param mockAccessibilityService The service to whcih to delegate.
- */
- public AccessibilityServiceDelegate(MockAccessibilityService mockAccessibilityService) {
- mMockAccessibilityService = mockAccessibilityService;
- mHandler = new Handler(this);
- }
-
- /**
- * {@inheritDoc IAccessibilityServiceDelegate#onAccessibilityEvent(AccessibilityEvent)}
- */
- public void onAccessibilityEvent(AccessibilityEvent event) {
- Message message = Message.obtain(mHandler, DO_ON_ACCESSIBILITY_EVENT, event);
- mHandler.sendMessage(message);
- }
-
- /**
- * {@inheritDoc IAccessibilityServiceDelegate#onInterrupt()}
- */
- public void onInterrupt() {
- Message message = mHandler.obtainMessage(DO_ON_INTERRUPT);
- mHandler.sendMessage(message);
- }
-
- /**
- * {@inheritDoc Handler.Callback#handleMessage(Message)}
- */
- public boolean handleMessage(Message message) {
- switch (message.what) {
- case DO_ON_ACCESSIBILITY_EVENT:
- AccessibilityEvent event = (AccessibilityEvent) message.obj;
- if (event != null) {
- mMockAccessibilityService.onAccessibilityEvent(event);
- event.recycle();
- }
- return true;
- case DO_ON_INTERRUPT:
- mMockAccessibilityService.onInterrupt();
- return true;
- default:
- Log.w(LOG_TAG, "Unknown message type " + message.what);
- return false;
- }
- }
- }
- }
-}
diff --git a/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTestActivity.java b/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTestActivity.java
deleted file mode 100644
index e806622..0000000
--- a/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTestActivity.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2010 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.accessibilityservice.cts;
-
-import android.app.Activity;
-import android.content.Context;
-import android.os.Bundle;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.ListAdapter;
-import android.widget.ListView;
-import android.widget.TextView;
-
-import com.android.cts.accessibilityservice.R;
-
-/**
- * This class is an {@link Activity} used to perform end-to-end
- * testing of the accessibility feature by interaction with the
- * UI widgets.
- */
-public class AccessibilityEndToEndTestActivity extends Activity {
-
- final Context context = this;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.end_to_end_test);
-
- ListAdapter listAdapter = new BaseAdapter() {
- public View getView(int position, View convertView, ViewGroup parent) {
- TextView textView = (TextView) View
- .inflate(context, R.layout.list_view_row, null);
- textView.setText((String) getItem(position));
- return textView;
- }
-
- public long getItemId(int position) {
- return position;
- }
-
- public Object getItem(int position) {
- if (position == 0) {
- return context.getString(R.string.first_list_item);
- } else {
- return context.getString(R.string.second_list_item);
- }
- }
-
- public int getCount() {
- return 2;
- }
- };
-
- ListView listView = (ListView) findViewById(R.id.listview);
- listView.setAdapter(listAdapter);
- }
-}
diff --git a/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityServiceInfoTest.java b/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityServiceInfoTest.java
deleted file mode 100644
index 48b4aae..0000000
--- a/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityServiceInfoTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2010 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.accessibilityservice.cts;
-
-import android.accessibilityservice.AccessibilityServiceInfo;
-import android.os.Parcel;
-import android.test.suitebuilder.annotation.SmallTest;
-import android.view.accessibility.AccessibilityEvent;
-
-import junit.framework.TestCase;
-
-/**
- * Class for testing {@link AccessibilityServiceInfo}.
- */
-public class AccessibilityServiceInfoTest extends TestCase {
-
- @SmallTest
- public void testMarshalling() throws Exception {
-
- // fully populate the service info to marshal
- AccessibilityServiceInfo sentInfo = new AccessibilityServiceInfo();
- fullyPopulateSentAccessibilityServiceInfo(sentInfo);
-
- // marshal and unmarshal the service info
- Parcel parcel = Parcel.obtain();
- sentInfo.writeToParcel(parcel, 0);
- parcel.setDataPosition(0);
- AccessibilityServiceInfo receivedInfo = AccessibilityServiceInfo.CREATOR
- .createFromParcel(parcel);
-
- // make sure all fields properly marshaled
- assertAllFieldsProperlyMarshalled(sentInfo, receivedInfo);
- }
-
- /**
- * Fully populates the {@link AccessibilityServiceInfo} to marshal.
- *
- * @param sentInfo The service info to populate.
- */
- private void fullyPopulateSentAccessibilityServiceInfo(AccessibilityServiceInfo sentInfo) {
- sentInfo.eventTypes = AccessibilityEvent.TYPE_VIEW_CLICKED;
- sentInfo.feedbackType = AccessibilityServiceInfo.FEEDBACK_SPOKEN;
- sentInfo.flags = AccessibilityServiceInfo.DEFAULT;
- sentInfo.notificationTimeout = 1000;
- sentInfo.packageNames = new String[] {
- "foo.bar.baz"
- };
- }
-
- /**
- * Compares all properties of the <code>sentInfo</code> and the
- * <code>receviedInfo</code> to make sure marshalling is correctly
- * implemented.
- */
- private void assertAllFieldsProperlyMarshalled(AccessibilityServiceInfo sentInfo,
- AccessibilityServiceInfo receivedInfo) {
- assertEquals("eventTypes not marshalled properly", sentInfo.eventTypes,
- receivedInfo.eventTypes);
- assertEquals("feedbackType not marshalled properly", sentInfo.feedbackType,
- receivedInfo.feedbackType);
- // This will fail here and is fixed in Froyo. Bug 2448479.
- // assertEquals("flags not marshalled properly", sentInfo.flags, receivedInfo.flags);
- assertEquals("notificationTimeout not marshalled properly", sentInfo.notificationTimeout,
- receivedInfo.notificationTimeout);
- assertEquals("packageNames not marshalled properly", sentInfo.packageNames.length,
- receivedInfo.packageNames.length);
- assertEquals("packageNames not marshalled properly", sentInfo.packageNames[0],
- receivedInfo.packageNames[0]);
- }
-}
diff --git a/tests/tests/app/src/android/app/cts/ActivityGroupTest.java b/tests/tests/app/src/android/app/cts/ActivityGroupTest.java
index 0cf7998..05287cd 100644
--- a/tests/tests/app/src/android/app/cts/ActivityGroupTest.java
+++ b/tests/tests/app/src/android/app/cts/ActivityGroupTest.java
@@ -16,6 +16,7 @@
package android.app.cts;
+import dalvik.annotation.BrokenTest;
import dalvik.annotation.TestLevel;
import dalvik.annotation.TestTargetClass;
import dalvik.annotation.TestTargetNew;
@@ -166,6 +167,7 @@
args = {}
)
})
+ @BrokenTest(value="bug 2189784, needs investigation")
public void testTabScreen() throws Exception {
mIntent = mTabIntent;
runLaunchpad(LaunchpadActivity.LIFECYCLE_SCREEN);
@@ -233,8 +235,143 @@
args = {}
)
})
+ @BrokenTest(value="bug 2189784, needs investigation")
public void testTabDialog() throws Exception {
mIntent = mTabIntent;
runLaunchpad(LaunchpadActivity.LIFECYCLE_DIALOG);
}
+
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "ActivityGroup",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "ActivityGroup",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "onCreate",
+ args = {Bundle.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "onResume",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "onSaveInstanceState",
+ args = {Bundle.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "onPause",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "onStop",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "onDestroy",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "getCurrentActivity",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "getLocalActivityManager",
+ args = {}
+ )
+ })
+ public void testTabFinishCreate() throws Exception {
+ mIntent = mTabIntent;
+ runLaunchpad(LaunchpadActivity.LIFECYCLE_FINISH_CREATE);
+ }
+
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "ActivityGroup",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "ActivityGroup",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "onCreate",
+ args = {Bundle.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "onResume",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "onSaveInstanceState",
+ args = {Bundle.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "onPause",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "onStop",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "onDestroy",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "getCurrentActivity",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "getLocalActivityManager",
+ args = {}
+ )
+ })
+ public void testTabFinishStart() throws Exception {
+ mIntent = mTabIntent;
+ runLaunchpad(LaunchpadActivity.LIFECYCLE_FINISH_START);
+ }
}
diff --git a/tests/tests/app/src/android/app/cts/AlertDialog_BuilderTest.java b/tests/tests/app/src/android/app/cts/AlertDialog_BuilderTest.java
index c56dc28..84c64a4 100644
--- a/tests/tests/app/src/android/app/cts/AlertDialog_BuilderTest.java
+++ b/tests/tests/app/src/android/app/cts/AlertDialog_BuilderTest.java
@@ -40,10 +40,14 @@
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.FrameLayout;
+import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
+import android.widget.TextView;
import android.widget.AdapterView.OnItemSelectedListener;
+import com.android.internal.R;
+
import dalvik.annotation.TestLevel;
import dalvik.annotation.TestTargetClass;
import dalvik.annotation.TestTargetNew;
@@ -54,8 +58,12 @@
private Context mContext;
private Instrumentation mInstrumentation;
private final CharSequence mTitle = "title";
+ private final CharSequence mMessage = "message";
+ private TextView mTitleView;
+ private TextView mMessageView;
private Drawable mDrawable;
private AlertDialog mDialog;
+ private LinearLayout mLinearLayout;
private Button mButton;
private boolean mResult;
private boolean mItemSelected;
@@ -111,11 +119,14 @@
super.setUp();
mBuilder = null;
mInstrumentation = getInstrumentation();
- mContext = getActivity();
+ mContext = (Context)getActivity();
+ mTitleView = null;
+ mMessageView = null;
mButton = null;
mView = null;
mListView = null;
mDialog = null;
+ mLinearLayout = null;
mItemSelected = false;
mSelectedItem = null;
mSelectedItems = new ArrayList<Integer>();
@@ -127,6 +138,30 @@
@TestTargetNew(
level = TestLevel.COMPLETE,
+ method = "setCustomTitle",
+ args = {View.class}
+ )
+ public void testSetCustomTitle() throws Throwable {
+ final String expectecTitle = "test";
+ final TextView view = new TextView(mContext);
+ view.setText(expectecTitle);
+ runTestOnUiThread(new Runnable() {
+ public void run() {
+ mBuilder = new AlertDialog.Builder(mContext);
+ mBuilder.setCustomTitle(view);
+ mDialog = mBuilder.show();
+ }
+ });
+ mInstrumentation.waitForIdleSync();
+ final LinearLayout topPanel = (LinearLayout)mDialog.getWindow().findViewById(
+ com.android.internal.R.id.topPanel);
+ final TextView atv = (TextView)topPanel.getChildAt(2);
+ final String title = (String)atv.getText();
+ assertEquals(expectecTitle, title);
+ }
+
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
method = "AlertDialog.Builder",
args = {Context.class}
)
@@ -136,15 +171,87 @@
@TestTargetNew(
level = TestLevel.COMPLETE,
+ method = "setTitle",
+ args = {int.class}
+ )
+ public void testSetTitleWithParamInt() throws Throwable {
+ runTestOnUiThread(new Runnable() {
+ public void run() {
+ mBuilder = new AlertDialog.Builder(mContext);
+ mBuilder.setTitle(R.string.am);
+ mDialog = mBuilder.show();
+ mTitleView = (TextView)mDialog.getWindow().findViewById(R.id.alertTitle);
+ }
+ });
+ mInstrumentation.waitForIdleSync();
+ assertEquals(mTitleView.getText(), mContext.getText(R.string.am));
+ }
+
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setTitle",
+ args = {CharSequence.class}
+ )
+ public void testSetTitleWithParamCharSequence() throws Throwable {
+ runTestOnUiThread(new Runnable() {
+ public void run() {
+ mBuilder = new AlertDialog.Builder(mContext);
+ mBuilder.setTitle(mTitle);
+ mDialog = mBuilder.show();
+ mTitleView = (TextView)mDialog.getWindow().findViewById(R.id.alertTitle);
+ }
+ });
+ mInstrumentation.waitForIdleSync();
+ assertEquals(mTitleView.getText(), mTitle);
+ }
+
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setMessage",
+ args = {int.class}
+ )
+ public void testSetMessageWithParamInt() throws Throwable {
+ runTestOnUiThread(new Runnable() {
+ public void run() {
+ mBuilder = new AlertDialog.Builder(mContext);
+ mBuilder.setMessage(R.string.am);
+ mDialog = mBuilder.show();
+ mMessageView = (TextView)mDialog.getWindow().findViewById(R.id.message);
+ }
+ });
+ mInstrumentation.waitForIdleSync();
+ assertEquals(mMessageView.getText(), mContext.getText(R.string.am));
+ }
+
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setMessage",
+ args = {CharSequence.class}
+ )
+ public void testSetMessageWithParamCharSequence() throws Throwable {
+ runTestOnUiThread(new Runnable() {
+ public void run() {
+ mBuilder = new AlertDialog.Builder(mContext);
+ mBuilder.setMessage(mMessage);
+ mDialog = mBuilder.show();
+ mMessageView = (TextView)mDialog.getWindow().findViewById(R.id.message);
+ }
+ });
+ mInstrumentation.waitForIdleSync();
+ assertEquals(mMessageView.getText(), mMessage);
+ }
+
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
method = "setIcon",
args = {int.class}
)
public void testSetIconWithParamInt() throws Throwable {
runTestOnUiThread(new Runnable() {
public void run() {
- mDrawable = mContext.getResources().getDrawable(android.R.drawable.btn_default);
+ mDrawable = mContext.getResources().getDrawable(R.drawable.btn_check_on);
mBuilder = new AlertDialog.Builder(mContext);
- mBuilder.setIcon(android.R.drawable.btn_default);
+ mBuilder.setIcon(R.drawable.btn_check_on);
mDialog = mBuilder.show();
}
});
@@ -159,7 +266,7 @@
public void testSetIconWithParamDrawable() throws Throwable {
runTestOnUiThread(new Runnable() {
public void run() {
- mDrawable = mContext.getResources().getDrawable(android.R.drawable.btn_default);
+ mDrawable = mContext.getResources().getDrawable(R.drawable.btn_check_on);
mBuilder = new AlertDialog.Builder(mContext);
mBuilder.setIcon(mDrawable);
mDialog = mBuilder.show();
@@ -177,15 +284,15 @@
runTestOnUiThread(new Runnable() {
public void run() {
mBuilder = new AlertDialog.Builder(mContext);
- mBuilder.setPositiveButton(android.R.string.yes, mOnClickListener);
+ mBuilder.setPositiveButton(R.string.year, mOnClickListener);
mDialog = mBuilder.show();
- mButton = mDialog.getButton(DialogInterface.BUTTON_POSITIVE);
+ mButton = (Button)mDialog.getWindow().findViewById(R.id.button1);
mButton.performClick();
}
});
mInstrumentation.waitForIdleSync();
- assertEquals(mContext.getText(android.R.string.yes), mButton.getText());
+ assertEquals(mContext.getText(R.string.year), mButton.getText());
assertTrue(mResult);
}
@@ -198,14 +305,14 @@
runTestOnUiThread(new Runnable() {
public void run() {
mBuilder = new AlertDialog.Builder(mContext);
- mBuilder.setPositiveButton(android.R.string.yes, mOnClickListener);
+ mBuilder.setPositiveButton(R.string.year, mOnClickListener);
mDialog = mBuilder.show();
- mButton = mDialog.getButton(DialogInterface.BUTTON_POSITIVE);
+ mButton = (Button)mDialog.getWindow().findViewById(R.id.button1);
mButton.performClick();
}
});
mInstrumentation.waitForIdleSync();
- assertEquals(mContext.getText(android.R.string.yes), mButton.getText());
+ assertEquals(mContext.getText(R.string.year), mButton.getText());
assertTrue(mResult);
}
@@ -220,7 +327,7 @@
mBuilder = new AlertDialog.Builder(mContext);
mBuilder.setNegativeButton(mTitle, mOnClickListener);
mDialog = mBuilder.show();
- mButton = mDialog.getButton(DialogInterface.BUTTON_NEGATIVE);
+ mButton = (Button)mDialog.getWindow().findViewById(R.id.button2);
mButton.performClick();
}
});
@@ -240,7 +347,7 @@
mBuilder = new AlertDialog.Builder(mContext);
mBuilder.setNegativeButton(com.android.cts.stub.R.string.notify, mOnClickListener);
mDialog = mBuilder.show();
- mButton = mDialog.getButton(DialogInterface.BUTTON_NEGATIVE);
+ mButton = (Button)mDialog.getWindow().findViewById(R.id.button2);
mButton.performClick();
}
});
@@ -260,7 +367,7 @@
mBuilder = new AlertDialog.Builder(mContext);
mBuilder.setNeutralButton(com.android.cts.stub.R.string.notify, mOnClickListener);
mDialog = mBuilder.show();
- mButton = mDialog.getButton(DialogInterface.BUTTON_NEUTRAL);
+ mButton = (Button)mDialog.getWindow().findViewById(R.id.button3);
mButton.performClick();
}
});
@@ -280,7 +387,7 @@
mBuilder = new AlertDialog.Builder(mContext);
mBuilder.setNeutralButton(mTitle, mOnClickListener);
mDialog = mBuilder.show();
- mButton = mDialog.getButton(DialogInterface.BUTTON_NEUTRAL);
+ mButton = (Button)mDialog.getWindow().findViewById(R.id.button3);
mButton.performClick();
}
});
@@ -369,7 +476,8 @@
mBuilder = new AlertDialog.Builder(mContext);
mBuilder.setItems(com.android.cts.stub.R.array.difficultyLevel, mOnClickListener);
mDialog = mBuilder.show();
- mListView = mDialog.getListView();
+ mLinearLayout = (LinearLayout)mDialog.getWindow().findViewById(R.id.contentPanel);
+ mListView = (ListView)mLinearLayout.getChildAt(0);
}
});
mInstrumentation.waitForIdleSync();
@@ -393,7 +501,8 @@
mBuilder = new AlertDialog.Builder(mContext);
mBuilder.setItems(expect, mOnClickListener);
mDialog = mBuilder.show();
- mListView = mDialog.getListView();
+ mLinearLayout = (LinearLayout)mDialog.getWindow().findViewById(R.id.contentPanel);
+ mListView = (ListView)mLinearLayout.getChildAt(0);
}
});
mInstrumentation.waitForIdleSync();
@@ -412,7 +521,8 @@
mBuilder = new AlertDialog.Builder(mContext);
mBuilder.setAdapter(adapter, mOnClickListener);
mDialog = mBuilder.show();
- mListView = mDialog.getListView();
+ mLinearLayout = (LinearLayout)mDialog.getWindow().findViewById(R.id.contentPanel);
+ mListView = (ListView)mLinearLayout.getChildAt(0);
}
});
mInstrumentation.waitForIdleSync();
@@ -434,7 +544,8 @@
mBuilder = new AlertDialog.Builder(mContext);
mBuilder.setCursor(c, mOnClickListener, People.NAME);
mDialog = mBuilder.show();
- mListView = mDialog.getListView();
+ mLinearLayout = (LinearLayout)mDialog.getWindow().findViewById(R.id.contentPanel);
+ mListView = (ListView)mLinearLayout.getChildAt(0);
mListView.performItemClick(null, 0, 0);
}
});
@@ -460,7 +571,8 @@
mBuilder.setMultiChoiceItems(com.android.cts.stub.R.array.difficultyLevel, null,
mOnMultiChoiceClickListener);
mDialog = mBuilder.show();
- mListView = mDialog.getListView();
+ mLinearLayout = (LinearLayout)mDialog.getWindow().findViewById(R.id.contentPanel);
+ mListView = (ListView)mLinearLayout.getChildAt(0);
mSelectedItem = (CharSequence)mListView.getSelectedItem();
mListView.performItemClick(null, 0, 0);
mListView.performItemClick(null, 1, 0);
@@ -487,7 +599,8 @@
mBuilder = new AlertDialog.Builder(mContext);
mBuilder.setMultiChoiceItems(items, null, mOnMultiChoiceClickListener);
mDialog = mBuilder.show();
- mListView = mDialog.getListView();
+ mLinearLayout = (LinearLayout)mDialog.getWindow().findViewById(R.id.contentPanel);
+ mListView = (ListView)mLinearLayout.getChildAt(0);
mSelectedItem = (CharSequence)mListView.getSelectedItem();
mListView.performItemClick(null, 0, 0);
mListView.performItemClick(null, 1, 0);
@@ -516,7 +629,8 @@
mBuilder.setMultiChoiceItems(c, People.NAME, People.NAME,
mOnMultiChoiceClickListener);
mDialog = mBuilder.show();
- mListView = mDialog.getListView();
+ mLinearLayout = (LinearLayout)mDialog.getWindow().findViewById(R.id.contentPanel);
+ mListView = (ListView)mLinearLayout.getChildAt(0);
mListView.performItemClick(null, 0, 0);
mListView.performItemClick(null, 1, 0);
}
@@ -543,7 +657,8 @@
mBuilder.setSingleChoiceItems(com.android.cts.stub.R.array.difficultyLevel, 0,
mOnClickListener);
mDialog = mBuilder.show();
- mListView = mDialog.getListView();
+ mLinearLayout = (LinearLayout)mDialog.getWindow().findViewById(R.id.contentPanel);
+ mListView = (ListView)mLinearLayout.getChildAt(0);
mSelectedItem = (CharSequence)mListView.getSelectedItem();
mListView.performItemClick(null, 0, 0);
}
@@ -581,7 +696,8 @@
mBuilder = new AlertDialog.Builder(mContext);
mBuilder.setSingleChoiceItems(c, 0, People.NAME, mOnClickListener);
mDialog = mBuilder.show();
- mListView = mDialog.getListView();
+ mLinearLayout = (LinearLayout)mDialog.getWindow().findViewById(R.id.contentPanel);
+ mListView = (ListView)mLinearLayout.getChildAt(0);
mListView.performItemClick(null, 0, 0);
}
});
@@ -605,7 +721,8 @@
mBuilder = new AlertDialog.Builder(mContext);
mBuilder.setSingleChoiceItems(items, 0, mOnClickListener);
mDialog = mBuilder.show();
- mListView = mDialog.getListView();
+ mLinearLayout = (LinearLayout)mDialog.getWindow().findViewById(R.id.contentPanel);
+ mListView = (ListView)mLinearLayout.getChildAt(0);
mSelectedItem = (CharSequence)mListView.getSelectedItem();
mListView.performItemClick(null, 0, 0);
}
@@ -629,10 +746,11 @@
public void run() {
mBuilder = new AlertDialog.Builder(mContext);
mBuilder.setSingleChoiceItems(new ArrayAdapter<CharSequence>(mContext,
- android.R.layout.select_dialog_singlechoice, android.R.id.text1, items), 0,
+ R.layout.select_dialog_singlechoice, R.id.text1, items), 0,
mOnClickListener);
mDialog = mBuilder.show();
- mListView = mDialog.getListView();
+ mLinearLayout = (LinearLayout)mDialog.getWindow().findViewById(R.id.contentPanel);
+ mListView = (ListView)mLinearLayout.getChildAt(0);
mSelectedItem = (CharSequence)mListView.getSelectedItem();
mListView.performItemClick(null, 0, 0);
}
@@ -655,7 +773,8 @@
mBuilder.setOnItemSelectedListener(mOnItemSelectedListener);
mBuilder.setItems(com.android.cts.stub.R.array.difficultyLevel, mOnClickListener);
mDialog = mBuilder.show();
- mListView = mDialog.getListView();
+ mLinearLayout = (LinearLayout)mDialog.getWindow().findViewById(R.id.contentPanel);
+ mListView = (ListView)mLinearLayout.getChildAt(0);
mListView.pointToPosition(0, 0);
}
});
@@ -670,13 +789,13 @@
)
public void testSetView() throws Throwable {
final View view = new View(mContext);
- view.setId(100);
runTestOnUiThread(new Runnable() {
public void run() {
mBuilder = new AlertDialog.Builder(mContext);
mBuilder.setView(view);
mDialog = mBuilder.show();
- mView = mDialog.getWindow().findViewById(100);
+ mFrameLayout = (FrameLayout)mDialog.getWindow().findViewById(R.id.custom);
+ mView = mFrameLayout.getChildAt(0);
}
});
mInstrumentation.waitForIdleSync();
@@ -694,18 +813,22 @@
final int viewSpacingRight = 30;
final int viewSpacingBottom = 40;
final View view = new View(mContext);
- view.setId(100);
runTestOnUiThread(new Runnable() {
public void run() {
mBuilder = new AlertDialog.Builder(mContext);
mBuilder.setView(view, viewSpacingLeft, viewSpacingTop, viewSpacingRight,
viewSpacingBottom);
mDialog = mBuilder.show();
- mView = mDialog.getWindow().findViewById(100);
+ mFrameLayout = (FrameLayout)mDialog.getWindow().findViewById(R.id.custom);
+ mView = mFrameLayout.getChildAt(0);
}
});
mInstrumentation.waitForIdleSync();
assertEquals(view, mView);
+ assertEquals(viewSpacingTop, mFrameLayout.getPaddingTop());
+ assertEquals(viewSpacingLeft, mFrameLayout.getPaddingLeft());
+ assertEquals(viewSpacingRight, mFrameLayout.getPaddingRight());
+ assertEquals(viewSpacingBottom, mFrameLayout.getPaddingBottom());
}
@TestTargetNew(
diff --git a/tests/tests/app/src/android/app/cts/InstrumentationTest.java b/tests/tests/app/src/android/app/cts/InstrumentationTest.java
index 5ce33a0..d883c86 100644
--- a/tests/tests/app/src/android/app/cts/InstrumentationTest.java
+++ b/tests/tests/app/src/android/app/cts/InstrumentationTest.java
@@ -36,10 +36,11 @@
import android.os.IBinder;
import android.os.SystemClock;
import android.test.InstrumentationTestCase;
-import android.view.KeyCharacterMap;
+import android.view.InputQueue;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
+import android.view.SurfaceHolder;
import android.view.View;
import android.view.Window;
import android.view.ViewGroup.LayoutParams;
@@ -50,6 +51,7 @@
import dalvik.annotation.TestTargetClass;
import dalvik.annotation.TestTargetNew;
import dalvik.annotation.TestTargets;
+import dalvik.annotation.ToBeFixed;
@TestTargetClass(Instrumentation.class)
public class InstrumentationTest extends InstrumentationTestCase {
@@ -491,13 +493,12 @@
assertEquals(text.length(), keyDownList.size());
assertEquals(text.length(), keyUpList.size());
- KeyCharacterMap kcm = KeyCharacterMap.load(KeyCharacterMap.BUILT_IN_KEYBOARD);
- KeyEvent[] keyEvents = kcm.getEvents(text.toCharArray());
+ for (int i = 0; i < keyDownList.size(); i++) {
+ assertEquals(KeyEvent.KEYCODE_A + i, keyDownList.get(i).getKeyCode());
+ }
- int i = 0;
- for (int j = 0; j < keyDownList.size(); j++) {
- assertEquals(keyEvents[i++].getKeyCode(), keyDownList.get(j).getKeyCode());
- assertEquals(keyEvents[i++].getKeyCode(), keyUpList.get(j).getKeyCode());
+ for (int i = 0; i < keyUpList.size(); i++) {
+ assertEquals(KeyEvent.KEYCODE_A + i, keyUpList.get(i).getKeyCode());
}
}
@@ -956,6 +957,14 @@
@Override
public void togglePanel(int featureId, KeyEvent event) {
}
+
+ @Override
+ public void takeSurface(SurfaceHolder.Callback2 callback) {
+ }
+
+ @Override
+ public void takeInputQueue(InputQueue.Callback queue) {
+ }
}
}
diff --git a/tests/tests/app/src/android/app/cts/LifecycleTest.java b/tests/tests/app/src/android/app/cts/LifecycleTest.java
index aa28628..56517ae 100644
--- a/tests/tests/app/src/android/app/cts/LifecycleTest.java
+++ b/tests/tests/app/src/android/app/cts/LifecycleTest.java
@@ -17,11 +17,6 @@
package android.app.cts;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
import android.app.Activity;
import android.app.Dialog;
import android.content.ComponentName;
@@ -45,6 +40,10 @@
import android.view.ViewGroup;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.WindowManager.LayoutParams;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
@TestTargetClass(Activity.class)
public class LifecycleTest extends ActivityTestsBase {
@@ -82,6 +81,2735 @@
),
@TestTargetNew(
level = TestLevel.COMPLETE,
+ method = "finalize",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getInstanceCount",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "closeContextMenu",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getIntent",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setIntent",
+ args = {Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getApplication",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "isChild",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getParent",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getWindowManager",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getWindow",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getCurrentFocus",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getWallpaperDesiredMinimumWidth",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getWallpaperDesiredMinimumHeight",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreate",
+ args = {Bundle.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onRestoreInstanceState",
+ args = {Bundle.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPostCreate",
+ args = {Bundle.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onStart",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onRestart",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onResume",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPostResume",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onNewIntent",
+ args = {Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onSaveInstanceState",
+ args = {Bundle.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPause",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateThumbnail",
+ args = {Bitmap.class, Canvas.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateDescription",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onStop",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onDestroy",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onConfigurationChanged",
+ args = {Configuration.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getChangingConfigurations",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getLastNonConfigurationInstance",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onRetainNonConfigurationInstance",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onLowMemory",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "managedQuery",
+ args = {Uri.class, String[].class, String.class, String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "managedQuery",
+ args = {Uri.class, String[].class, String.class, String[].class, String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "managedCommitUpdates",
+ args = {Cursor.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startManagingCursor",
+ args = {Cursor.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "stopManagingCursor",
+ args = {Cursor.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setPersistent",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "findViewById",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setContentView",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setContentView",
+ args = {View.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setContentView",
+ args = {View.class, ViewGroup.LayoutParams.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "addContentView",
+ args = {View.class, ViewGroup.LayoutParams.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setDefaultKeyMode",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onKeyDown",
+ args = {int.class, KeyEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onKeyUp",
+ args = {int.class, KeyEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onKeyMultiple",
+ args = {int.class, int.class, KeyEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onTouchEvent",
+ args = {MotionEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onTrackballEvent",
+ args = {MotionEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onWindowAttributesChanged",
+ args = {LayoutParams.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onContentChanged",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onWindowFocusChanged",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "hasWindowFocus",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "dispatchKeyEvent",
+ args = {KeyEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "dispatchTouchEvent",
+ args = {MotionEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "dispatchTrackballEvent",
+ args = {MotionEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreatePanelView",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreatePanelMenu",
+ args = {int.class, Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPreparePanel",
+ args = {int.class, View.class, Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onMenuOpened",
+ args = {int.class, Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onMenuItemSelected",
+ args = {int.class, MenuItem.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPanelClosed",
+ args = {int.class, Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateOptionsMenu",
+ args = {Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPrepareOptionsMenu",
+ args = {Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onOptionsItemSelected",
+ args = {MenuItem.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onOptionsMenuClosed",
+ args = {Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "openOptionsMenu",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "closeOptionsMenu",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateContextMenu",
+ args = {ContextMenu.class, View.class, ContextMenuInfo.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "registerForContextMenu",
+ args = {View.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "unregisterForContextMenu",
+ args = {View.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "openContextMenu",
+ args = {View.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onContextItemSelected",
+ args = {MenuItem.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onContextMenuClosed",
+ args = {Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateDialog",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPrepareDialog",
+ args = {int.class, Dialog.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "showDialog",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "dismissDialog",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "removeDialog",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onSearchRequested",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startSearch",
+ args = {String.class, boolean.class, Bundle.class, boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "takeKeyEvents",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "requestWindowFeature",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setFeatureDrawableResource",
+ args = {int.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setFeatureDrawableUri",
+ args = {int.class, Uri.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setFeatureDrawable",
+ args = {int.class, Drawable.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setFeatureDrawableAlpha",
+ args = {int.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getLayoutInflater",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getMenuInflater",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onApplyThemeResource",
+ args = {Theme.class, int.class, boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startActivityForResult",
+ args = {Intent.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startActivity",
+ args = {Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startActivityIfNeeded",
+ args = {Intent.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startNextMatchingActivity",
+ args = {Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startActivityFromChild",
+ args = {Activity.class, Intent.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setResult",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setResult",
+ args = {int.class, Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getCallingPackage",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getCallingActivity",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "isFinishing",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "finish",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "finishFromChild",
+ args = {Activity.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "finishActivity",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "finishActivityFromChild",
+ args = {Activity.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onActivityResult",
+ args = {int.class, int.class, Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "createPendingResult",
+ args = {int.class, Intent.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setRequestedOrientation",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getRequestedOrientation",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getTaskId",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "isTaskRoot",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "moveTaskToBack",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getLocalClassName",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getComponentName",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getPreferences",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getSystemService",
+ args = {String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setTitle",
+ args = {CharSequence.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setTitle",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setTitleColor",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getTitle",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getTitleColor",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onTitleChanged",
+ args = {CharSequence.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onChildTitleChanged",
+ args = {Activity.class, CharSequence.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setProgressBarVisibility",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setProgressBarIndeterminateVisibility",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setProgressBarIndeterminate",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setProgress",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setSecondaryProgress",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setVolumeControlStream",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getVolumeControlStream",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "runOnUiThread",
+ args = {Runnable.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateView",
+ args = {String.class, Context.class, AttributeSet.class}
+ )
+ })
+ public void testTabFinishStart() {
+ mIntent = mTabIntent;
+ runLaunchpad(LaunchpadActivity.LIFECYCLE_FINISH_START);
+ }
+
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "Activity",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "finalize",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onUserInteraction",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onUserLeaveHint",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setVisible",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "closeContextMenu",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getInstanceCount",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getIntent",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setIntent",
+ args = {Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getApplication",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "isChild",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getParent",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getWindowManager",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getWindow",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getCurrentFocus",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getWallpaperDesiredMinimumWidth",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getWallpaperDesiredMinimumHeight",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreate",
+ args = {Bundle.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onRestoreInstanceState",
+ args = {Bundle.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPostCreate",
+ args = {Bundle.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onStart",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onRestart",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onResume",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPostResume",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onNewIntent",
+ args = {Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onSaveInstanceState",
+ args = {Bundle.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPause",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateThumbnail",
+ args = {Bitmap.class, Canvas.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateDescription",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onStop",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onDestroy",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onConfigurationChanged",
+ args = {Configuration.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getChangingConfigurations",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getLastNonConfigurationInstance",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onRetainNonConfigurationInstance",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onLowMemory",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "managedQuery",
+ args = {Uri.class, String[].class, String.class, String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "managedQuery",
+ args = {Uri.class, String[].class, String.class, String[].class, String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "managedCommitUpdates",
+ args = {Cursor.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startManagingCursor",
+ args = {Cursor.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "stopManagingCursor",
+ args = {Cursor.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setPersistent",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "findViewById",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setContentView",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setContentView",
+ args = {View.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setContentView",
+ args = {View.class, ViewGroup.LayoutParams.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "addContentView",
+ args = {View.class, ViewGroup.LayoutParams.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setDefaultKeyMode",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onKeyDown",
+ args = {int.class, KeyEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onKeyUp",
+ args = {int.class, KeyEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onKeyMultiple",
+ args = {int.class, int.class, KeyEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onTouchEvent",
+ args = {MotionEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onTrackballEvent",
+ args = {MotionEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onWindowAttributesChanged",
+ args = {LayoutParams.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onContentChanged",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onWindowFocusChanged",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "hasWindowFocus",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "dispatchKeyEvent",
+ args = {KeyEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "dispatchTouchEvent",
+ args = {MotionEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "dispatchTrackballEvent",
+ args = {MotionEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreatePanelView",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreatePanelMenu",
+ args = {int.class, Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPreparePanel",
+ args = {int.class, View.class, Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onMenuOpened",
+ args = {int.class, Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onMenuItemSelected",
+ args = {int.class, MenuItem.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPanelClosed",
+ args = {int.class, Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateOptionsMenu",
+ args = {Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPrepareOptionsMenu",
+ args = {Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onOptionsItemSelected",
+ args = {MenuItem.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onOptionsMenuClosed",
+ args = {Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "openOptionsMenu",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "closeOptionsMenu",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateContextMenu",
+ args = {ContextMenu.class, View.class, ContextMenuInfo.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "registerForContextMenu",
+ args = {View.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "unregisterForContextMenu",
+ args = {View.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "openContextMenu",
+ args = {View.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onContextItemSelected",
+ args = {MenuItem.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onContextMenuClosed",
+ args = {Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateDialog",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPrepareDialog",
+ args = {int.class, Dialog.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "showDialog",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "dismissDialog",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "removeDialog",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onSearchRequested",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startSearch",
+ args = {String.class, boolean.class, Bundle.class, boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "takeKeyEvents",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "requestWindowFeature",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setFeatureDrawableResource",
+ args = {int.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setFeatureDrawableUri",
+ args = {int.class, Uri.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setFeatureDrawable",
+ args = {int.class, Drawable.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setFeatureDrawableAlpha",
+ args = {int.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getLayoutInflater",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getMenuInflater",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onApplyThemeResource",
+ args = {Theme.class, int.class, boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startActivityForResult",
+ args = {Intent.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startActivity",
+ args = {Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startActivityIfNeeded",
+ args = {Intent.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startNextMatchingActivity",
+ args = {Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startActivityFromChild",
+ args = {Activity.class, Intent.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setResult",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setResult",
+ args = {int.class, Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getCallingPackage",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getCallingActivity",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "isFinishing",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "finish",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "finishFromChild",
+ args = {Activity.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "finishActivity",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "finishActivityFromChild",
+ args = {Activity.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onActivityResult",
+ args = {int.class, int.class, Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "createPendingResult",
+ args = {int.class, Intent.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setRequestedOrientation",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getRequestedOrientation",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getTaskId",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "isTaskRoot",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "moveTaskToBack",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getLocalClassName",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getComponentName",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getPreferences",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getSystemService",
+ args = {String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setTitle",
+ args = {CharSequence.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setTitle",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setTitleColor",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getTitle",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getTitleColor",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onTitleChanged",
+ args = {CharSequence.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onChildTitleChanged",
+ args = {Activity.class, CharSequence.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setProgressBarVisibility",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setProgressBarIndeterminateVisibility",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setProgressBarIndeterminate",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setProgress",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setSecondaryProgress",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setVolumeControlStream",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getVolumeControlStream",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "runOnUiThread",
+ args = {Runnable.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateView",
+ args = {String.class, Context.class, AttributeSet.class}
+ )
+ })
+ public void testFinishStart() {
+ mIntent = mTopIntent;
+ runLaunchpad(LaunchpadActivity.LIFECYCLE_FINISH_START);
+ }
+
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "Activity",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onUserInteraction",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onUserLeaveHint",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setVisible",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "finalize",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "closeContextMenu",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getInstanceCount",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+
+ method = "getIntent",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setIntent",
+ args = {Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getApplication",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "isChild",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getParent",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getWindowManager",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getWindow",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getCurrentFocus",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getWallpaperDesiredMinimumWidth",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getWallpaperDesiredMinimumHeight",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreate",
+ args = {Bundle.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onRestoreInstanceState",
+ args = {Bundle.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPostCreate",
+ args = {Bundle.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onStart",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onRestart",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onResume",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPostResume",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onNewIntent",
+ args = {Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onSaveInstanceState",
+ args = {Bundle.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPause",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateThumbnail",
+ args = {Bitmap.class, Canvas.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateDescription",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onStop",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onDestroy",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onConfigurationChanged",
+ args = {Configuration.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getChangingConfigurations",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getLastNonConfigurationInstance",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onRetainNonConfigurationInstance",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onLowMemory",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "managedQuery",
+ args = {Uri.class, String[].class, String.class, String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "managedQuery",
+ args = {Uri.class, String[].class, String.class, String[].class, String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "managedCommitUpdates",
+ args = {Cursor.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startManagingCursor",
+ args = {Cursor.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "stopManagingCursor",
+ args = {Cursor.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setPersistent",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "findViewById",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setContentView",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setContentView",
+ args = {View.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setContentView",
+ args = {View.class, ViewGroup.LayoutParams.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "addContentView",
+ args = {View.class, ViewGroup.LayoutParams.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setDefaultKeyMode",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onKeyDown",
+ args = {int.class, KeyEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onKeyUp",
+ args = {int.class, KeyEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onKeyMultiple",
+ args = {int.class, int.class, KeyEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onTouchEvent",
+ args = {MotionEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onTrackballEvent",
+ args = {MotionEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onWindowAttributesChanged",
+ args = {LayoutParams.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onContentChanged",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onWindowFocusChanged",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "hasWindowFocus",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "dispatchKeyEvent",
+ args = {KeyEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "dispatchTouchEvent",
+ args = {MotionEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "dispatchTrackballEvent",
+ args = {MotionEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreatePanelView",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreatePanelMenu",
+ args = {int.class, Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPreparePanel",
+ args = {int.class, View.class, Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onMenuOpened",
+ args = {int.class, Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onMenuItemSelected",
+ args = {int.class, MenuItem.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPanelClosed",
+ args = {int.class, Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateOptionsMenu",
+ args = {Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPrepareOptionsMenu",
+ args = {Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onOptionsItemSelected",
+ args = {MenuItem.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onOptionsMenuClosed",
+ args = {Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "openOptionsMenu",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "closeOptionsMenu",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateContextMenu",
+ args = {ContextMenu.class, View.class, ContextMenuInfo.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "registerForContextMenu",
+ args = {View.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "unregisterForContextMenu",
+ args = {View.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "openContextMenu",
+ args = {View.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onContextItemSelected",
+ args = {MenuItem.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onContextMenuClosed",
+ args = {Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateDialog",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPrepareDialog",
+ args = {int.class, Dialog.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "showDialog",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "dismissDialog",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "removeDialog",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onSearchRequested",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startSearch",
+ args = {String.class, boolean.class, Bundle.class, boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "takeKeyEvents",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "requestWindowFeature",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setFeatureDrawableResource",
+ args = {int.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setFeatureDrawableUri",
+ args = {int.class, Uri.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setFeatureDrawable",
+ args = {int.class, Drawable.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setFeatureDrawableAlpha",
+ args = {int.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getLayoutInflater",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getMenuInflater",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onApplyThemeResource",
+ args = {Theme.class, int.class, boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startActivityForResult",
+ args = {Intent.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startActivity",
+ args = {Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startActivityIfNeeded",
+ args = {Intent.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startNextMatchingActivity",
+ args = {Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startActivityFromChild",
+ args = {Activity.class, Intent.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setResult",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setResult",
+ args = {int.class, Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getCallingPackage",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getCallingActivity",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "isFinishing",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "finish",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "finishFromChild",
+ args = {Activity.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "finishActivity",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "finishActivityFromChild",
+ args = {Activity.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onActivityResult",
+ args = {int.class, int.class, Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "createPendingResult",
+ args = {int.class, Intent.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setRequestedOrientation",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getRequestedOrientation",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getTaskId",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "isTaskRoot",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "moveTaskToBack",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getLocalClassName",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getComponentName",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getPreferences",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getSystemService",
+ args = {String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setTitle",
+ args = {CharSequence.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setTitle",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setTitleColor",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getTitle",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getTitleColor",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onTitleChanged",
+ args = {CharSequence.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onChildTitleChanged",
+ args = {Activity.class, CharSequence.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setProgressBarVisibility",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setProgressBarIndeterminateVisibility",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setProgressBarIndeterminate",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setProgress",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setSecondaryProgress",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setVolumeControlStream",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getVolumeControlStream",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "runOnUiThread",
+ args = {Runnable.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateView",
+ args = {String.class, Context.class, AttributeSet.class}
+ )
+ })
+ public void testTabFinishCreate() {
+ mIntent = mTabIntent;
+ runLaunchpad(LaunchpadActivity.LIFECYCLE_FINISH_CREATE);
+ }
+
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "Activity",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onUserInteraction",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onUserLeaveHint",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setVisible",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "closeContextMenu",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "finalize",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getInstanceCount",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getIntent",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setIntent",
+ args = {Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getApplication",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "isChild",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getParent",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getWindowManager",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getWindow",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getCurrentFocus",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getWallpaperDesiredMinimumWidth",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getWallpaperDesiredMinimumHeight",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreate",
+ args = {Bundle.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onRestoreInstanceState",
+ args = {Bundle.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPostCreate",
+ args = {Bundle.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onStart",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onRestart",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onResume",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPostResume",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onNewIntent",
+ args = {Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onSaveInstanceState",
+ args = {Bundle.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPause",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateThumbnail",
+ args = {Bitmap.class, Canvas.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateDescription",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onStop",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onDestroy",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onConfigurationChanged",
+ args = {Configuration.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getChangingConfigurations",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getLastNonConfigurationInstance",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onRetainNonConfigurationInstance",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onLowMemory",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "managedQuery",
+ args = {Uri.class, String[].class, String.class, String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "managedQuery",
+ args = {Uri.class, String[].class, String.class, String[].class, String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "managedCommitUpdates",
+ args = {Cursor.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startManagingCursor",
+ args = {Cursor.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "stopManagingCursor",
+ args = {Cursor.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setPersistent",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "findViewById",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setContentView",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setContentView",
+ args = {View.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setContentView",
+ args = {View.class, ViewGroup.LayoutParams.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "addContentView",
+ args = {View.class, ViewGroup.LayoutParams.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setDefaultKeyMode",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onKeyDown",
+ args = {int.class, KeyEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onKeyUp",
+ args = {int.class, KeyEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onKeyMultiple",
+ args = {int.class, int.class, KeyEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onTouchEvent",
+ args = {MotionEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onTrackballEvent",
+ args = {MotionEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onWindowAttributesChanged",
+ args = {LayoutParams.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onContentChanged",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onWindowFocusChanged",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "hasWindowFocus",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "dispatchKeyEvent",
+ args = {KeyEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "dispatchTouchEvent",
+ args = {MotionEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "dispatchTrackballEvent",
+ args = {MotionEvent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreatePanelView",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreatePanelMenu",
+ args = {int.class, Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPreparePanel",
+ args = {int.class, View.class, Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onMenuOpened",
+ args = {int.class, Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onMenuItemSelected",
+ args = {int.class, MenuItem.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPanelClosed",
+ args = {int.class, Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateOptionsMenu",
+ args = {Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPrepareOptionsMenu",
+ args = {Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onOptionsItemSelected",
+ args = {MenuItem.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onOptionsMenuClosed",
+ args = {Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "openOptionsMenu",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "closeOptionsMenu",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateContextMenu",
+ args = {ContextMenu.class, View.class, ContextMenuInfo.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "registerForContextMenu",
+ args = {View.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "unregisterForContextMenu",
+ args = {View.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "openContextMenu",
+ args = {View.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onContextItemSelected",
+ args = {MenuItem.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onContextMenuClosed",
+ args = {Menu.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateDialog",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onPrepareDialog",
+ args = {int.class, Dialog.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "showDialog",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "dismissDialog",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "removeDialog",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onSearchRequested",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startSearch",
+ args = {String.class, boolean.class, Bundle.class, boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "takeKeyEvents",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "requestWindowFeature",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setFeatureDrawableResource",
+ args = {int.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setFeatureDrawableUri",
+ args = {int.class, Uri.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setFeatureDrawable",
+ args = {int.class, Drawable.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setFeatureDrawableAlpha",
+ args = {int.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getLayoutInflater",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getMenuInflater",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onApplyThemeResource",
+ args = {Theme.class, int.class, boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startActivityForResult",
+ args = {Intent.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startActivity",
+ args = {Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startActivityIfNeeded",
+ args = {Intent.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startNextMatchingActivity",
+ args = {Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "startActivityFromChild",
+ args = {Activity.class, Intent.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setResult",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setResult",
+ args = {int.class, Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getCallingPackage",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getCallingActivity",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "isFinishing",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "finish",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "finishFromChild",
+ args = {Activity.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "finishActivity",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "finishActivityFromChild",
+ args = {Activity.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onActivityResult",
+ args = {int.class, int.class, Intent.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "createPendingResult",
+ args = {int.class, Intent.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setRequestedOrientation",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getRequestedOrientation",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getTaskId",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "isTaskRoot",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "moveTaskToBack",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getLocalClassName",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getComponentName",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getPreferences",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getSystemService",
+ args = {String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setTitle",
+ args = {CharSequence.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setTitle",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setTitleColor",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getTitle",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getTitleColor",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onTitleChanged",
+ args = {CharSequence.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onChildTitleChanged",
+ args = {Activity.class, CharSequence.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setProgressBarVisibility",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setProgressBarIndeterminateVisibility",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setProgressBarIndeterminate",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setProgress",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setSecondaryProgress",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setVolumeControlStream",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getVolumeControlStream",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "runOnUiThread",
+ args = {Runnable.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onCreateView",
+ args = {String.class, Context.class, AttributeSet.class}
+ )
+ })
+ public void testFinishCreate() {
+ mIntent = mTopIntent;
+ runLaunchpad(LaunchpadActivity.LIFECYCLE_FINISH_CREATE);
+ }
+
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "Activity",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onUserInteraction",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "onUserLeaveHint",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "setVisible",
+ args = {boolean.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
method = "closeContextMenu",
args = {}
),
diff --git a/tests/tests/bluetooth/AndroidManifest.xml b/tests/tests/bluetooth/AndroidManifest.xml
index 486460d..8345f5d 100644
--- a/tests/tests/bluetooth/AndroidManifest.xml
+++ b/tests/tests/bluetooth/AndroidManifest.xml
@@ -17,9 +17,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.cts.bluetooth">
- <uses-permission android:name="android.permission.BLUETOOTH" />
- <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
-
<application>
<uses-library android:name="android.test.runner" />
</application>
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BasicAdapterTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BasicAdapterTest.java
index a3032bb..c6be1d6 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BasicAdapterTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BasicAdapterTest.java
@@ -17,12 +17,6 @@
package android.bluetooth.cts;
import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothDevice;
-import android.bluetooth.BluetoothServerSocket;
-
-import java.io.IOException;
-import java.util.Set;
-import java.util.UUID;
import junit.framework.TestCase;
@@ -31,10 +25,6 @@
* BluetoothAdapter}.
*/
public class BasicAdapterTest extends TestCase {
- private static final int DISABLE_TIMEOUT = 5000; // ms timeout for BT disable
- private static final int ENABLE_TIMEOUT = 10000; // ms timeout for BT enable
- private static final int POLL_TIME = 100; // ms to poll BT state
-
public void test_getDefaultAdapter() {
/*
* Note: If the target doesn't support Bluetooth at all, then
@@ -102,133 +92,4 @@
assertTrue(BluetoothAdapter.checkBluetoothAddress(
"DE:F0:FE:DC:B8:76"));
}
-
- /** Checks enable(), disable(), getState(), isEnabled() */
- public void test_enableDisable() {
- BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
-
- for (int i=0; i<5; i++) {
- disable(adapter);
- enable(adapter);
- }
- }
-
- public void test_getAddress() {
- BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
- enable(adapter);
-
- assertTrue(BluetoothAdapter.checkBluetoothAddress(adapter.getAddress()));
- }
-
- public void test_getName() {
- BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
- enable(adapter);
-
- String name = adapter.getName();
- assertNotNull(name);
- }
-
- public void test_getBondedDevices() {
- BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
- enable(adapter);
-
- Set<BluetoothDevice> devices = adapter.getBondedDevices();
- assertNotNull(devices);
- for (BluetoothDevice device : devices) {
- assertTrue(BluetoothAdapter.checkBluetoothAddress(device.getAddress()));
- }
- }
-
- public void test_getRemoteDevice() {
- // getRemoteDevice() should work even with Bluetooth disabled
- BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
- disable(adapter);
-
- // test bad addresses
- try {
- adapter.getRemoteDevice(null);
- fail("IllegalArgumentException not thrown");
- } catch (IllegalArgumentException e) {}
- try {
- adapter.getRemoteDevice("00:00:00:00:00:00:00:00");
- fail("IllegalArgumentException not thrown");
- } catch (IllegalArgumentException e) {}
-
- // test success
- BluetoothDevice device = adapter.getRemoteDevice("00:11:22:AA:BB:CC");
- assertNotNull(device);
- assertEquals("00:11:22:AA:BB:CC", device.getAddress());
- }
-
- public void test_listenUsingRfcommWithServiceRecord() throws IOException {
- BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
- enable(adapter);
-
- BluetoothServerSocket socket = adapter.listenUsingRfcommWithServiceRecord(
- "test", UUID.randomUUID());
- assertNotNull(socket);
- socket.close();
- }
-
- /** Helper to turn BT off.
- * This method will either fail on an assert, or return with BT turned off.
- * Behavior of getState() and isEnabled() are validated along the way.
- */
- private void disable(BluetoothAdapter adapter) {
- if (adapter.getState() == BluetoothAdapter.STATE_OFF) {
- assertFalse(adapter.isEnabled());
- return;
- }
-
- assertEquals(BluetoothAdapter.STATE_ON, adapter.getState());
- assertTrue(adapter.isEnabled());
- adapter.disable();
- for (int i=0; i<DISABLE_TIMEOUT/POLL_TIME; i++) {
- switch (adapter.getState()) {
- case BluetoothAdapter.STATE_OFF:
- assertFalse(adapter.isEnabled());
- return;
- default:
- assertEquals(BluetoothAdapter.STATE_TURNING_OFF, adapter.getState());
- assertFalse(adapter.isEnabled());
- break;
- }
- sleep(POLL_TIME);
- }
- fail("disable() timeout");
- }
-
- /** Helper to turn BT on.
- * This method will either fail on an assert, or return with BT turned on.
- * Behavior of getState() and isEnabled() are validated along the way.
- */
- private void enable(BluetoothAdapter adapter) {
- if (adapter.getState() == BluetoothAdapter.STATE_ON) {
- assertTrue(adapter.isEnabled());
- return;
- }
-
- assertEquals(BluetoothAdapter.STATE_OFF, adapter.getState());
- assertFalse(adapter.isEnabled());
- adapter.enable();
- for (int i=0; i<ENABLE_TIMEOUT/POLL_TIME; i++) {
- switch (adapter.getState()) {
- case BluetoothAdapter.STATE_ON:
- assertTrue(adapter.isEnabled());
- return;
- default:
- assertEquals(BluetoothAdapter.STATE_TURNING_ON, adapter.getState());
- assertFalse(adapter.isEnabled());
- break;
- }
- sleep(POLL_TIME);
- }
- fail("enable() timeout");
- }
-
- private static void sleep(long t) {
- try {
- Thread.sleep(t);
- } catch (InterruptedException e) {}
- }
}
diff --git a/tests/tests/content/src/android/content/cts/ContextWrapperTest.java b/tests/tests/content/src/android/content/cts/ContextWrapperTest.java
index 265ec06..0648d32 100644
--- a/tests/tests/content/src/android/content/cts/ContextWrapperTest.java
+++ b/tests/tests/content/src/android/content/cts/ContextWrapperTest.java
@@ -1185,7 +1185,7 @@
assertNull(mContextWrapper.getSystemService("invalid"));
// Test valid service name
- assertNotNull(mContextWrapper.getSystemService(Context.WINDOW_SERVICE));
+ assertNotNull(mContextWrapper.getSystemService("window"));
}
@TestTargetNew(
diff --git a/tests/tests/content/src/android/content/res/cts/ConfigTest.java b/tests/tests/content/src/android/content/res/cts/ConfigTest.java
index 276cb35..d68fd19 100755
--- a/tests/tests/content/src/android/content/res/cts/ConfigTest.java
+++ b/tests/tests/content/src/android/content/res/cts/ConfigTest.java
@@ -43,7 +43,8 @@
ORIENTATION,
WIDTH,
HEIGHT,
- DENSITY
+ DENSITY,
+ SCREENLAYOUT
}
private static void checkValue(final Resources res, final int resId,
@@ -129,9 +130,11 @@
break;
case DENSITY:
// this is the ratio from the standard
-
mMetrics.density = (((float)value)/((float)DisplayMetrics.DENSITY_DEFAULT));
break;
+ case SCREENLAYOUT:
+ mConfig.screenLayout = value;
+ break;
default:
assert(false);
break;
@@ -303,6 +306,34 @@
checkValue(res, R.configVarying.simple, "simple square");
checkValue(res, R.configVarying.bag,
R.styleable.TestConfig, new String[]{"bag square"});
+
+ config = new TotalConfig();
+ config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_SMALL);
+ res = config.getResources();
+ checkValue(res, R.configVarying.simple, "simple small");
+ checkValue(res, R.configVarying.bag,
+ R.styleable.TestConfig, new String[]{"bag small"});
+
+ config = new TotalConfig();
+ config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_NORMAL);
+ res = config.getResources();
+ checkValue(res, R.configVarying.simple, "simple normal");
+ checkValue(res, R.configVarying.bag,
+ R.styleable.TestConfig, new String[]{"bag normal"});
+
+ config = new TotalConfig();
+ config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_LARGE);
+ res = config.getResources();
+ checkValue(res, R.configVarying.simple, "simple large");
+ checkValue(res, R.configVarying.bag,
+ R.styleable.TestConfig, new String[]{"bag large"});
+
+ config = new TotalConfig();
+ config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_XLARGE);
+ res = config.getResources();
+ checkValue(res, R.configVarying.simple, "simple xlarge");
+ checkValue(res, R.configVarying.bag,
+ R.styleable.TestConfig, new String[]{"bag xlarge"});
}
@MediumTest
@@ -378,6 +409,47 @@
R.styleable.TestConfig, new String[]{"bag 240dpi"});
}
+ @MediumTest
+ public void testScreenSize() throws Exception {
+ // ensure that we fall back to the best available screen size
+ // for a given configuration.
+ TotalConfig config = new TotalConfig();
+ config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_SMALL);
+ Resources res = config.getResources();
+ checkValue(res, R.configVarying.simple, "simple small");
+ checkValue(res, R.configVarying.small, "small");
+ checkValue(res, R.configVarying.normal, "default");
+ checkValue(res, R.configVarying.large, "default");
+ checkValue(res, R.configVarying.xlarge, "default");
+
+ config = new TotalConfig();
+ config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_NORMAL);
+ res = config.getResources();
+ checkValue(res, R.configVarying.simple, "simple normal");
+ checkValue(res, R.configVarying.small, "default");
+ checkValue(res, R.configVarying.normal, "normal");
+ checkValue(res, R.configVarying.large, "default");
+ checkValue(res, R.configVarying.xlarge, "default");
+
+ config = new TotalConfig();
+ config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_LARGE);
+ res = config.getResources();
+ checkValue(res, R.configVarying.simple, "simple large");
+ checkValue(res, R.configVarying.small, "default");
+ checkValue(res, R.configVarying.normal, "normal");
+ checkValue(res, R.configVarying.large, "large");
+ checkValue(res, R.configVarying.xlarge, "default");
+
+ config = new TotalConfig();
+ config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_XLARGE);
+ res = config.getResources();
+ checkValue(res, R.configVarying.simple, "simple xlarge");
+ checkValue(res, R.configVarying.small, "default");
+ checkValue(res, R.configVarying.normal, "normal");
+ checkValue(res, R.configVarying.large, "large");
+ checkValue(res, R.configVarying.xlarge, "xlarge");
+ }
+
// TODO - add tests for special cases - ie, other key params seem ignored if
// nokeys is set
@@ -421,7 +493,8 @@
*/
/**
- * Precidence order: mcc, mnc, locale, orientation, density,
+ * Precidence order: mcc, mnc, locale, screenlayout-size,
+ * screenlayout-long, orientation, density,
* touchscreen, hidden, keyboard, navigation, width-height
*/
diff --git a/tests/tests/content/src/android/content/res/cts/ConfigurationTest.java b/tests/tests/content/src/android/content/res/cts/ConfigurationTest.java
index 01620b5..153097a 100644
--- a/tests/tests/content/src/android/content/res/cts/ConfigurationTest.java
+++ b/tests/tests/content/src/android/content/res/cts/ConfigurationTest.java
@@ -352,53 +352,29 @@
args = {android.os.Parcel.class, int.class}
)
public void testWriteToParcel() {
- assertWriteToParcel(createConfig(null), Parcel.obtain());
- assertWriteToParcel(createConfig(Locale.JAPAN), Parcel.obtain());
- }
+ final Parcel parcel = Parcel.obtain();
+ mConfigDefault.writeToParcel(parcel, 0);
- private Configuration createConfig(Locale locale) {
- Configuration config = new Configuration();
- config.fontScale = 13.37f;
- config.mcc = 0;
- config.mnc = 1;
- config.locale = locale;
- config.touchscreen = Configuration.TOUCHSCREEN_STYLUS;
- config.keyboard = Configuration.KEYBOARD_UNDEFINED;
- config.keyboardHidden = Configuration.KEYBOARDHIDDEN_YES;
- config.hardKeyboardHidden = Configuration.KEYBOARDHIDDEN_UNDEFINED;
- config.navigation = Configuration.NAVIGATION_DPAD;
- config.navigationHidden = Configuration.NAVIGATIONHIDDEN_UNDEFINED;
- config.orientation = Configuration.ORIENTATION_PORTRAIT;
- config.screenLayout = Configuration.SCREENLAYOUT_LONG_UNDEFINED;
- return config;
- }
-
- private void assertWriteToParcel(Configuration config, Parcel parcel) {
- config.writeToParcel(parcel, 0);
parcel.setDataPosition(0);
- assertEquals(config.fontScale, parcel.readFloat());
- assertEquals(config.mcc, parcel.readInt());
- assertEquals(config.mnc, parcel.readInt());
- if (config.locale == null) {
+ assertEquals(mConfigDefault.fontScale, parcel.readFloat());
+ assertEquals(mConfigDefault.mcc, parcel.readInt());
+ assertEquals(mConfigDefault.mnc, parcel.readInt());
+ if (mConfigDefault.locale == null) {
assertEquals(0, parcel.readInt());
} else {
assertEquals(1, parcel.readInt());
- assertEquals(config.locale.getLanguage(),
+ assertEquals(mConfigDefault.locale.getLanguage(),
parcel.readString());
- assertEquals(config.locale.getCountry(),
+ assertEquals(mConfigDefault.locale.getCountry(),
parcel.readString());
- assertEquals(config.locale.getVariant(),
+ assertEquals(mConfigDefault.locale.getVariant(),
parcel.readString());
}
- parcel.readInt();
- assertEquals(config.touchscreen, parcel.readInt());
- assertEquals(config.keyboard, parcel.readInt());
- assertEquals(config.keyboardHidden, parcel.readInt());
- assertEquals(config.hardKeyboardHidden, parcel.readInt());
- assertEquals(config.navigation, parcel.readInt());
- assertEquals(config.navigationHidden, parcel.readInt());
- assertEquals(config.orientation, parcel.readInt());
- assertEquals(config.screenLayout, parcel.readInt());
+ assertEquals(mConfigDefault.touchscreen, parcel.readInt());
+ assertEquals(mConfigDefault.keyboard, parcel.readInt());
+ assertEquals(mConfigDefault.keyboardHidden, parcel.readInt());
+ assertEquals(mConfigDefault.navigation, parcel.readInt());
+ assertEquals(mConfigDefault.orientation, parcel.readInt());
}
}
diff --git a/tests/tests/database/src/android/database/cts/AbstractCursorTest.java b/tests/tests/database/src/android/database/cts/AbstractCursorTest.java
index 47c52ba..2927a13 100644
--- a/tests/tests/database/src/android/database/cts/AbstractCursorTest.java
+++ b/tests/tests/database/src/android/database/cts/AbstractCursorTest.java
@@ -73,9 +73,7 @@
mDatabaseCursor.close();
mTestAbstractCursor.close();
mDatabase.close();
- if (mDatabaseFile.exists()) {
- mDatabaseFile.delete();
- }
+ mDatabaseFile.delete();
super.tearDown();
}
diff --git a/tests/tests/database/src/android/database/cts/CursorWrapperTest.java b/tests/tests/database/src/android/database/cts/CursorWrapperTest.java
index dba9784..1373db8 100644
--- a/tests/tests/database/src/android/database/cts/CursorWrapperTest.java
+++ b/tests/tests/database/src/android/database/cts/CursorWrapperTest.java
@@ -16,10 +16,8 @@
package android.database.cts;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
+import java.io.File;
+import java.util.Arrays;
import android.content.ContentResolver;
import android.content.Context;
@@ -35,12 +33,13 @@
import android.os.Bundle;
import android.os.Handler;
import android.test.AndroidTestCase;
-
-import java.io.File;
-import java.util.Arrays;
+import dalvik.annotation.TestTargets;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
@TestTargetClass(android.database.CursorWrapper.class)
-public class CursorWrapperTest extends AndroidTestCase {
+public class CursorWrapperTest extends DatabaseCursorTest {
private static final String FIRST_NUMBER = "123";
private static final String SECOND_NUMBER = "5555";
@@ -62,6 +61,7 @@
@Override
protected void setUp() throws Exception {
super.setUp();
+ setupTestType(TYPE_CURSORWRAPPER);
setupDatabase();
}
@@ -510,12 +510,12 @@
final String STRING_TEXT2 = "Test String2";
final double NUMBER_DOUBLE = Double.MAX_VALUE;
final double NUMBER_FLOAT = (float) NUMBER_DOUBLE;
- final long NUMBER_LONG_INTEGER = 0xaabbccddffL;
+ final long NUMBER_LONG_INTEGER = (long) 0xaabbccddffL;
final long NUMBER_INTEGER = (int) NUMBER_LONG_INTEGER;
final long NUMBER_SHORT = (short) NUMBER_INTEGER;
- assertTrue(NUMBER_DOUBLE != NUMBER_FLOAT);
- assertTrue(NUMBER_LONG_INTEGER != NUMBER_INTEGER);
+ assertTrue(NUMBER_DOUBLE != (double) NUMBER_FLOAT);
+ assertTrue(NUMBER_LONG_INTEGER != (long) NUMBER_INTEGER);
assertTrue(NUMBER_LONG_INTEGER != (short) NUMBER_SHORT);
assertTrue(NUMBER_INTEGER != (int) NUMBER_SHORT);
diff --git a/tests/tests/database/src/android/database/sqlite/cts/SQLiteDatabaseTest.java b/tests/tests/database/src/android/database/sqlite/cts/SQLiteDatabaseTest.java
index 7a18cd8..49df6b2 100644
--- a/tests/tests/database/src/android/database/sqlite/cts/SQLiteDatabaseTest.java
+++ b/tests/tests/database/src/android/database/sqlite/cts/SQLiteDatabaseTest.java
@@ -463,26 +463,17 @@
})
@ToBeFixed(bug = "1676383", explanation = "setPageSize does not work as javadoc declares.")
public void testAccessPageSize() {
- File databaseFile = new File(mDatabaseDir, "database.db");
- if (databaseFile.exists()) {
- databaseFile.delete();
+ mDatabaseFile = new File(mDatabaseDir, "database.db");
+ if (mDatabaseFile.exists()) {
+ mDatabaseFile.delete();
}
- SQLiteDatabase database = null;
- try {
- database = SQLiteDatabase.openOrCreateDatabase(databaseFile.getPath(), null);
+ mDatabase = SQLiteDatabase.openOrCreateDatabase(mDatabaseFile.getPath(), null);
- long initialValue = database.getPageSize();
- // check that this does not throw an exception
- // setting a different page size may not be supported after the DB has been created
- database.setPageSize(initialValue);
- assertEquals(initialValue, database.getPageSize());
-
- } finally {
- if (database != null) {
- database.close();
- databaseFile.delete();
- }
- }
+ long initialValue = mDatabase.getPageSize();
+ // check that this does not throw an exception
+ // setting a different page size may not be supported after the DB has been created
+ mDatabase.setPageSize(initialValue);
+ assertEquals(initialValue, mDatabase.getPageSize());
}
@TestTargetNew(
@@ -870,16 +861,9 @@
public void testIsReadOnly() {
assertFalse(mDatabase.isReadOnly());
- SQLiteDatabase database = null;
- try {
- database = SQLiteDatabase.openDatabase(mDatabaseFilePath, null,
- SQLiteDatabase.OPEN_READONLY);
- assertTrue(database.isReadOnly());
- } finally {
- if (database != null) {
- database.close();
- }
- }
+ mDatabase = SQLiteDatabase.openDatabase(mDatabaseFilePath, null,
+ SQLiteDatabase.OPEN_READONLY);
+ assertTrue(mDatabase.isReadOnly());
}
@TestTargetNew(
diff --git a/tests/tests/graphics/src/android/graphics/cts/MovieTest.java b/tests/tests/graphics/src/android/graphics/cts/MovieTest.java
index accb08f..ab875bb 100644
--- a/tests/tests/graphics/src/android/graphics/cts/MovieTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/MovieTest.java
@@ -29,12 +29,12 @@
import android.graphics.Movie;
import android.graphics.Paint;
import android.test.ActivityInstrumentationTestCase2;
-import android.widget.cts.WidgetTestUtils;
-
+import dalvik.annotation.BrokenTest;
import dalvik.annotation.TestTargets;
import dalvik.annotation.TestLevel;
import dalvik.annotation.TestTargetNew;
import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.ToBeFixed;
@TestTargetClass(Movie.class)
public class MovieTest extends ActivityInstrumentationTestCase2<MockActivity> {
@@ -54,9 +54,11 @@
@TestTargetNew(
level = TestLevel.COMPLETE,
method = "draw",
- args = {android.graphics.Canvas.class, float.class, float.class,
+ args = {android.graphics.Canvas.class, float.class, float.class,
android.graphics.Paint.class}
)
+ @ToBeFixed(bug = "1790416", explanation = "mMovie shouldn't be null")
+ @BrokenTest("mMovie is null")
public void testDraw1() {
Canvas c = new Canvas();
Paint p = new Paint();
@@ -68,6 +70,8 @@
method = "draw",
args = {android.graphics.Canvas.class, float.class, float.class}
)
+ @ToBeFixed(bug = "1790416", explanation = "mMovie shouldn't be null")
+ @BrokenTest("mMovie is null")
public void testDraw2() {
Canvas c = new Canvas();
mMovie.draw(c, 100, 200);
@@ -78,6 +82,8 @@
method = "decodeFile",
args = {java.lang.String.class}
)
+ @ToBeFixed(bug = "1790416", explanation = "mMovie shouldn't be null")
+ @BrokenTest("mMovie is null")
public void testDecodeFile() throws Exception {
mMovie = null;
File dbDir = getInstrumentation().getTargetContext().getDir("tests",
@@ -137,6 +143,8 @@
method = "decodeByteArray",
args = {byte[].class, int.class, int.class}
)
+ @ToBeFixed(bug="1491795", explanation="always return null")
+ @BrokenTest("mMovie is null")
public void testDecodeByteArray() throws Exception {
mMovie = null;
InputStream is = getActivity().getResources().openRawResource(MOVIE);
@@ -152,6 +160,8 @@
method = "decodeStream",
args = {java.io.InputStream.class}
)
+ @ToBeFixed(bug = "1790416", explanation = "mMovie shouldn't be null")
+ @BrokenTest("mMovie is null")
public void testDecodeStream() {
assertFalse(mMovie.isOpaque());
mMovie = null;
@@ -172,6 +182,8 @@
method = "setTime",
args = {int.class}
)
+ @ToBeFixed(bug = "1790416", explanation = "mMovie shouldn't be null")
+ @BrokenTest("mMovie is null")
public void testSetTime() {
assertTrue(mMovie.setTime(1000));
assertFalse(mMovie.setTime(Integer.MAX_VALUE));
@@ -201,17 +213,16 @@
args = {}
)
})
+ @ToBeFixed(bug = "1790416", explanation = "mMovie shouldn't be null")
+ @BrokenTest("mMovie is null")
public void testGetMovieProperties() {
assertEquals(1000, mMovie.duration());
assertFalse(mMovie.isOpaque());
-
- int expectedHeight = getActivity().getResources().getDrawable(MOVIE).getIntrinsicHeight();
- int scaledHeight = WidgetTestUtils.convertDipToPixels(getActivity(), mMovie.height());
- assertEquals(expectedHeight, scaledHeight);
-
- int expectedWidth = getActivity().getResources().getDrawable(MOVIE).getIntrinsicWidth();
- int scaledWidth = WidgetTestUtils.convertDipToPixels(getActivity(), mMovie.width());
- assertEquals(expectedWidth, scaledWidth);
-
+ int expectedHeight = getActivity().getResources().getDrawable(MOVIE)
+ .getIntrinsicHeight();
+ assertEquals(expectedHeight, mMovie.height());
+ int expectedWidth = getActivity().getResources().getDrawable(MOVIE)
+ .getIntrinsicWidth();
+ assertEquals(expectedWidth, mMovie.width());
}
}
\ No newline at end of file
diff --git a/tests/tests/graphics/src/android/graphics/cts/NinePatchTest.java b/tests/tests/graphics/src/android/graphics/cts/NinePatchTest.java
index d69dd4f..041de94 100644
--- a/tests/tests/graphics/src/android/graphics/cts/NinePatchTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/NinePatchTest.java
@@ -34,7 +34,6 @@
import android.graphics.RectF;
import android.graphics.Region;
import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.Suppress;
@TestTargetClass(NinePatch.class)
public class NinePatchTest extends AndroidTestCase {
@@ -174,7 +173,6 @@
method = "hasAlpha",
args = {}
)
- @Suppress // Suppressed for current release
public void testHasAlpha() {
assertFalse(mNinePatch.hasAlpha());
assertEquals(mNinePatch.hasAlpha(), mBitmap.hasAlpha());
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/NinePatchDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/NinePatchDrawableTest.java
index 064c45a..608d931 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/NinePatchDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/NinePatchDrawableTest.java
@@ -76,6 +76,9 @@
args = {android.graphics.NinePatch.class}
)
})
+ @ToBeFixed(bug = "1417734", explanation = "should add @throws clause into javadoc of "
+ + "NinePatchDrawable#NinePatchDrawable(Bitmap, byte[], Rect, String) "
+ + "when param bitmap, chunk, padding or srcName is null")
@SuppressWarnings("deprecation")
public void testConstructors() {
byte[] chunk = new byte[MIN_CHUNK_SIZE];
@@ -88,7 +91,41 @@
new NinePatchDrawable(bmp, chunk, r, name);
- new NinePatchDrawable(new NinePatch(bmp, chunk, name));
+ try {
+ new NinePatchDrawable(null, chunk, r, name);
+ fail("The constructor should check whether the bitmap is null.");
+ } catch (NullPointerException e) {
+ }
+
+ // These codes will crash the test cases though the exceptions are caught.
+ // try {
+ // new NinePatchDrawable(bmp, null, r, name);
+ // fail("The constructor should check whether the chunk is null.");
+ // } catch (Exception e) {
+ // }
+
+ try {
+ mNinePatchDrawable = new NinePatchDrawable(bmp, chunk, null, name);
+ fail("The constructor should not accept null padding.");
+ } catch (NullPointerException e) {
+ }
+
+ try {
+ new NinePatchDrawable(bmp, chunk, r, null);
+ } catch (NullPointerException e) {
+ fail("The constructor should accept null srcname.");
+ }
+
+ // Known Failure - should not throw NPE bug 2136234
+ // still test for this so test can be adjusted once framework fixed
+ try {
+ new NinePatchDrawable(new NinePatch(bmp, chunk, name));
+ } catch (NullPointerException e) {
+ // expected
+ }
+
+ // constructor should accept a null NinePatch
+ mNinePatchDrawable = new NinePatchDrawable(null);
chunk = new byte[MIN_CHUNK_SIZE - 1];
chunk[MIN_CHUNK_SIZE - 2] = 1;
diff --git a/tests/tests/graphics/src/android/opengl/cts/GLSurfaceViewTest.java b/tests/tests/graphics/src/android/opengl/cts/GLSurfaceViewTest.java
deleted file mode 100644
index 4f55f96..0000000
--- a/tests/tests/graphics/src/android/opengl/cts/GLSurfaceViewTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) 2010 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.opengl.cts;
-
-import android.opengl.GLSurfaceView;
-import android.test.ActivityInstrumentationTestCase2;
-import android.test.UiThreadTest;
-import android.util.Log;
-
-import dalvik.annotation.TestTargetClass;
-
-/**
- * Tests for the GLSurfaceView class.
- */
-@TestTargetClass(GLSurfaceView.class)
-public class GLSurfaceViewTest extends
- ActivityInstrumentationTestCase2<GLSurfaceViewStubActivity> {
-
- private static final int NUM_PAUSE_RESUME_ITERATIONS_WITHOUT_DELAY = 1000;
-
- private static final int NUM_PAUSE_RESUME_ITERATIONS_WITH_DELAY = 100;
-
- private static final int PAUSE_RESUME_DELAY = 10;
-
- private static final boolean LOG_PAUSE_RESUME = false;
-
- private static final String TAG = "GLSurfaceViewTest";
-
- private GLSurfaceViewStubActivity mActivity;
-
- public GLSurfaceViewTest() {
- super("com.android.cts.stub", GLSurfaceViewStubActivity.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mActivity = getActivity();
- }
-
- /**
- * Test repeated pausing and resuming of a GLSurfaceView with a delay
- * between iterations.
- * <p>
- * This test simply verifies that the system is able to perform multiple
- * pause/resume sequences without crashing. The delay is used to allow
- * asynchronous events to occur in between the pause and resume operations.
- * </p>
- *
- * @throws InterruptedException
- */
- @UiThreadTest
- public void testPauseResumeWithDelay() throws InterruptedException {
- GLSurfaceView view = mActivity.getView();
- for (int i = 0; i < NUM_PAUSE_RESUME_ITERATIONS_WITH_DELAY; i++) {
- Thread.sleep(PAUSE_RESUME_DELAY);
- if (LOG_PAUSE_RESUME) {
- Log.w(TAG, "Pause/Resume (w/ delay) step " + i + " - pause");
- }
- view.onPause();
- Thread.sleep(PAUSE_RESUME_DELAY);
- if (LOG_PAUSE_RESUME) {
- Log.w(TAG, "Pause/Resume (w/ delay) step " + i + " - resume");
- }
- view.onResume();
- }
- }
-
- /**
- * Test repeated pausing and resuming of a GLSurfaceView.
- * <p>
- * This test simply verifies that the system is able to perform multiple
- * pause/resume sequences without crashing. No delay is used so that a
- * larger number of iterations can be done in a short amount of time.
- * </p>
- */
- @UiThreadTest
- public void testPauseResumeWithoutDelay() {
- GLSurfaceView view = mActivity.getView();
- for (int i = 0; i < NUM_PAUSE_RESUME_ITERATIONS_WITHOUT_DELAY; i++) {
- if (LOG_PAUSE_RESUME) {
- Log.w(TAG, "Pause/Resume (no delay) step " + i + " - pause");
- }
- view.onPause();
- if (LOG_PAUSE_RESUME) {
- Log.w(TAG, "Pause/Resume (no delay) step " + i + " - resume");
- }
- view.onResume();
- }
- }
-}
diff --git a/tests/tests/hardware/src/android/hardware/cts/CameraTest.java b/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
index ba298c2..dd86466 100644
--- a/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
+++ b/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
@@ -16,7 +16,6 @@
package android.hardware.cts;
-import dalvik.annotation.BrokenTest;
import dalvik.annotation.TestLevel;
import dalvik.annotation.TestTargetClass;
import dalvik.annotation.TestTargetNew;
@@ -26,10 +25,10 @@
import android.graphics.BitmapFactory;
import android.graphics.ImageFormat;
import android.hardware.Camera;
+import android.hardware.Camera.CameraInfo;
import android.hardware.Camera.ErrorCallback;
import android.hardware.Camera.Parameters;
import android.hardware.Camera.PictureCallback;
-import android.hardware.Camera.PreviewCallback;
import android.hardware.Camera.ShutterCallback;
import android.hardware.Camera.Size;
import android.media.ExifInterface;
@@ -62,7 +61,7 @@
"/test.jpg";
private byte[] mJpegData;
- private boolean mRawPreviewCallbackResult = false;
+ private boolean mPreviewCallbackResult = false;
private boolean mShutterCallbackResult = false;
private boolean mRawPictureCallbackResult = false;
private boolean mJpegPictureCallbackResult = false;
@@ -73,7 +72,7 @@
private static final int WAIT_FOR_FOCUS_TO_COMPLETE = 3000;
private static final int WAIT_FOR_SNAPSHOT_TO_COMPLETE = 5000;
- private RawPreviewCallback mRawPreviewCallback = new RawPreviewCallback();
+ private PreviewCallback mPreviewCallback = new PreviewCallback();
private TestShutterCallback mShutterCallback = new TestShutterCallback();
private RawPictureCallback mRawPictureCallback = new RawPictureCallback();
private JpegPictureCallback mJpegPictureCallback = new JpegPictureCallback();
@@ -154,18 +153,13 @@
}
//Implement the previewCallback
- private final class RawPreviewCallback implements PreviewCallback {
- public void onPreviewFrame(byte [] rawData, Camera camera) {
- if (LOGV) Log.v(TAG, "Preview callback start");
- int rawDataLength = 0;
- if (rawData != null) {
- rawDataLength = rawData.length;
- }
- if (rawDataLength > 0) {
- mRawPreviewCallbackResult = true;
- } else {
- mRawPreviewCallbackResult = false;
- }
+ private final class PreviewCallback
+ implements android.hardware.Camera.PreviewCallback {
+ public void onPreviewFrame(byte [] data, Camera camera) {
+ assertNotNull(data);
+ Size size = camera.getParameters().getPreviewSize();
+ assertEquals(size.width * size.height * 3 / 2, data.length);
+ mPreviewCallbackResult = true;
mCamera.stopPreview();
if (LOGV) Log.v(TAG, "notify the preview callback");
mPreviewDone.open();
@@ -266,10 +260,7 @@
}
private void checkPreviewCallback() throws Exception {
- SurfaceHolder mSurfaceHolder;
-
- mSurfaceHolder = CameraStubActivity.mSurfaceView.getHolder();
- mCamera.setPreviewDisplay(mSurfaceHolder);
+ mCamera.setPreviewDisplay(getActivity().getSurfaceView().getHolder());
if (LOGV) Log.v(TAG, "check preview callback");
mCamera.startPreview();
waitForPreviewDone();
@@ -318,9 +309,7 @@
public void testTakePicture() throws Exception {
initializeMessageLooper();
Size pictureSize = mCamera.getParameters().getPictureSize();
- SurfaceHolder mSurfaceHolder;
- mSurfaceHolder = CameraStubActivity.mSurfaceView.getHolder();
- mCamera.setPreviewDisplay(mSurfaceHolder);
+ mCamera.setPreviewDisplay(getActivity().getSurfaceView().getHolder());
mCamera.startPreview();
mCamera.autoFocus(mAutoFocusCallback);
assertTrue(waitForFocusDone());
@@ -330,16 +319,12 @@
terminateMessageLooper();
assertTrue(mShutterCallbackResult);
assertTrue(mJpegPictureCallbackResult);
- assertTrue(mJpegData != null);
+ assertNotNull(mJpegData);
Bitmap b = BitmapFactory.decodeByteArray(mJpegData, 0, mJpegData.length);
- assertEquals(b.getWidth(), pictureSize.width);
- assertEquals(b.getHeight(), pictureSize.height);
+ assertEquals(pictureSize.width, b.getWidth());
+ assertEquals(pictureSize.height, b.getHeight());
}
- /*
- * Test case 2: Set the preview and
- * verify the RawPreviewCallback is called
- */
@TestTargets({
@TestTargetNew(
level = TestLevel.COMPLETE,
@@ -378,13 +363,34 @@
)
})
@UiThreadTest
- public void testCheckPreview() throws Exception {
+ public void testPreviewCallback() throws Exception {
initializeMessageLooper();
- mCamera.setPreviewCallback(mRawPreviewCallback);
+ mCamera.setPreviewCallback(mPreviewCallback);
mCamera.setErrorCallback(mErrorCallback);
checkPreviewCallback();
terminateMessageLooper();
- assertTrue(mRawPreviewCallbackResult);
+ assertTrue(mPreviewCallbackResult);
+
+ mPreviewCallbackResult = false;
+ initializeMessageLooper();
+ checkPreviewCallback();
+ terminateMessageLooper();
+ assertFalse(mPreviewCallbackResult);
+
+ // Test all preview sizes.
+ initializeMessageLooper();
+ Parameters parameters = mCamera.getParameters();
+ for (Size size: parameters.getSupportedPreviewSizes()) {
+ mPreviewCallbackResult = false;
+ mCamera.setPreviewCallback(mPreviewCallback);
+ parameters.setPreviewSize(size.width, size.height);
+ mCamera.setParameters(parameters);
+ mCamera.startPreview();
+ waitForPreviewDone();
+ assertTrue(mPreviewCallbackResult);
+ mCamera.stopPreview();
+ }
+ terminateMessageLooper();
}
@TestTargetNew(
@@ -395,16 +401,16 @@
@UiThreadTest
public void testSetOneShotPreviewCallback() throws Exception {
initializeMessageLooper();
- mCamera.setOneShotPreviewCallback(mRawPreviewCallback);
+ mCamera.setOneShotPreviewCallback(mPreviewCallback);
checkPreviewCallback();
terminateMessageLooper();
- assertTrue(mRawPreviewCallbackResult);
+ assertTrue(mPreviewCallbackResult);
- mRawPreviewCallbackResult = false;
+ mPreviewCallbackResult = false;
initializeMessageLooper();
checkPreviewCallback();
terminateMessageLooper();
- assertFalse(mRawPreviewCallbackResult);
+ assertFalse(mPreviewCallbackResult);
}
@TestTargetNew(
@@ -414,38 +420,37 @@
)
@UiThreadTest
public void testSetPreviewDisplay() throws Exception {
- SurfaceHolder mSurfaceHolder;
- mSurfaceHolder = CameraStubActivity.mSurfaceView.getHolder();
+ SurfaceHolder holder = getActivity().getSurfaceView().getHolder();
initializeMessageLooper();
// Check the order: startPreview->setPreviewDisplay.
- mCamera.setOneShotPreviewCallback(mRawPreviewCallback);
+ mCamera.setOneShotPreviewCallback(mPreviewCallback);
mCamera.startPreview();
- mCamera.setPreviewDisplay(mSurfaceHolder);
+ mCamera.setPreviewDisplay(holder);
waitForPreviewDone();
terminateMessageLooper();
- assertTrue(mRawPreviewCallbackResult);
+ assertTrue(mPreviewCallbackResult);
// Check the order: setPreviewDisplay->startPreview.
initializeMessageLooper();
- mRawPreviewCallbackResult = false;
- mCamera.setOneShotPreviewCallback(mRawPreviewCallback);
- mCamera.setPreviewDisplay(mSurfaceHolder);
+ mPreviewCallbackResult = false;
+ mCamera.setOneShotPreviewCallback(mPreviewCallback);
+ mCamera.setPreviewDisplay(holder);
mCamera.startPreview();
waitForPreviewDone();
mCamera.stopPreview();
- assertTrue(mRawPreviewCallbackResult);
+ assertTrue(mPreviewCallbackResult);
// Check the order: setting preview display to null->startPreview->
// setPreviewDisplay.
- mRawPreviewCallbackResult = false;
- mCamera.setOneShotPreviewCallback(mRawPreviewCallback);
+ mPreviewCallbackResult = false;
+ mCamera.setOneShotPreviewCallback(mPreviewCallback);
mCamera.setPreviewDisplay(null);
mCamera.startPreview();
- mCamera.setPreviewDisplay(mSurfaceHolder);
+ mCamera.setPreviewDisplay(holder);
waitForPreviewDone();
terminateMessageLooper();
- assertTrue(mRawPreviewCallbackResult);
+ assertTrue(mPreviewCallbackResult);
}
@TestTargetNew(
@@ -472,9 +477,7 @@
}
// Start preview.
- SurfaceHolder mSurfaceHolder;
- mSurfaceHolder = CameraStubActivity.mSurfaceView.getHolder();
- mCamera.setPreviewDisplay(mSurfaceHolder);
+ mCamera.setPreviewDisplay(getActivity().getSurfaceView().getHolder());
mCamera.startPreview();
// Check setting orientation during preview is not allowed.
@@ -532,10 +535,10 @@
assertTrue(origPreviewFrameRate > 0);
// The default preview format must be yuv420 (NV21).
- assertTrue(origPreviewFormat == ImageFormat.NV21);
+ assertEquals(ImageFormat.NV21, origPreviewFormat);
// The default picture format must be Jpeg.
- assertTrue(origPictureFormat == ImageFormat.JPEG);
+ assertEquals(ImageFormat.JPEG, origPictureFormat);
// If camera supports flash, the default flash mode must be off.
String flashMode = parameters.getFlashMode();
@@ -558,7 +561,7 @@
assertTrue(pictureFormats != null && pictureFormats.size() != 0);
assertTrue(frameRates != null && frameRates.size() != 0);
assertTrue(focusModes != null && focusModes.size() != 0);
- assertTrue(focusMode != null);
+ assertNotNull(focusMode);
assertTrue(focalLength > 0);
assertTrue(horizontalViewAngle > 0 && horizontalViewAngle <= 360);
assertTrue(verticalViewAngle > 0 && verticalViewAngle <= 360);
@@ -568,34 +571,34 @@
// If a parameter is supported, both getXXX and getSupportedXXX have to
// be non null.
if (parameters.getWhiteBalance() != null) {
- assertTrue(parameters.getSupportedWhiteBalance() != null);
+ assertNotNull(parameters.getSupportedWhiteBalance());
}
if (parameters.getSupportedWhiteBalance() != null) {
- assertTrue(parameters.getWhiteBalance() != null);
+ assertNotNull(parameters.getWhiteBalance());
}
if (parameters.getColorEffect() != null) {
- assertTrue(parameters.getSupportedColorEffects() != null);
+ assertNotNull(parameters.getSupportedColorEffects());
}
if (parameters.getSupportedColorEffects() != null) {
- assertTrue(parameters.getColorEffect() != null);
+ assertNotNull(parameters.getColorEffect());
}
if (parameters.getAntibanding() != null) {
- assertTrue(parameters.getSupportedAntibanding() != null);
+ assertNotNull(parameters.getSupportedAntibanding());
}
if (parameters.getSupportedAntibanding() != null) {
- assertTrue(parameters.getAntibanding() != null);
+ assertNotNull(parameters.getAntibanding());
}
if (parameters.getSceneMode() != null) {
- assertTrue(parameters.getSupportedSceneModes() != null);
+ assertNotNull(parameters.getSupportedSceneModes());
}
if (parameters.getSupportedSceneModes() != null) {
- assertTrue(parameters.getSceneMode() != null);
+ assertNotNull(parameters.getSceneMode());
}
if (parameters.getFlashMode() != null) {
- assertTrue(parameters.getSupportedFlashModes() != null);
+ assertNotNull(parameters.getSupportedFlashModes());
}
if (parameters.getSupportedFlashModes() != null) {
- assertTrue(parameters.getFlashMode() != null);
+ assertNotNull(parameters.getFlashMode());
}
// Set the parameters.
@@ -617,11 +620,11 @@
// camera may not accept exact parameters, but values must be in valid range
assertTrue(isValidPixelFormat(paramActual.getPictureFormat()));
- assertEquals(paramActual.getPictureSize().width, pictureSize.width);
- assertEquals(paramActual.getPictureSize().height, pictureSize.height);
+ assertEquals(pictureSize.width, paramActual.getPictureSize().width);
+ assertEquals(pictureSize.height, paramActual.getPictureSize().height);
assertTrue(isValidPixelFormat(paramActual.getPreviewFormat()));
- assertEquals(paramActual.getPreviewSize().width, previewSize.width);
- assertEquals(paramActual.getPreviewSize().height, previewSize.height);
+ assertEquals(previewSize.width, paramActual.getPreviewSize().width);
+ assertEquals(previewSize.height, paramActual.getPreviewSize().height);
assertTrue(paramActual.getPreviewFrameRate() > 0);
checkExposureCompensation(parameters);
@@ -676,9 +679,7 @@
assertTrue(sizes.contains(mCamera.new Size(0, 0)));
// Test if the thumbnail size matches the setting.
- SurfaceHolder mSurfaceHolder;
- mSurfaceHolder = CameraStubActivity.mSurfaceView.getHolder();
- mCamera.setPreviewDisplay(mSurfaceHolder);
+ mCamera.setPreviewDisplay(getActivity().getSurfaceView().getHolder());
mCamera.startPreview();
mCamera.takePicture(mShutterCallback, mRawPictureCallback, mJpegPictureCallback);
waitForSnapshotDone();
@@ -687,8 +688,8 @@
assertTrue(exif.hasThumbnail());
byte[] thumb = exif.getThumbnail();
Bitmap b = BitmapFactory.decodeByteArray(thumb, 0, thumb.length);
- assertEquals(b.getWidth(), size.width);
- assertEquals(b.getHeight(), size.height);
+ assertEquals(size.width, b.getWidth());
+ assertEquals(size.height, b.getHeight());
// Test no thumbnail case.
p.setJpegThumbnailSize(0, 0);
@@ -696,9 +697,9 @@
mCamera.startPreview();
mCamera.takePicture(mShutterCallback, mRawPictureCallback, mJpegPictureCallback);
waitForSnapshotDone();
- assertEquals(mJpegPictureCallbackResult, true);
+ assertTrue(mJpegPictureCallbackResult);
exif = new ExifInterface(JPEG_PATH);
- assertTrue(!exif.hasThumbnail());
+ assertFalse(exif.hasThumbnail());
terminateMessageLooper();
}
@@ -707,26 +708,18 @@
public void testJpegExif() throws Exception {
initializeMessageLooper();
Camera.Parameters parameters = mCamera.getParameters();
- SurfaceHolder mSurfaceHolder;
- mSurfaceHolder = CameraStubActivity.mSurfaceView.getHolder();
- mCamera.setPreviewDisplay(mSurfaceHolder);
+ mCamera.setPreviewDisplay(getActivity().getSurfaceView().getHolder());
mCamera.startPreview();
double focalLength = (double)parameters.getFocalLength();
mCamera.takePicture(mShutterCallback, mRawPictureCallback, mJpegPictureCallback);
waitForSnapshotDone();
ExifInterface exif = new ExifInterface(JPEG_PATH);
- assertTrue(exif.getAttribute(ExifInterface.TAG_MAKE) != null);
- assertTrue(exif.getAttribute(ExifInterface.TAG_MODEL) != null);
- assertTrue(exif.getAttribute(ExifInterface.TAG_DATETIME) != null);
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_MAKE));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_MODEL));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_DATETIME));
assertTrue(exif.getAttributeInt(ExifInterface.TAG_IMAGE_WIDTH, 0) != 0);
assertTrue(exif.getAttributeInt(ExifInterface.TAG_IMAGE_LENGTH, 0) != 0);
- assertEquals(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE), null);
- assertEquals(exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE), null);
- assertEquals(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE_REF), null);
- assertEquals(exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE_REF), null);
- assertEquals(exif.getAttribute(ExifInterface.TAG_GPS_TIMESTAMP), null);
- assertEquals(exif.getAttribute(ExifInterface.TAG_GPS_DATESTAMP), null);
- assertEquals(exif.getAttribute(ExifInterface.TAG_GPS_PROCESSING_METHOD), null);
+ checkGpsDataNull(exif);
double exifFocalLength = (double)exif.getAttributeDouble(
ExifInterface.TAG_FOCAL_LENGTH, -1);
assertEquals(focalLength, exifFocalLength, 0.001);
@@ -743,17 +736,36 @@
mCamera.takePicture(mShutterCallback, mRawPictureCallback, mJpegPictureCallback);
waitForSnapshotDone();
exif = new ExifInterface(JPEG_PATH);
- assertTrue(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE) != null);
- assertTrue(exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE) != null);
- assertTrue(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE_REF) != null);
- assertTrue(exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE_REF) != null);
- assertTrue(exif.getAttribute(ExifInterface.TAG_GPS_TIMESTAMP) != null);
- assertTrue(exif.getAttribute(ExifInterface.TAG_GPS_DATESTAMP) != null);
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE_REF));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE_REF));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_GPS_TIMESTAMP));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_GPS_DATESTAMP));
assertEquals(thirtyTwoCharacters,
exif.getAttribute(ExifInterface.TAG_GPS_PROCESSING_METHOD));
+
+ // Test gps tags do not exist after calling removeGpsData.
+ mCamera.startPreview();
+ parameters.removeGpsData();
+ mCamera.setParameters(parameters);
+ mCamera.takePicture(mShutterCallback, mRawPictureCallback, mJpegPictureCallback);
+ waitForSnapshotDone();
+ exif = new ExifInterface(JPEG_PATH);
+ checkGpsDataNull(exif);
terminateMessageLooper();
}
+ private void checkGpsDataNull(ExifInterface exif) {
+ assertNull(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE));
+ assertNull(exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE));
+ assertNull(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE_REF));
+ assertNull(exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE_REF));
+ assertNull(exif.getAttribute(ExifInterface.TAG_GPS_TIMESTAMP));
+ assertNull(exif.getAttribute(ExifInterface.TAG_GPS_DATESTAMP));
+ assertNull(exif.getAttribute(ExifInterface.TAG_GPS_PROCESSING_METHOD));
+ }
+
@TestTargets({
@TestTargetNew(
level = TestLevel.COMPLETE,
@@ -771,7 +783,7 @@
initializeMessageLooper();
Camera.Parameters parameters = mCamera.getParameters();
SurfaceHolder surfaceHolder;
- surfaceHolder = CameraStubActivity.mSurfaceView.getHolder();
+ surfaceHolder = getActivity().getSurfaceView().getHolder();
Size size = parameters.getPreviewSize();
mCamera.setParameters(parameters);
mCamera.setPreviewDisplay(surfaceHolder);
@@ -837,39 +849,49 @@
public void testPreviewCallbackWithBuffer() throws Exception {
initializeMessageLooper();
SurfaceHolder surfaceHolder;
- surfaceHolder = CameraStubActivity.mSurfaceView.getHolder();
+ surfaceHolder = getActivity().getSurfaceView().getHolder();
mCamera.setPreviewDisplay(surfaceHolder);
- Size size = mCamera.getParameters().getPreviewSize();
+ Parameters parameters = mCamera.getParameters();
PreviewCallbackWithBuffer callback = new PreviewCallbackWithBuffer();
- callback.mBuffer1 = new byte[size.width * size.height * 3 / 2 + 1];
- callback.mBuffer2 = new byte[size.width * size.height * 3 / 2 + 1];
- callback.mBuffer3 = new byte[size.width * size.height * 3 / 2 + 1];
+ // Test all preview sizes.
+ for (Size size: parameters.getSupportedPreviewSizes()) {
+ parameters.setPreviewSize(size.width, size.height);
+ mCamera.setParameters(parameters);
+ callback.mNumCbWithBuffer1 = 0;
+ callback.mNumCbWithBuffer2 = 0;
+ callback.mNumCbWithBuffer3 = 0;
+ callback.mBuffer1 = new byte[size.width * size.height * 3 / 2];
+ callback.mBuffer2 = new byte[size.width * size.height * 3 / 2];
+ callback.mBuffer3 = new byte[size.width * size.height * 3 / 2];
- // Test if we can get the preview callbacks with specified buffers.
- mCamera.addCallbackBuffer(callback.mBuffer1);
- mCamera.addCallbackBuffer(callback.mBuffer2);
- mCamera.setPreviewCallbackWithBuffer(callback);
- mCamera.startPreview();
- waitForPreviewDone();
- assertEquals(1, callback.mNumCbWithBuffer1);
- assertEquals(1, callback.mNumCbWithBuffer2);
- assertEquals(0, callback.mNumCbWithBuffer3);
+ // Test if we can get the preview callbacks with specified buffers.
+ mCamera.addCallbackBuffer(callback.mBuffer1);
+ mCamera.addCallbackBuffer(callback.mBuffer2);
+ mCamera.setPreviewCallbackWithBuffer(callback);
+ mCamera.startPreview();
+ waitForPreviewDone();
+ assertEquals(1, callback.mNumCbWithBuffer1);
+ assertEquals(1, callback.mNumCbWithBuffer2);
+ assertEquals(0, callback.mNumCbWithBuffer3);
- // Test if preview callback with buffer still works during preview.
- callback.mNumCbWithBuffer1 = callback.mNumCbWithBuffer2 = 0;
- mCamera.addCallbackBuffer(callback.mBuffer3);
- waitForPreviewDone();
- assertEquals(0, callback.mNumCbWithBuffer1);
- assertEquals(0, callback.mNumCbWithBuffer2);
- assertEquals(1, callback.mNumCbWithBuffer3);
+ // Test if preview callback with buffer still works during preview.
+ mCamera.addCallbackBuffer(callback.mBuffer3);
+ waitForPreviewDone();
+ assertEquals(1, callback.mNumCbWithBuffer1);
+ assertEquals(1, callback.mNumCbWithBuffer2);
+ assertEquals(1, callback.mNumCbWithBuffer3);
+ mCamera.setPreviewCallbackWithBuffer(null);
+ mCamera.stopPreview();
+ }
terminateMessageLooper();
}
- private final class PreviewCallbackWithBuffer implements PreviewCallback {
+ private final class PreviewCallbackWithBuffer
+ implements android.hardware.Camera.PreviewCallback {
public int mNumCbWithBuffer1, mNumCbWithBuffer2, mNumCbWithBuffer3;
public byte[] mBuffer1, mBuffer2, mBuffer3;
public void onPreviewFrame(byte[] data, Camera camera) {
- assert(data != null);
+ assertNotNull(data);
if (data == mBuffer1) {
mNumCbWithBuffer1++;
} else if (data == mBuffer2) {
@@ -917,21 +939,19 @@
if (!parameters.isZoomSupported()) return;
// Test the zoom parameters.
- assertEquals(parameters.getZoom(), 0); // default zoom should be 0.
+ assertEquals(0, parameters.getZoom()); // default zoom should be 0.
int maxZoom = parameters.getMaxZoom();
assertTrue(maxZoom >= 0);
if (maxZoom > 0) {
// Zoom ratios should be sorted from small to large.
List<Integer> ratios = parameters.getZoomRatios();
- assertEquals(ratios.size(), maxZoom + 1);
- assertEquals(ratios.get(0).intValue(), 100);
+ assertEquals(maxZoom + 1, ratios.size());
+ assertEquals(100, ratios.get(0).intValue());
for (int i = 0; i < ratios.size() - 1; i++) {
assertTrue(ratios.get(i) < ratios.get(i + 1));
}
}
- SurfaceHolder mSurfaceHolder;
- mSurfaceHolder = CameraStubActivity.mSurfaceView.getHolder();
- mCamera.setPreviewDisplay(mSurfaceHolder);
+ mCamera.setPreviewDisplay(getActivity().getSurfaceView().getHolder());
mCamera.startPreview();
waitForPreviewDone();
@@ -962,10 +982,8 @@
if (!parameters.isSmoothZoomSupported()) return;
assertTrue(parameters.isZoomSupported());
- SurfaceHolder mSurfaceHolder;
- mSurfaceHolder = CameraStubActivity.mSurfaceView.getHolder();
ZoomListener zoomListener = new ZoomListener();
- mCamera.setPreviewDisplay(mSurfaceHolder);
+ mCamera.setPreviewDisplay(getActivity().getSurfaceView().getHolder());
mCamera.setZoomChangeListener(zoomListener);
mCamera.startPreview();
waitForPreviewDone();
@@ -1001,7 +1019,7 @@
Log.e(TAG, "zoomListener.mStopped = " + zoomListener.mStopped);
zoomListener.mZoomDone.close();
mCamera.startSmoothZoom(maxZoom / 2);
- assertEquals(true, zoomListener.mZoomDone.block(5000));
+ assertTrue(zoomListener.mZoomDone.block(5000));
assertEquals(maxZoom - (maxZoom / 2), zoomListener.mValues.size());
int i = maxZoom - 1;
for(Integer value: zoomListener.mValues) {
@@ -1042,11 +1060,203 @@
public void onZoomChange(int value, boolean stopped, Camera camera) {
mValues.add(value);
assertEquals(value, camera.getParameters().getZoom());
- assertEquals(false, mStopped);
+ assertFalse(mStopped);
mStopped = stopped;
if (stopped) {
mZoomDone.open();
}
}
}
+
+ @UiThreadTest
+ public void testFocusDistances() throws Exception {
+ initializeMessageLooper();
+ mCamera.setPreviewDisplay(getActivity().getSurfaceView().getHolder());
+ mCamera.startPreview();
+ waitForPreviewDone();
+ Parameters parameters = mCamera.getParameters();
+
+ // Test every supported focus mode.
+ for (String focusMode: parameters.getSupportedFocusModes()) {
+ parameters.setFocusMode(focusMode);
+ mCamera.setParameters(parameters);
+ parameters = mCamera.getParameters();
+ checkFocusDistances(parameters);
+ if (Parameters.FOCUS_MODE_AUTO.equals(focusMode)
+ || Parameters.FOCUS_MODE_MACRO.equals(focusMode)) {
+ mCamera.autoFocus(mAutoFocusCallback);
+ assertTrue(waitForFocusDone());
+ parameters = mCamera.getParameters();
+ checkFocusDistances(parameters);
+ }
+ }
+
+ // Test if the method throws exception if the argument is invalid.
+ try {
+ parameters.getFocusDistances(null);
+ fail("getFocusDistances should not accept null.");
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+
+ try {
+ parameters.getFocusDistances(new float[2]);
+ fail("getFocusDistances should not accept a float array with two elements.");
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+
+ try {
+ parameters.getFocusDistances(new float[4]);
+ fail("getFocusDistances should not accept a float array with four elements.");
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+ terminateMessageLooper();
+ }
+
+ private void checkFocusDistances(Parameters parameters) {
+ float[] distances = new float[3];
+ parameters.getFocusDistances(distances);
+
+ // Focus distances should be greater than 0.
+ assertTrue(distances[Parameters.FOCUS_DISTANCE_NEAR_INDEX] > 0);
+ assertTrue(distances[Parameters.FOCUS_DISTANCE_OPTIMAL_INDEX] > 0);
+ assertTrue(distances[Parameters.FOCUS_DISTANCE_FAR_INDEX] > 0);
+
+ // Make sure far focus distance >= optimal focus distance >= near focus distance.
+ assertTrue(distances[Parameters.FOCUS_DISTANCE_FAR_INDEX] >=
+ distances[Parameters.FOCUS_DISTANCE_OPTIMAL_INDEX]);
+ assertTrue(distances[Parameters.FOCUS_DISTANCE_OPTIMAL_INDEX] >=
+ distances[Parameters.FOCUS_DISTANCE_NEAR_INDEX]);
+
+ // Far focus distance should be infinity in infinity focus mode.
+ if (Parameters.FOCUS_MODE_INFINITY.equals(parameters.getFocusMode())) {
+ assertEquals(Float.POSITIVE_INFINITY,
+ distances[Parameters.FOCUS_DISTANCE_FAR_INDEX]);
+ }
+ }
+
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "cancelAutofocus",
+ args = {}
+ )
+ })
+ @UiThreadTest
+ public void testCancelAutofocus() throws Exception {
+ initializeMessageLooper();
+ mCamera.setPreviewDisplay(getActivity().getSurfaceView().getHolder());
+ mCamera.startPreview();
+
+ // No op if autofocus is not in progress.
+ mCamera.cancelAutoFocus();
+
+ // Try to cancel autofocus immediately.
+ mCamera.autoFocus(mAutoFocusCallback);
+ mCamera.cancelAutoFocus();
+ checkFocusDistanceNotChanging();
+
+ // Try to cancel autofocus after it starts for some time.
+ mCamera.autoFocus(mAutoFocusCallback);
+ Thread.sleep(500);
+ mCamera.cancelAutoFocus();
+ checkFocusDistanceNotChanging();
+
+ // Try to cancel autofocus after it completes. It should be no op.
+ mCamera.autoFocus(mAutoFocusCallback);
+ assertTrue(waitForFocusDone());
+ mCamera.cancelAutoFocus();
+
+ // Test the case calling cancelAutoFocus and release in a row.
+ mCamera.autoFocus(mAutoFocusCallback);
+ mCamera.cancelAutoFocus();
+ mCamera.release();
+
+ // Ensure the camera can be opened if release is called right after AF.
+ mCamera = Camera.open();
+ mCamera.startPreview();
+ mCamera.autoFocus(mAutoFocusCallback);
+ mCamera.release();
+
+ terminateMessageLooper();
+ }
+
+ private void checkFocusDistanceNotChanging() throws Exception {
+ float[] distances1 = new float[3];
+ float[] distances2 = new float[3];
+ Parameters parameters = mCamera.getParameters();
+ parameters.getFocusDistances(distances1);
+ Thread.sleep(100);
+ parameters = mCamera.getParameters();
+ parameters.getFocusDistances(distances2);
+ assertEquals(distances1[Parameters.FOCUS_DISTANCE_NEAR_INDEX],
+ distances2[Parameters.FOCUS_DISTANCE_NEAR_INDEX]);
+ assertEquals(distances1[Parameters.FOCUS_DISTANCE_OPTIMAL_INDEX],
+ distances2[Parameters.FOCUS_DISTANCE_OPTIMAL_INDEX]);
+ assertEquals(distances1[Parameters.FOCUS_DISTANCE_FAR_INDEX],
+ distances2[Parameters.FOCUS_DISTANCE_FAR_INDEX]);
+ }
+
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getNumberOfCameras",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getCameraInfo",
+ args = {int.class, CameraInfo.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "open",
+ args = {int.class}
+ )
+ })
+ @UiThreadTest
+ public void testMultipleCameras() throws Exception {
+ int nCameras = Camera.getNumberOfCameras();
+ Log.v(TAG, "total " + nCameras + " cameras");
+ assertTrue(nCameras > 0);
+
+ for (int id = -1; id <= nCameras; id++) {
+ Log.v(TAG, "testing camera #" + id);
+
+ boolean isBadId = (id < 0 || id >= nCameras);
+
+ CameraInfo info = new CameraInfo();
+ try {
+ Camera.getCameraInfo(id, info);
+ if (isBadId) {
+ fail("getCameraInfo should not accept bad cameraId (" + id + ")");
+ }
+ } catch (RuntimeException e) {
+ if (!isBadId) throw e;
+ }
+
+ int facing = info.mFacing;
+ int orientation = info.mOrientation;
+ assertTrue(facing == CameraInfo.CAMERA_FACING_BACK ||
+ facing == CameraInfo.CAMERA_FACING_FRONT);
+ assertTrue(orientation == 0 || orientation == 90 ||
+ orientation == 180 || orientation == 270);
+
+ Camera camera = null;
+ try {
+ camera = Camera.open(id);
+ if (isBadId) {
+ fail("open() should not accept bad cameraId (" + id + ")");
+ }
+ } catch (RuntimeException e) {
+ if (!isBadId) throw e;
+ } finally {
+ if (camera != null) {
+ camera.release();
+ }
+ }
+ }
+ }
}
diff --git a/tests/tests/jni/libjnitest/helper.h b/tests/tests/jni/libjnitest/helper.h
index 6771d2f..58a3407 100644
--- a/tests/tests/jni/libjnitest/helper.h
+++ b/tests/tests/jni/libjnitest/helper.h
@@ -47,7 +47,7 @@
* @param ... printf-style arguments
* @return an allocated (char *) containing the formatted result
*/
-char *failure(const char *format, ...);
+char *failure(const char *format, ...) __attribute__((format(printf, 1, 2)));
/**
* Runs a list of tests. It will run all the tests, collecting as output
diff --git a/tests/tests/media/src/android/media/cts/CamcorderProfileTest.java b/tests/tests/media/src/android/media/cts/CamcorderProfileTest.java
new file mode 100644
index 0000000..b94da11
--- /dev/null
+++ b/tests/tests/media/src/android/media/cts/CamcorderProfileTest.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2010 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.media.cts;
+
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+
+import android.hardware.Camera;
+import android.media.CamcorderProfile;
+import android.test.AndroidTestCase;
+import android.util.Log;
+
+import java.util.List;
+
+@TestTargetClass(CamcorderProfile.class)
+public class CamcorderProfileTest extends AndroidTestCase {
+
+ private static final String TAG = "CamcorderProfileTest";
+
+ private void checkProfile(CamcorderProfile profile) {
+ Log.v(TAG, String.format("profile: duration=%d, quality=%d, " +
+ "fileFormat=%d, videoCodec=%d, videoBitRate=%d, videoFrameRate=%d, " +
+ "videoFrameWidth=%d, videoFrameHeight=%d, audioCodec=%d, " +
+ "audioBitRate=%d, audioSampleRate=%d, audioChannels=%d",
+ profile.duration,
+ profile.quality,
+ profile.fileFormat,
+ profile.videoCodec,
+ profile.videoBitRate,
+ profile.videoFrameRate,
+ profile.videoFrameWidth,
+ profile.videoFrameHeight,
+ profile.audioCodec,
+ profile.audioBitRate,
+ profile.audioSampleRate,
+ profile.audioChannels));
+ assertTrue(profile.duration > 0);
+ assertTrue(profile.quality == CamcorderProfile.QUALITY_LOW ||
+ profile.quality == CamcorderProfile.QUALITY_HIGH);
+ assertTrue(profile.videoBitRate > 0);
+ assertTrue(profile.videoFrameRate > 0);
+ assertTrue(profile.videoFrameWidth > 0);
+ assertTrue(profile.videoFrameHeight > 0);
+ assertTrue(profile.audioBitRate > 0);
+ assertTrue(profile.audioSampleRate > 0);
+ assertTrue(profile.audioChannels > 0);
+ }
+
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "get",
+ args = {int.class}
+ )
+ })
+ public void testGet() {
+ CamcorderProfile lowProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_LOW);
+ CamcorderProfile highProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
+ checkProfile(lowProfile);
+ checkProfile(highProfile);
+ }
+
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "get",
+ args = {int.class, int.class}
+ )
+ })
+ public void testGetWithId() {
+ int nCamera = Camera.getNumberOfCameras();
+ for (int id = 0; id < nCamera; id++) {
+ CamcorderProfile lowProfile = CamcorderProfile.get(id,
+ CamcorderProfile.QUALITY_LOW);
+ CamcorderProfile highProfile = CamcorderProfile.get(id,
+ CamcorderProfile.QUALITY_HIGH);
+ checkProfile(lowProfile);
+ checkProfile(highProfile);
+ }
+ }
+}
diff --git a/tests/tests/media/src/android/media/cts/CameraProfileTest.java b/tests/tests/media/src/android/media/cts/CameraProfileTest.java
new file mode 100644
index 0000000..72cd296
--- /dev/null
+++ b/tests/tests/media/src/android/media/cts/CameraProfileTest.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2010 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.media.cts;
+
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+
+import android.hardware.Camera;
+import android.media.CameraProfile;
+import android.test.AndroidTestCase;
+import android.util.Log;
+
+import java.util.List;
+
+@TestTargetClass(CameraProfile.class)
+public class CameraProfileTest extends AndroidTestCase {
+
+ private static final String TAG = "CameraProfileTest";
+
+ private void checkQuality(int low, int mid, int high) {
+ Log.v(TAG, "low = " + low + ", mid = " + mid + ", high = " + high);
+ assertTrue(low >= 0 && low <= 100);
+ assertTrue(mid >= 0 && mid <= 100);
+ assertTrue(high >= 0 && high <= 100);
+ assertTrue(low <= mid && mid <= high);
+ }
+
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getJpegEncodingQualityParameter",
+ args = {int.class}
+ )
+ })
+ public void testGetImageEncodingQualityParameter() {
+ int low = CameraProfile.getJpegEncodingQualityParameter(CameraProfile.QUALITY_LOW);
+ int mid = CameraProfile.getJpegEncodingQualityParameter(CameraProfile.QUALITY_MEDIUM);
+ int high = CameraProfile.getJpegEncodingQualityParameter(CameraProfile.QUALITY_HIGH);
+ checkQuality(low, mid, high);
+ }
+
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getJpegEncodingQualityParameter",
+ args = {int.class, int.class}
+ )
+ })
+ public void testGetWithId() {
+ int nCamera = Camera.getNumberOfCameras();
+ for (int id = 0; id < nCamera; id++) {
+ int low = CameraProfile.getJpegEncodingQualityParameter(id, CameraProfile.QUALITY_LOW);
+ int mid = CameraProfile.getJpegEncodingQualityParameter(id, CameraProfile.QUALITY_MEDIUM);
+ int high = CameraProfile.getJpegEncodingQualityParameter(id, CameraProfile.QUALITY_HIGH);
+ checkQuality(low, mid, high);
+ }
+ }
+}
diff --git a/tests/tests/media/src/android/media/cts/VideoEditorTest.java b/tests/tests/media/src/android/media/cts/VideoEditorTest.java
new file mode 100644
index 0000000..481f4d6
--- /dev/null
+++ b/tests/tests/media/src/android/media/cts/VideoEditorTest.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010 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.media.cts;
+
+import com.android.cts.stub.R;
+
+import android.test.ActivityInstrumentationTestCase2;
+
+public class VideoEditorTest extends ActivityInstrumentationTestCase2<MediaStubActivity> {
+
+ public VideoEditorTest() {
+ super(MediaStubActivity.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ //setup for each test case.
+ super.setUp();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //Test case clean up.
+ super.tearDown();
+ }
+}
diff --git a/tests/tests/net/src/android/net/cts/ListeningPortsTest.java b/tests/tests/net/src/android/net/cts/ListeningPortsTest.java
deleted file mode 100644
index ff6b4e9..0000000
--- a/tests/tests/net/src/android/net/cts/ListeningPortsTest.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (C) 2010 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.net.cts;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Scanner;
-import java.util.regex.Pattern;
-
-import junit.framework.TestCase;
-
-public class ListeningPortsTest extends TestCase {
-
- /** Address patterns used to check whether we're checking the right column in /proc/net. */
- private static final List<String> ADDRESS_PATTERNS = new ArrayList<String>(2);
-
- static {
- ADDRESS_PATTERNS.add("[0-9A-F]{8}:[0-9A-F]{4}");
- ADDRESS_PATTERNS.add("[0-9A-F]{32}:[0-9A-F]{4}");
- }
-
- /** Ports that are allowed to be listening on the emulator. */
- private static final List<String> EXCEPTION_PATTERNS = new ArrayList<String>(6);
-
- static {
- // IPv4 exceptions
- EXCEPTION_PATTERNS.add("00000000:15B3"); // 0.0.0.0:5555 - emulator port
- EXCEPTION_PATTERNS.add("0F02000A:15B3"); // 10.0.2.15:5555 - net forwarding for emulator
- EXCEPTION_PATTERNS.add("[0-9A-F]{6}7F:[0-9A-F]{4}"); // IPv4 Loopback
-
- // IPv6 exceptions
- EXCEPTION_PATTERNS.add("[0]{31}1:[0-9A-F]{4}"); // IPv6 Loopback
- EXCEPTION_PATTERNS.add("[0]{16}[0]{4}[0]{4}[0-9A-F]{6}7F:[0-9A-F]{4}"); // IPv4-6 Conversion
- EXCEPTION_PATTERNS.add("[0]{16}[F]{4}[0]{4}[0-9A-F]{6}7F:[0-9A-F]{4}"); // IPv4-6 Conversion
- }
-
- public static void testNoListeningPorts() {
- final boolean isTcp = true;
- assertNoListeningPorts("/proc/net/tcp", isTcp);
- assertNoListeningPorts("/proc/net/tcp6", isTcp);
- assertNoListeningPorts("/proc/net/udp", !isTcp);
- assertNoListeningPorts("/proc/net/udp6", !isTcp);
- }
-
- private static void assertNoListeningPorts(String procFilePath, boolean isTcp) {
-
- /*
- * Sample output of "cat /proc/net/tcp" on emulator:
- *
- * sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid ...
- * 0: 0100007F:13AD 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0 ...
- * 1: 00000000:15B3 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0 ...
- * 2: 0F02000A:15B3 0202000A:CE8A 01 00000000:00000000 00:00000000 00000000 0 ...
- *
- */
-
- File procFile = new File(procFilePath);
- Scanner scanner = null;
- try {
- scanner = new Scanner(procFile);
- while (scanner.hasNextLine()) {
- String line = scanner.nextLine().trim();
-
- // Skip column headers
- if (line.startsWith("sl")) {
- continue;
- }
-
- String[] fields = line.split("\\s+");
- final int expectedNumColumns = 12;
- assertTrue(procFilePath + " should have at least " + expectedNumColumns
- + " columns of output " + fields, fields.length >= expectedNumColumns);
-
- String localAddress = fields[1];
- String state = fields[3];
-
- assertTrue(procFilePath + " should have an IP address in the second column",
- isAddress(localAddress));
-
- if (!isException(localAddress) && isPortListening(state, isTcp)) {
- fail("Found port listening on " + localAddress + " in " + procFilePath);
- }
- }
- } catch (FileNotFoundException notFound) {
- fail("Could not open file " + procFilePath + " to check for listening ports.");
- } finally {
- if (scanner != null) {
- scanner.close();
- }
- }
- }
-
- private static boolean isAddress(String localAddress) {
- return isPatternMatch(ADDRESS_PATTERNS, localAddress);
- }
-
- private static boolean isException(String localAddress) {
- return isPatternMatch(EXCEPTION_PATTERNS, localAddress);
- }
-
- private static boolean isPatternMatch(List<String> patterns, String input) {
- for (String pattern : patterns) {
- if (Pattern.matches(pattern, input)) {
- return true;
- }
- }
- return false;
- }
-
- private static boolean isPortListening(String state, boolean isTcp) {
- // 0A = TCP_LISTEN from include/net/tcp_states.h
- String listeningState = isTcp ? "0A" : "07";
- return listeningState.equals(state);
- }
-}
diff --git a/tests/tests/os/src/android/os/cts/Debug_InstructionCountTest.java b/tests/tests/os/src/android/os/cts/Debug_InstructionCountTest.java
deleted file mode 100644
index d6e9a68..0000000
--- a/tests/tests/os/src/android/os/cts/Debug_InstructionCountTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2010 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.os.cts;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
-import android.os.Debug;
-
-import junit.framework.TestCase;
-
-@TestTargetClass(Debug.InstructionCount.class)
-public class Debug_InstructionCountTest extends TestCase {
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "Debug.InstructionCount",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "resetAndStart",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "collect",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "globalTotal",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "globalMethodInvocations",
- args = {}
- )
- })
- public void testDebugInstructionCount() {
- Debug.InstructionCount instructionCount = new Debug.InstructionCount();
-
- assertTrue(instructionCount.resetAndStart());
- addTest(1, 2);
- instructionCount.collect();
- int insCountsFirst = instructionCount.globalTotal();
- int methodInvFirst = instructionCount.globalMethodInvocations();
-
- assertTrue(instructionCount.resetAndStart());
- addTest(1, 2);
- addTest(1, 2);
- instructionCount.collect();
- int insCountsSecond = instructionCount.globalTotal();
- int methodInvSecond = instructionCount.globalMethodInvocations();
-
- assertTrue(instructionCount.resetAndStart());
- addTest(1, 2);
- addTest(1, 2);
- addTest(1, 2);
- instructionCount.collect();
- int insCountsThird = instructionCount.globalTotal();
- int methodInvThird = instructionCount.globalMethodInvocations();
-
- assertEquals(insCountsThird - insCountsFirst, (insCountsSecond - insCountsFirst) * 2);
- assertEquals(methodInvThird - methodInvFirst, (methodInvSecond - methodInvFirst) * 2);
- }
-
- // must not be private, otherwise javac may inline the code
- protected int addTest(int a, int b) {
- return a + b;
- }
-}
diff --git a/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java b/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java
index 3f75f94..a97aa96 100644
--- a/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java
@@ -17,12 +17,15 @@
package android.telephony.cts;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.os.SystemClock;
import android.telephony.TelephonyManager;
import android.telephony.SmsManager;
import android.test.AndroidTestCase;
@@ -50,6 +53,12 @@
private static final String SMS_SEND_ACTION = "CTS_SMS_SEND_ACTION";
private static final String SMS_DELIVERY_ACTION = "CTS_SMS_DELIVERY_ACTION";
+ // List of network operators that don't support SMS delivery report
+ private static final List<String> NO_DELIVERY_REPORTS =
+ Arrays.asList(
+ "310410" // AT&T Mobility
+ );
+
private TelephonyManager mTelephonyManager;
private String mDestAddr;
private String mText;
@@ -59,6 +68,7 @@
private PendingIntent mDeliveredIntent;
private Intent mSendIntent;
private Intent mDeliveryIntent;
+ private boolean mDeliveryReportSupported;
private static final int TIME_OUT = 1000 * 60 * 4;
@@ -69,6 +79,18 @@
(TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE);
mDestAddr = mTelephonyManager.getLine1Number();
mText = "This is a test message";
+
+ if (mTelephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) {
+ // CDMA supports SMS delivery report
+ mDeliveryReportSupported = true;
+ } else if (mTelephonyManager.getDeviceId().equals("000000000000000")) {
+ // emulator doesn't support SMS delivery report
+ mDeliveryReportSupported = false;
+ } else {
+ // is this a GSM network that doesn't support SMS delivery report?
+ String mccmnc = mTelephonyManager.getSimOperator();
+ mDeliveryReportSupported = !(NO_DELIVERY_REPORTS.contains(mccmnc));
+ }
}
@TestTargetNew(
@@ -120,8 +142,10 @@
// send single text sms
init();
sendTextMessage(mDestAddr, mDestAddr, mSentIntent, mDeliveredIntent);
- mSendReceiver.waitForCalls(1, TIME_OUT);
- mDeliveryReceiver.waitForCalls(1, TIME_OUT);
+ assertTrue(mSendReceiver.waitForCalls(1, TIME_OUT));
+ if (mDeliveryReportSupported) {
+ assertTrue(mDeliveryReceiver.waitForCalls(1, TIME_OUT));
+ }
if (mTelephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) {
// TODO: temp workaround, OCTET encoding for EMS not properly supported
@@ -134,8 +158,10 @@
init();
sendDataMessage(mDestAddr, port, data, mSentIntent, mDeliveredIntent);
- mSendReceiver.waitForCalls(1, TIME_OUT);
- mDeliveryReceiver.waitForCalls(1, TIME_OUT);
+ assertTrue(mSendReceiver.waitForCalls(1, TIME_OUT));
+ if (mDeliveryReportSupported) {
+ assertTrue(mDeliveryReceiver.waitForCalls(1, TIME_OUT));
+ }
// send multi parts text sms
init();
@@ -148,8 +174,10 @@
deliveryIntents.add(PendingIntent.getBroadcast(getContext(), 0, mDeliveryIntent, 0));
}
sendMultiPartTextMessage(mDestAddr, parts, sentIntents, deliveryIntents);
- mSendReceiver.waitForCalls(numParts, TIME_OUT);
- mDeliveryReceiver.waitForCalls(numParts, TIME_OUT);
+ assertTrue(mSendReceiver.waitForCalls(numParts, TIME_OUT));
+ if (mDeliveryReportSupported) {
+ assertTrue(mDeliveryReceiver.waitForCalls(numParts, TIME_OUT));
+ }
}
private void init() {
@@ -220,12 +248,20 @@
}
}
- public void waitForCalls(int expectedCalls, long timeout) throws InterruptedException {
+ public boolean waitForCalls(int expectedCalls, long timeout) throws InterruptedException {
synchronized(mLock) {
mExpectedCalls = expectedCalls;
- if (mCalls < mExpectedCalls) {
- mLock.wait(timeout);
+ long startTime = SystemClock.elapsedRealtime();
+
+ while (mCalls < mExpectedCalls) {
+ long waitTime = timeout - (SystemClock.elapsedRealtime() - startTime);
+ if (waitTime > 0) {
+ mLock.wait(waitTime);
+ } else {
+ return false; // timed out
+ }
}
+ return true; // success
}
}
}
diff --git a/tests/tests/telephony/src/android/telephony/cts/SmsMessageTest.java b/tests/tests/telephony/src/android/telephony/cts/SmsMessageTest.java
index 44b0871..515f8b5 100644
--- a/tests/tests/telephony/src/android/telephony/cts/SmsMessageTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/SmsMessageTest.java
@@ -212,7 +212,7 @@
assertEquals(SCA2, sms.getServiceCenterAddress());
assertEquals(OA2, sms.getOriginatingAddress());
assertEquals(MESSAGE_BODY2, sms.getMessageBody());
- CharSequence msgBody = (CharSequence) sms.getMessageBody();
+ CharSequence msgBody = sms.getMessageBody();
result = SmsMessage.calculateLength(msgBody, false);
assertEquals(SMS_NUMBER2, result[0]);
assertEquals(sms.getMessageBody().length(), result[1]);
diff --git a/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java b/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
index 9ecbf20..90b2bf9 100644
--- a/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
@@ -22,8 +22,6 @@
import dalvik.annotation.TestTargets;
import android.content.Context;
-import android.net.wifi.WifiInfo;
-import android.net.wifi.WifiManager;
import android.os.Looper;
import android.os.cts.TestThread;
import android.telephony.CellLocation;
@@ -31,8 +29,6 @@
import android.telephony.TelephonyManager;
import android.test.AndroidTestCase;
-import java.util.regex.Pattern;
-
@TestTargetClass(TelephonyManager.class)
public class TelephonyManagerTest extends AndroidTestCase {
private TelephonyManager mTelephonyManager;
@@ -270,137 +266,4 @@
mTelephonyManager.getDeviceId();
mTelephonyManager.getDeviceSoftwareVersion();
}
-
- /**
- * Tests that the device properly reports either a valid IMEI if GSM,
- * a valid MEID if CDMA, or a valid MAC address if only a WiFi device.
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getDeviceId",
- args = {}
- )
- public void testGetDeviceId() {
- String deviceId = mTelephonyManager.getDeviceId();
- int phoneType = mTelephonyManager.getPhoneType();
- switch (phoneType) {
- case TelephonyManager.PHONE_TYPE_GSM:
- assertImeiDeviceId(deviceId);
- break;
-
- case TelephonyManager.PHONE_TYPE_CDMA:
- assertMeidDeviceId(deviceId);
- break;
-
- case TelephonyManager.PHONE_TYPE_NONE:
- assertMacAddressReported();
- break;
-
- default:
- throw new IllegalArgumentException("Did you add a new phone type? " + phoneType);
- }
- }
-
- private static void assertImeiDeviceId(String deviceId) {
- assertImeiFormat(deviceId);
- assertImeiCheckDigit(deviceId);
- assertReportingBodyIdentifier(deviceId, true); // Must be decimal identifier
- }
-
- private static void assertImeiFormat(String deviceId) {
- // IMEI must include the check digit
- String imeiPattern = "[0-9]{15}";
- assertTrue("IMEI device id " + deviceId + " does not match pattern " + imeiPattern,
- Pattern.matches(imeiPattern, deviceId));
- }
-
- private static void assertImeiCheckDigit(String deviceId) {
- int expectedCheckDigit = getLuhnCheckDigit(deviceId.substring(0, 14));
- int actualCheckDigit = Character.digit(deviceId.charAt(14), 10);
- assertEquals("Incorrect check digit for " + deviceId, expectedCheckDigit, actualCheckDigit);
- }
-
- /**
- * Use decimal value (0-9) to index into array to get sum of its digits
- * needed by Lunh check.
- *
- * Example: DOUBLE_DIGIT_SUM[6] = 3 because 6 * 2 = 12 => 1 + 2 = 3
- */
- private static final int[] DOUBLE_DIGIT_SUM = {0, 2, 4, 6, 8, 1, 3, 5, 7, 9};
-
- /**
- * Calculate the check digit by starting from the right, doubling every
- * each digit, summing all the digits including the doubled ones, and
- * finding a number to make the sum divisible by 10.
- *
- * @param deviceId not including the check digit
- * @return the check digit
- */
- private static int getLuhnCheckDigit(String deviceId) {
- int sum = 0;
- int dontDoubleModulus = deviceId.length() % 2;
- for (int i = deviceId.length() - 1; i >= 0; --i) {
- int digit = Character.digit(deviceId.charAt(i), 10);
- if (i % 2 == dontDoubleModulus) {
- sum += digit;
- } else {
- sum += DOUBLE_DIGIT_SUM[digit];
- }
- }
- sum %= 10;
- return sum == 0 ? 0 : 10 - sum;
- }
-
- private static void assertReportingBodyIdentifier(String deviceId, boolean decimalIdentifier) {
- // Check the reporting body identifier
- int reportingBodyIdentifier = Integer.parseInt(deviceId.substring(0, 2), 16);
- int decimalBound = 0xA0;
- String message = String.format("%s RR %x not %s than %x",
- decimalIdentifier ? "IMEI" : "MEID",
- reportingBodyIdentifier,
- decimalIdentifier ? "<" : ">=",
- decimalBound);
- assertEquals(message, decimalIdentifier, reportingBodyIdentifier < decimalBound);
- }
-
- private static void assertMeidDeviceId(String deviceId) {
- assertHexadecimalMeidFormat(deviceId);
- assertReportingBodyIdentifier(deviceId, false); // Must be hexadecimal identifier
- }
-
- private static void assertHexadecimalMeidFormat(String deviceId) {
- // MEID must NOT include the check digit.
- String meidPattern = "[0-9a-fA-F]{14}";
- assertTrue("MEID hex device id " + deviceId + " does not match pattern " + meidPattern,
- Pattern.matches(meidPattern, deviceId));
- }
-
- private void assertMacAddressReported() {
- String macAddress = getMacAddress();
- String macPattern = "([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}";
- assertTrue("MAC Address " + macAddress + " does not match pattern " + macPattern,
- Pattern.matches(macPattern, macAddress));
- }
-
- /** @return mac address which requires the WiFi system to be enabled */
- private String getMacAddress() {
- WifiManager wifiManager = (WifiManager) getContext()
- .getSystemService(Context.WIFI_SERVICE);
-
- boolean enabled = wifiManager.isWifiEnabled();
-
- try {
- if (!enabled) {
- wifiManager.setWifiEnabled(true);
- }
-
- WifiInfo wifiInfo = wifiManager.getConnectionInfo();
- return wifiInfo.getMacAddress();
-
- } finally {
- if (!enabled) {
- wifiManager.setWifiEnabled(false);
- }
- }
- }
}
diff --git a/tests/tests/telephony/src/android/telephony/gsm/cts/SmsManagerTest.java b/tests/tests/telephony/src/android/telephony/gsm/cts/SmsManagerTest.java
index 8dc6936..512e89d 100644
--- a/tests/tests/telephony/src/android/telephony/gsm/cts/SmsManagerTest.java
+++ b/tests/tests/telephony/src/android/telephony/gsm/cts/SmsManagerTest.java
@@ -28,6 +28,7 @@
@TestTargetClass(SmsManager.class)
public class SmsManagerTest extends android.telephony.cts.SmsManagerTest {
+ @Override
@TestTargetNew(
level = TestLevel.COMPLETE,
method = "getDefault",
diff --git a/tests/tests/text/src/android/text/method/cts/DateTimeKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/DateTimeKeyListenerTest.java
index 225c4b4..dd85b55 100644
--- a/tests/tests/text/src/android/text/method/cts/DateTimeKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/DateTimeKeyListenerTest.java
@@ -124,15 +124,15 @@
assertEquals("", mTextView.getText().toString());
// press '1' key.
- mInstrumentation.sendStringSync("1");
+ sendKeys(KeyEvent.KEYCODE_1);
assertEquals("1", mTextView.getText().toString());
// press '2' key.
- mInstrumentation.sendStringSync("2");
+ sendKeys(KeyEvent.KEYCODE_2);
assertEquals("12", mTextView.getText().toString());
// press 'a' key.
- mInstrumentation.sendStringSync("a");
+ sendKeys(KeyEvent.KEYCODE_A);
assertEquals("12a", mTextView.getText().toString());
// press an unaccepted key if it exists.
@@ -152,7 +152,7 @@
mInstrumentation.waitForIdleSync();
assertEquals("12a", mTextView.getText().toString());
- mInstrumentation.sendStringSync("1");
+ sendKeys(KeyEvent.KEYCODE_1);
assertEquals("12a", mTextView.getText().toString());
}
diff --git a/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java b/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java
index 9968bda..907b522 100644
--- a/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java
@@ -38,7 +38,6 @@
import android.view.ViewGroup.LayoutParams;
import android.widget.TextView;
import android.widget.TextView.BufferType;
-import android.widget.cts.WidgetTestUtils;
/**
* Test {@link ScrollingMovementMethod}. The class is an implementation of interface
@@ -118,9 +117,9 @@
mTextView.setText("hello world", BufferType.SPANNABLE);
mTextView.setSingleLine();
mSpannable = (Spannable) mTextView.getText();
- int width = WidgetTestUtils.convertDipToPixels(getActivity(), LITTLE_SPACE);
getActivity().setContentView(mTextView,
- new ViewGroup.LayoutParams(width, ViewGroup.LayoutParams.WRAP_CONTENT));
+ new ViewGroup.LayoutParams(LITTLE_SPACE,
+ ViewGroup.LayoutParams.WRAP_CONTENT));
}
});
assertNotNull(mTextView.getLayout());
@@ -341,9 +340,9 @@
*/
runActionOnUiThread(new Runnable() {
public void run() {
- int width = WidgetTestUtils.convertDipToPixels(getActivity(), LITTLE_SPACE);
getActivity().setContentView(mTextView,
- new ViewGroup.LayoutParams(width, ViewGroup.LayoutParams.WRAP_CONTENT));
+ new ViewGroup.LayoutParams(LITTLE_SPACE,
+ ViewGroup.LayoutParams.WRAP_CONTENT));
}
});
assertNotNull(mTextView.getLayout());
@@ -475,9 +474,9 @@
public void run() {
mTextView.setText("short");
mTextView.setSingleLine();
- int width = WidgetTestUtils.convertDipToPixels(getActivity(), LITTLE_SPACE);
getActivity().setContentView(mTextView,
- new ViewGroup.LayoutParams(width, ViewGroup.LayoutParams.WRAP_CONTENT));
+ new ViewGroup.LayoutParams(LITTLE_SPACE,
+ ViewGroup.LayoutParams.WRAP_CONTENT));
}
});
assertNotNull(mTextView.getLayout());
@@ -833,10 +832,9 @@
runActionOnUiThread(new Runnable() {
public void run() {
- int height = WidgetTestUtils.convertDipToPixels(getActivity(), LITTLE_SPACE);
getActivity().setContentView(mTextView,
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
- height));
+ LITTLE_SPACE));
}
});
Layout layout = mTextView.getLayout();
@@ -891,6 +889,12 @@
args = {TextView.class, Spannable.class}
)
})
+ @ToBeFixed(bug = "1695243", explanation = "Android API javadocs are incomplete. @throws clause "
+ + "should be added into javadoc of "
+ + "ScrollingMovementMethod#left(TextView, Spannable) and "
+ + "ScrollingMovementMethod#right(TextView, Spannable)"
+ + "when the param widget or buffer is null")
+ @KnownFailure(value="bug 2323405, needs investigation")
public void testHorizontalMovement() throws Throwable {
/*
* All these assertions depends on whether the TextView has a layout.The text view will not
@@ -905,9 +909,9 @@
public void run() {
mTextView.setText("short");
mTextView.setSingleLine();
- int width = WidgetTestUtils.convertDipToPixels(getActivity(), LITTLE_SPACE);
getActivity().setContentView(mTextView,
- new ViewGroup.LayoutParams(width, ViewGroup.LayoutParams.WRAP_CONTENT));
+ new ViewGroup.LayoutParams(LITTLE_SPACE,
+ ViewGroup.LayoutParams.WRAP_CONTENT));
}
});
assertNotNull(mTextView.getLayout());
@@ -944,6 +948,34 @@
}
}));
assertEquals(previousScrollX, mTextView.getScrollX());
+
+ runActionOnUiThread(new Runnable() {
+ public void run() {
+ try {
+ method.right(null, mSpannable);
+ } catch (NullPointerException e) {
+ // NPE is acceptable
+ }
+
+ try {
+ method.right(mTextView, null);
+ } catch (NullPointerException e) {
+ // NPE is acceptable
+ }
+
+ try {
+ method.left(null, mSpannable);
+ } catch (NullPointerException e) {
+ // NPE is acceptable
+ }
+
+ try {
+ method.left(mTextView, null);
+ } catch (NullPointerException e) {
+ // NPE is acceptable
+ }
+ }
+ });
}
@TestTargetNew(
diff --git a/tests/tests/text/src/android/text/method/cts/TimeKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/TimeKeyListenerTest.java
index 278af6b..7f2f6ef 100644
--- a/tests/tests/text/src/android/text/method/cts/TimeKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/TimeKeyListenerTest.java
@@ -118,15 +118,15 @@
assertEquals("", mTextView.getText().toString());
// press '1' key.
- mInstrumentation.sendStringSync("1");
+ sendKeys(KeyEvent.KEYCODE_1);
assertEquals("1", mTextView.getText().toString());
// press '2' key.
- mInstrumentation.sendStringSync("2");
+ sendKeys(KeyEvent.KEYCODE_2);
assertEquals("12", mTextView.getText().toString());
// press 'a' key.
- mInstrumentation.sendStringSync("a");
+ sendKeys(KeyEvent.KEYCODE_A);
assertEquals("12a", mTextView.getText().toString());
// press an unaccepted key if it exists.
@@ -137,7 +137,7 @@
}
// press 'm' key.
- mInstrumentation.sendStringSync("m");
+ sendKeys(KeyEvent.KEYCODE_M);
assertEquals("12am", mTextView.getText().toString());
mActivity.runOnUiThread(new Runnable() {
@@ -149,7 +149,7 @@
mInstrumentation.waitForIdleSync();
// press '1' key.
- mInstrumentation.sendStringSync("1");
+ sendKeys(KeyEvent.KEYCODE_1);
assertEquals("12am", mTextView.getText().toString());
}
diff --git a/tests/tests/view/src/android/view/cts/AccessibilityEventTest.java b/tests/tests/view/src/android/view/cts/AccessibilityEventTest.java
deleted file mode 100644
index 731784a..0000000
--- a/tests/tests/view/src/android/view/cts/AccessibilityEventTest.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Copyright (C) 2010 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.view.cts;
-
-import android.os.Message;
-import android.os.Parcel;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.view.accessibility.AccessibilityEvent;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.Iterator;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-/**
- * Class for testing {@link AccessibilityEvent}.
- */
-public class AccessibilityEventTest extends TestCase {
-
- /** The number of properties of the {@link AccessibilityEvent} class. */
- private static final int NON_STATIC_FIELD_COUNT = 16;
-
- @MediumTest
- public void testMarshalling() throws Exception {
- // no new fields, so we are testing marshaling of all such
- assertNoNewNonStaticFieldsAdded();
-
- // fully populate the event to marshal
- AccessibilityEvent sentEvent = AccessibilityEvent.obtain();
- fullyPopulateSentAccessibilityEvent(sentEvent);
-
- // marshal and unmarshal the event
- Parcel parcel = Parcel.obtain();
- sentEvent.writeToParcel(parcel, 0);
- parcel.setDataPosition(0);
- AccessibilityEvent receivedEvent = AccessibilityEvent.CREATOR.createFromParcel(parcel);
-
- // make sure all fields properly marshaled
- assertEqualsAccessiblityEvent(sentEvent, receivedEvent);
- }
-
- /**
- * Tests if {@link AccessibilityEvent} are properly reused.
- */
- @MediumTest
- public void testReuse() {
- AccessibilityEvent firstEvent = AccessibilityEvent.obtain();
- firstEvent.recycle();
- AccessibilityEvent secondEvent = AccessibilityEvent.obtain();
- assertSame("AccessibilityEvent not properly reused", firstEvent, secondEvent);
- }
-
- /**
- * Tests if {@link AccessibilityEvent} are properly recycled.
- */
- @MediumTest
- public void testRecycle() {
- // obtain and populate an event
- AccessibilityEvent populatedEvent = AccessibilityEvent.obtain();
- fullyPopulateSentAccessibilityEvent(populatedEvent);
-
- // recycle and obtain the same recycled instance
- populatedEvent.recycle();
- AccessibilityEvent recycledEvent = AccessibilityEvent.obtain();
-
- // check expectations
- assertAccessibilityEventCleared(recycledEvent);
- }
-
- /**
- * Asserts that no new fields have been added, so we are testing marshaling
- * of all such.
- */
- private void assertNoNewNonStaticFieldsAdded() {
- int nonStaticFieldCount = 0;
-
- for (Field field : AccessibilityEvent.class.getDeclaredFields()) {
- if ((field.getModifiers() & Modifier.STATIC) == 0) {
- nonStaticFieldCount++;
- }
- }
-
- String message = "New fields have been added, so add code to test marchalling them.";
- assertEquals(message, NON_STATIC_FIELD_COUNT, nonStaticFieldCount);
- }
-
- /**
- * Fully populates the {@link AccessibilityEvent} to marshal.
- *
- * @param sentEvent The event to populate.
- */
- private void fullyPopulateSentAccessibilityEvent(AccessibilityEvent sentEvent) {
- sentEvent.setAddedCount(1);
- sentEvent.setBeforeText("BeforeText");
- sentEvent.setChecked(true);
- sentEvent.setClassName("foo.bar.baz.Class");
- sentEvent.setContentDescription("ContentDescription");
- sentEvent.setCurrentItemIndex(1);
- sentEvent.setEnabled(true);
- sentEvent.setEventType(AccessibilityEvent.TYPE_VIEW_FOCUSED);
- sentEvent.setEventTime(1000);
- sentEvent.setFromIndex(1);
- sentEvent.setFullScreen(true);
- sentEvent.setItemCount(1);
- sentEvent.setPackageName("foo.bar.baz");
- sentEvent.setParcelableData(Message.obtain(null, 1, 2, 3));
- sentEvent.setPassword(true);
- sentEvent.setRemovedCount(1);
- sentEvent.getText().add("Foo");
- }
-
- /**
- * Compares all properties of the <code>expectedEvent</code> and the
- * <code>receviedEvent</code> to verify that the received event is the one
- * that is expected.
- */
- public static void assertEqualsAccessiblityEvent(AccessibilityEvent expectedEvent,
- AccessibilityEvent receivedEvent) {
- assertEquals("addedCount has incorrect value", expectedEvent.getAddedCount(), receivedEvent
- .getAddedCount());
- assertEquals("beforeText has incorrect value", expectedEvent.getBeforeText(), receivedEvent
- .getBeforeText());
- assertEquals("checked has incorrect value", expectedEvent.isChecked(), receivedEvent
- .isChecked());
- assertEquals("className has incorrect value", expectedEvent.getClassName(), receivedEvent
- .getClassName());
- assertEquals("contentDescription has incorrect value", expectedEvent
- .getContentDescription(), receivedEvent.getContentDescription());
- assertEquals("currentItemIndex has incorrect value", expectedEvent.getCurrentItemIndex(),
- receivedEvent.getCurrentItemIndex());
- assertEquals("enabled has incorrect value", expectedEvent.isEnabled(), receivedEvent
- .isEnabled());
- assertEquals("eventType has incorrect value", expectedEvent.getEventType(), receivedEvent
- .getEventType());
- assertEquals("fromIndex has incorrect value", expectedEvent.getFromIndex(), receivedEvent
- .getFromIndex());
- assertEquals("fullScreen has incorrect value", expectedEvent.isFullScreen(), receivedEvent
- .isFullScreen());
- assertEquals("itemCount has incorrect value", expectedEvent.getItemCount(), receivedEvent
- .getItemCount());
- assertEquals("password has incorrect value", expectedEvent.isPassword(), receivedEvent
- .isPassword());
- assertEquals("removedCount has incorrect value", expectedEvent.getRemovedCount(),
- receivedEvent.getRemovedCount());
- assertEqualsText(expectedEvent, receivedEvent);
- }
-
- /**
- * Compares the text of the <code>expectedEvent</code> and
- * <code>receivedEvent</code> by comparing the string representation of the
- * corresponding {@link CharSequence}s.
- */
- public static void assertEqualsText(AccessibilityEvent expectedEvent,
- AccessibilityEvent receivedEvent) {
- String message = "text has incorrect value";
- List<CharSequence> expectedText = expectedEvent.getText();
- List<CharSequence> receivedText = receivedEvent.getText();
-
- TestCase.assertEquals(message, expectedText.size(), receivedText.size());
-
- Iterator<CharSequence> expectedTextIterator = expectedText.iterator();
- Iterator<CharSequence> receivedTextIterator = receivedText.iterator();
-
- for (int i = 0; i < expectedText.size(); i++) {
- // compare the string representation
- TestCase.assertEquals(message, expectedTextIterator.next().toString(),
- receivedTextIterator.next().toString());
- }
- }
-
- /**
- * Asserts that an {@link AccessibilityEvent} is cleared.
- *
- * @param event The event to check.
- */
- public static void assertAccessibilityEventCleared(AccessibilityEvent event) {
- TestCase.assertEquals("addedCount not properly recycled", 0, event.getAddedCount());
- TestCase.assertNull("beforeText not properly recycled", event.getBeforeText());
- TestCase.assertNull("className not properly recycled", event.getClassName());
- TestCase.assertNull("contentDescription not properly recycled", event
- .getContentDescription());
- TestCase.assertEquals("currentItemIndex not properly recycled", -1, event
- .getCurrentItemIndex());
- TestCase.assertEquals("eventTime not properly recycled", 0, event.getEventTime());
- TestCase.assertEquals("eventType not properly recycled", 0, event.getEventType());
- TestCase.assertEquals("fromIndex not properly recycled", 0, event.getFromIndex());
- TestCase.assertEquals("itemCount not properly recycled", 0, event.getItemCount());
- TestCase.assertNull("packageName not properly recycled", event.getPackageName());
- // This will fail and is fixed in Gingerbread Bug: 2593810
- // TestCase.assertNull("parcelableData not properly recycled", event.getParcelableData());
- TestCase.assertEquals("removedCount not properly recycled", 0, event.getRemovedCount());
- TestCase.assertTrue("text not properly recycled", event.getText().isEmpty());
- }
-}
diff --git a/tests/tests/view/src/android/view/cts/KeyCharacterMapTest.java b/tests/tests/view/src/android/view/cts/KeyCharacterMapTest.java
index 4ab38df..a96f384 100644
--- a/tests/tests/view/src/android/view/cts/KeyCharacterMapTest.java
+++ b/tests/tests/view/src/android/view/cts/KeyCharacterMapTest.java
@@ -21,7 +21,6 @@
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.KeyCharacterMap.KeyData;
-
import dalvik.annotation.TestLevel;
import dalvik.annotation.TestTargetClass;
import dalvik.annotation.TestTargetNew;
@@ -114,6 +113,7 @@
assertFalse(mKeyCharacterMap.isPrintingKey(KeyEvent.KEYCODE_TAB));
assertFalse(mKeyCharacterMap.isPrintingKey(KeyEvent.KEYCODE_SPACE));
assertFalse(mKeyCharacterMap.isPrintingKey(KeyEvent.KEYCODE_NUM));
+ assertFalse(mKeyCharacterMap.isPrintingKey(KeyEvent.KEYCODE_SYM));
assertFalse(mKeyCharacterMap.isPrintingKey(KeyEvent.KEYCODE_EXPLORER));
assertFalse(mKeyCharacterMap.isPrintingKey(KeyEvent.KEYCODE_ENVELOPE));
assertFalse(mKeyCharacterMap.isPrintingKey(KeyEvent.KEYCODE_ENTER));
@@ -182,17 +182,9 @@
fail("should throw exception");
} catch (Exception e) {
}
-
- assertEquals('\0', mKeyCharacterMap.getMatch(getCharacterKeyCode('E'), chars));
- assertEquals('A', mKeyCharacterMap.getMatch(getCharacterKeyCode('A'), chars));
- assertEquals('B', mKeyCharacterMap.getMatch(getCharacterKeyCode('B'), chars));
- }
-
- private int getCharacterKeyCode(char oneChar) {
- // Lowercase the character to avoid getting modifiers in the KeyEvent array.
- char[] chars = new char[] {Character.toLowerCase(oneChar)};
- KeyEvent[] events = mKeyCharacterMap.getEvents(chars);
- return events[0].getKeyCode();
+ assertEquals('\0', mKeyCharacterMap.getMatch(KeyEvent.KEYCODE_E, chars));
+ assertEquals('A', mKeyCharacterMap.getMatch(KeyEvent.KEYCODE_A, chars));
+ assertEquals('B', mKeyCharacterMap.getMatch(KeyEvent.KEYCODE_B, chars));
}
@TestTargetNew(
@@ -208,9 +200,9 @@
}
assertEquals('\0', mKeyCharacterMap.getMatch(1000, chars, 2));
assertEquals('\0', mKeyCharacterMap.getMatch(10000, chars, 2));
- assertEquals('\0', mKeyCharacterMap.getMatch(getCharacterKeyCode('E'), chars));
- assertEquals('A', mKeyCharacterMap.getMatch(getCharacterKeyCode('A'), chars));
- assertEquals('B', mKeyCharacterMap.getMatch(getCharacterKeyCode('B'), chars));
+ assertEquals('\0', mKeyCharacterMap.getMatch(KeyEvent.KEYCODE_E, chars, 0));
+ assertEquals('A', mKeyCharacterMap.getMatch(KeyEvent.KEYCODE_A, chars, 0));
+ assertEquals('B', mKeyCharacterMap.getMatch(KeyEvent.KEYCODE_B, chars, 0));
}
@TestTargetNew(
diff --git a/tests/tests/view/src/android/view/cts/MotionEventTest.java b/tests/tests/view/src/android/view/cts/MotionEventTest.java
index beece1e..e4df594 100644
--- a/tests/tests/view/src/android/view/cts/MotionEventTest.java
+++ b/tests/tests/view/src/android/view/cts/MotionEventTest.java
@@ -488,5 +488,13 @@
assertEquals(1, mMotionEvent2.getHistorySize());
mMotionEvent2.recycle();
+
+ try {
+ mMotionEvent2.recycle();
+ fail("recycle() should throw an exception when the event has already been recycled.");
+ } catch (RuntimeException ex) {
+ }
+
+ mMotionEvent2 = null; // since it was recycled, don't try to recycle again in tear down
}
}
diff --git a/tests/tests/view/src/android/view/cts/ViewTest.java b/tests/tests/view/src/android/view/cts/ViewTest.java
index 77624e8..462f164 100644
--- a/tests/tests/view/src/android/view/cts/ViewTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewTest.java
@@ -782,12 +782,7 @@
getInstrumentation().waitForIdleSync();
assertFalse(view.getGlobalVisibleRect(rect, point));
- Display display = getActivity().getWindowManager().getDefaultDisplay();
- int halfWidth = display.getWidth() / 2;
- int halfHeight = display.getHeight() /2;
-
- final LinearLayout.LayoutParams layoutParams3 =
- new LinearLayout.LayoutParams(halfWidth, halfHeight);
+ final LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(200, 300);
runTestOnUiThread(new Runnable() {
public void run() {
view.setLayoutParams(layoutParams3);
@@ -797,8 +792,8 @@
assertTrue(view.getGlobalVisibleRect(rect, point));
assertEquals(rcParent.left, rect.left);
assertEquals(rcParent.top, rect.top);
- assertEquals(rect.left + halfWidth, rect.right);
- assertEquals(rect.top + halfHeight, rect.bottom);
+ assertEquals(rect.left + 200, rect.right);
+ assertEquals(rect.top + 300, rect.bottom);
assertEquals(ptParent.x, point.x);
assertEquals(ptParent.y, point.y);
}
@@ -841,12 +836,7 @@
getInstrumentation().waitForIdleSync();
assertFalse(view.getGlobalVisibleRect(rect));
- Display display = getActivity().getWindowManager().getDefaultDisplay();
- int halfWidth = display.getWidth() / 2;
- int halfHeight = display.getHeight() /2;
-
- final LinearLayout.LayoutParams layoutParams3 =
- new LinearLayout.LayoutParams(halfWidth, halfHeight);
+ final LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(200, 300);
runTestOnUiThread(new Runnable() {
public void run() {
view.setLayoutParams(layoutParams3);
@@ -856,8 +846,8 @@
assertTrue(view.getGlobalVisibleRect(rect));
assertEquals(rcParent.left, rect.left);
assertEquals(rcParent.top, rect.top);
- assertEquals(rect.left + halfWidth, rect.right);
- assertEquals(rect.top + halfHeight, rect.bottom);
+ assertEquals(rect.left + 200, rect.right);
+ assertEquals(rect.top + 300, rect.bottom);
}
@TestTargets({
@@ -2903,6 +2893,9 @@
method = "getLocalVisibleRect",
args = {android.graphics.Rect.class}
)
+ @ToBeFixed(bug = "1695243", explanation =
+ "the javadoc for getLocalVisibleRect() is incomplete." +
+ "1. not clear what is supposed to happen if the input Rect is null.")
public void testGetLocalVisibleRect() throws Throwable {
final View view = mActivity.findViewById(R.id.mock_view);
Rect rect = new Rect();
@@ -2931,12 +2924,7 @@
getInstrumentation().waitForIdleSync();
assertFalse(view.getLocalVisibleRect(rect));
- Display display = getActivity().getWindowManager().getDefaultDisplay();
- int halfWidth = display.getWidth() / 2;
- int halfHeight = display.getHeight() /2;
-
- final LinearLayout.LayoutParams layoutParams3 =
- new LinearLayout.LayoutParams(halfWidth, halfHeight);
+ final LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(200, 300);
runTestOnUiThread(new Runnable() {
public void run() {
view.setLayoutParams(layoutParams3);
@@ -2947,8 +2935,8 @@
assertTrue(view.getLocalVisibleRect(rect));
assertEquals(20, rect.left);
assertEquals(-30, rect.top);
- assertEquals(halfWidth + 20, rect.right);
- assertEquals(halfHeight - 30, rect.bottom);
+ assertEquals(200 + 20, rect.right);
+ assertEquals(300 - 30, rect.bottom);
try {
view.getLocalVisibleRect(null);
@@ -4816,10 +4804,10 @@
public String tag;
public View firstChild;
}
-
+
private static final class MockRunnable implements Runnable {
public boolean hasRun = false;
-
+
public void run() {
hasRun = true;
}
diff --git a/tests/tests/view/src/android/view/cts/View_AnimationTest.java b/tests/tests/view/src/android/view/cts/View_AnimationTest.java
index d071781..06763f5 100644
--- a/tests/tests/view/src/android/view/cts/View_AnimationTest.java
+++ b/tests/tests/view/src/android/view/cts/View_AnimationTest.java
@@ -65,7 +65,7 @@
)
})
public void testAnimation() throws Throwable {
- final View view = mActivity.findViewById(R.id.mock_view);
+ final View view = mActivity.findViewById(R.id.fit_windows);
// set null animation
view.setAnimation(null);
assertNull(view.getAnimation());
@@ -89,7 +89,7 @@
})
@ToBeFixed(bug = "1695243", explanation = "Android API javadocs are incomplete")
public void testStartAnimation() throws Throwable {
- final View view = mActivity.findViewById(R.id.mock_view);
+ final View view = mActivity.findViewById(R.id.fit_windows);
// start null animation
try {
view.startAnimation(null);
@@ -120,7 +120,7 @@
)
})
public void testClearBeforeAnimation() throws Throwable {
- final View view = mActivity.findViewById(R.id.mock_view);
+ final View view = mActivity.findViewById(R.id.fit_windows);
assertFalse(mAnimation.hasStarted());
view.setAnimation(mAnimation);
@@ -147,7 +147,7 @@
)
})
public void testClearDuringAnimation() throws Throwable {
- final View view = mActivity.findViewById(R.id.mock_view);
+ final View view = mActivity.findViewById(R.id.fit_windows);
runTestOnUiThread(new Runnable() {
public void run() {
view.startAnimation(mAnimation);
diff --git a/tests/tests/view/src/android/view/cts/WindowTest.java b/tests/tests/view/src/android/view/cts/WindowTest.java
index 527f444..0e31888 100644
--- a/tests/tests/view/src/android/view/cts/WindowTest.java
+++ b/tests/tests/view/src/android/view/cts/WindowTest.java
@@ -39,11 +39,13 @@
import android.util.DisplayMetrics;
import android.view.accessibility.AccessibilityEvent;
import android.view.Gravity;
+import android.view.InputQueue;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
+import android.view.SurfaceHolder;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
@@ -1243,6 +1245,14 @@
public void setDefaultWindowFormat(int format) {
super.setDefaultWindowFormat(format);
}
+
+ @Override
+ public void takeSurface(SurfaceHolder.Callback2 callback) {
+ }
+
+ @Override
+ public void takeInputQueue(InputQueue.Callback callback) {
+ }
}
private class MockWindowCallback implements Window.Callback {
diff --git a/tests/tests/view/src/android/view/inputmethod/cts/BaseInputConnectionTest.java b/tests/tests/view/src/android/view/inputmethod/cts/BaseInputConnectionTest.java
deleted file mode 100644
index 8540a7c..0000000
--- a/tests/tests/view/src/android/view/inputmethod/cts/BaseInputConnectionTest.java
+++ /dev/null
@@ -1,352 +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.view.inputmethod.cts;
-
-import com.android.cts.stub.R;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
-import android.app.Instrumentation;
-import android.content.Context;
-import android.os.Bundle;
-import android.test.ActivityInstrumentationTestCase2;
-import android.text.Editable;
-import android.text.Spannable;
-import android.text.SpannableString;
-import android.text.TextUtils;
-import android.view.KeyEvent;
-import android.view.View;
-import android.view.Window;
-import android.view.animation.cts.DelayedCheck;
-import android.view.inputmethod.BaseInputConnection;
-import android.view.inputmethod.CompletionInfo;
-import android.view.inputmethod.ExtractedTextRequest;
-import android.view.inputmethod.InputMethodManager;
-import android.widget.EditText;
-
-@TestTargetClass(BaseInputConnection.class)
-public class BaseInputConnectionTest extends
- ActivityInstrumentationTestCase2<InputMethodStubActivity> {
-
- private InputMethodStubActivity mActivity;
- private Window mWindow;
- private EditText mView;
- private BaseInputConnection mConnection;
- private Instrumentation mInstrumentation;
-
- public BaseInputConnectionTest() {
- super("com.android.cts.stub", InputMethodStubActivity.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mInstrumentation = getInstrumentation();
- mActivity = getActivity();
- mWindow = mActivity.getWindow();
- mView = (EditText) mWindow.findViewById(R.id.entry);
- mConnection = new BaseInputConnection(mView, true);
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "beginBatchEdit",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "commitCompletion",
- args = {CompletionInfo.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "endBatchEdit",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getExtractedText",
- args = {ExtractedTextRequest.class, int.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "performContextMenuAction",
- args = {int.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "performEditorAction",
- args = {int.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "performPrivateCommand",
- args = {String.class, Bundle.class}
- )
- })
- public void testDefaultMethods() {
- // These methods are default to return fixed result.
-
- assertFalse(mConnection.beginBatchEdit());
- assertFalse(mConnection.endBatchEdit());
-
- // only fit for test default implementation of commitCompletion.
- int completionId = 1;
- String completionString = "commitCompletion test";
- assertFalse(mConnection.commitCompletion(new CompletionInfo(completionId,
- 0, completionString)));
-
- assertNull(mConnection.getExtractedText(new ExtractedTextRequest(), 0));
-
- // only fit for test default implementation of performEditorAction.
- int actionCode = 1;
- int actionId = 2;
- String action = "android.intent.action.MAIN";
- assertTrue(mConnection.performEditorAction(actionCode));
- assertFalse(mConnection.performContextMenuAction(actionId));
- assertFalse(mConnection.performPrivateCommand(action, new Bundle()));
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.NOT_FEASIBLE,
- method = "getComposingSpanEnd",
- args = {Spannable.class}
- ),
- @TestTargetNew(
- level = TestLevel.NOT_FEASIBLE,
- method = "getComposingSpanStart",
- args = {Spannable.class}
- ),
- @TestTargetNew(
- level = TestLevel.NOT_FEASIBLE,
- method = "removeComposingSpans",
- args = {Spannable.class}
- ),
- @TestTargetNew(
- level = TestLevel.NOT_FEASIBLE,
- method = "setComposingSpans",
- args = {Spannable.class}
- )
- })
- public void testOpComposingSpans() {
- Spannable text = new SpannableString("Test ComposingSpans");
- BaseInputConnection.setComposingSpans(text);
- assertTrue(BaseInputConnection.getComposingSpanStart(text) > -1);
- assertTrue(BaseInputConnection.getComposingSpanEnd(text) > -1);
- BaseInputConnection.removeComposingSpans(text);
- assertTrue(BaseInputConnection.getComposingSpanStart(text) == -1);
- assertTrue(BaseInputConnection.getComposingSpanEnd(text) == -1);
- }
-
- /**
- * getEditable: Return the target of edit operations. The default implementation
- * returns its own fake editable that is just used for composing text.
- * clearMetaKeyStates: Default implementation uses
- * MetaKeyKeyListener#clearMetaKeyState(long, int) to clear the state.
- * BugId:1738511
- * commitText: 1. Default implementation replaces any existing composing text with the given
- * text.
- * 2. In addition, only if dummy mode, a key event is sent for the new text and the
- * current editable buffer cleared.
- * deleteSurroundingText: The default implementation performs the deletion around the current
- * selection position of the editable text.
- * getCursorCapsMode: 1. The default implementation uses TextUtils.getCapsMode to get the
- * cursor caps mode for the current selection position in the editable text.
- * TextUtils.getCapsMode is tested fully in TextUtilsTest#testGetCapsMode.
- * 2. In dummy mode in which case 0 is always returned.
- * getTextBeforeCursor, getTextAfterCursor: The default implementation performs the deletion
- * around the current selection position of the editable text.
- * setSelection: changes the selection position in the current editable text.
- */
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "BaseInputConnection",
- args = {View.class, boolean.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "clearMetaKeyStates",
- args = {int.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "commitText",
- args = {CharSequence.class, int.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "deleteSurroundingText",
- args = {int.class, int.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getCursorCapsMode",
- args = {int.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getEditable",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setSelection",
- args = {int.class, int.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getTextAfterCursor",
- args = {int.class, int.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getTextBeforeCursor",
- args = {int.class, int.class}
- )
- })
- public void testOpTextMethods() {
- // return is an default Editable instance with empty source
- final Editable text = mConnection.getEditable();
- assertNotNull(text);
- assertEquals(0, text.length());
-
- // Test commitText, not dummy mode
- CharSequence str = "TestCommit ";
- Editable inputText = Editable.Factory.getInstance().newEditable(str);
- mConnection.commitText(inputText, inputText.length());
- final Editable text2 = mConnection.getEditable();
- int strLength = str.length();
- assertEquals(strLength, text2.length());
- assertEquals(str.toString(), text2.toString());
- assertEquals(TextUtils.CAP_MODE_WORDS,
- mConnection.getCursorCapsMode(TextUtils.CAP_MODE_WORDS));
- int offLength = 3;
- CharSequence expected = str.subSequence(strLength - offLength, strLength);
- assertEquals(expected.toString(), mConnection.getTextBeforeCursor(offLength,
- BaseInputConnection.GET_TEXT_WITH_STYLES).toString());
- mConnection.setSelection(0, 0);
- expected = str.subSequence(0, offLength);
- assertEquals(expected.toString(), mConnection.getTextAfterCursor(offLength,
- BaseInputConnection.GET_TEXT_WITH_STYLES).toString());
-
- // dummy mode
- BaseInputConnection dummyConnection = new BaseInputConnection(mView, false);
- dummyConnection.commitText(inputText, inputText.length());
- new DelayedCheck() {
- @Override
- protected boolean check() {
- return text2.toString().equals(mView.getText().toString());
- }
- }.run();
- assertEquals(0, dummyConnection.getCursorCapsMode(TextUtils.CAP_MODE_WORDS));
-
- // Test deleteSurroudingText
- int end = text2.length();
- mConnection.setSelection(end, end);
- // Delete the ending space
- assertTrue(mConnection.deleteSurroundingText(1, 2));
- Editable text3 = mConnection.getEditable();
- assertEquals(strLength - 1, text3.length());
- String expectedDelString = "TestCommit";
- assertEquals(expectedDelString, text3.toString());
- }
-
- /**
- * finishComposingText: 1. The default implementation removes the composing state from the
- * current editable text.
- * 2. In addition, only if dummy mode, a key event is sent for the new
- * text and the current editable buffer cleared.
- * setComposingText: The default implementation places the given text into the editable,
- * replacing any existing composing text
- */
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "finishComposingText",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setComposingText",
- args = {CharSequence.class, int.class}
- )
- })
- public void testFinishComposingText() {
- CharSequence str = "TestFinish";
- Editable inputText = Editable.Factory.getInstance().newEditable(str);
- mConnection.commitText(inputText, inputText.length());
- final Editable text = mConnection.getEditable();
- // Test finishComposingText, not dummy mode
- BaseInputConnection.setComposingSpans(text);
- assertTrue(BaseInputConnection.getComposingSpanStart(text) > -1);
- assertTrue(BaseInputConnection.getComposingSpanEnd(text) > -1);
- mConnection.finishComposingText();
- assertTrue(BaseInputConnection.getComposingSpanStart(text) == -1);
- assertTrue(BaseInputConnection.getComposingSpanEnd(text) == -1);
- // dummy mode
- BaseInputConnection dummyConnection = new BaseInputConnection(mView, false);
- dummyConnection.setComposingText(str, str.length());
- dummyConnection.finishComposingText();
- new DelayedCheck() {
- @Override
- protected boolean check() {
- return text.toString().equals(mView.getText().toString());
- }
- }.run();
- }
-
- /**
- * Provides standard implementation for sending a key event to the window
- * attached to the input connection's view
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "sendKeyEvent",
- args = {KeyEvent.class}
- )
- public void testSendKeyEvent() {
- mConnection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_Q));
- new DelayedCheck() {
- @Override
- protected boolean check() {
- return "q".equals(mView.getText().toString());
- }
- }.run();
- }
-
- /**
- * Updates InputMethodManager with the current fullscreen mode.
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "reportFullscreenMode",
- args = {boolean.class}
- )
- public void testReportFullscreenMode() {
- InputMethodManager imManager = (InputMethodManager) mInstrumentation.getTargetContext()
- .getSystemService(Context.INPUT_METHOD_SERVICE);
- assertFalse(imManager.isFullscreenMode());
- mConnection.reportFullscreenMode(true);
- assertTrue(imManager.isFullscreenMode());
- }
-}
diff --git a/tests/tests/view/src/android/view/inputmethod/cts/CompletionInfoTest.java b/tests/tests/view/src/android/view/inputmethod/cts/CompletionInfoTest.java
deleted file mode 100644
index ba4358f..0000000
--- a/tests/tests/view/src/android/view/inputmethod/cts/CompletionInfoTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2009 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.view.inputmethod.cts;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
-import android.os.Parcel;
-import android.test.AndroidTestCase;
-import android.view.inputmethod.CompletionInfo;
-
-@TestTargetClass(CompletionInfo.class)
-public class CompletionInfoTest extends AndroidTestCase {
- private static final int ID = 1;
- private static final int POSITION = 1;
- private static final String TEXT = "CompletionInfoText";
- private static final String LABEL = "CompletionInfoLabel";
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "describeContents",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "writeToParcel",
- args = {Parcel.class, int.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "CompletionInfo",
- args = {long.class, int.class, CharSequence.class, CharSequence.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "CompletionInfo",
- args = {long.class, int.class, CharSequence.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getId",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getPosition",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getText",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getLabel",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "toString",
- args = {}
- )
- })
- public void testCompletionInfo() {
- new CompletionInfo(ID, POSITION, TEXT);
- CompletionInfo info = new CompletionInfo(ID, POSITION, TEXT, LABEL);
- assertCompletionInfo(info);
-
- assertEquals(0, info.describeContents());
- assertNotNull(info.toString());
-
- Parcel p = Parcel.obtain();
- info.writeToParcel(p, 0);
- p.setDataPosition(0);
- CompletionInfo targetInfo = CompletionInfo.CREATOR.createFromParcel(p);
- p.recycle();
- assertCompletionInfo(targetInfo);
- }
-
- private void assertCompletionInfo(CompletionInfo info) {
- assertEquals(ID, info.getId());
- assertEquals(POSITION, info.getPosition());
- assertEquals(TEXT, info.getText().toString());
- assertEquals(LABEL, info.getLabel().toString());
- }
-}
diff --git a/tests/tests/view/src/android/view/inputmethod/cts/EditorInfoTest.java b/tests/tests/view/src/android/view/inputmethod/cts/EditorInfoTest.java
deleted file mode 100644
index cd28b3f..0000000
--- a/tests/tests/view/src/android/view/inputmethod/cts/EditorInfoTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2009 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.view.inputmethod.cts;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
-import android.os.Bundle;
-import android.os.Parcel;
-import android.test.AndroidTestCase;
-import android.text.TextUtils;
-import android.util.Printer;
-import android.view.inputmethod.EditorInfo;
-
-
-@TestTargetClass(EditorInfo.class)
-public class EditorInfoTest extends AndroidTestCase {
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "describeContents",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "writeToParcel",
- args = {Parcel.class, int.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "dump",
- args = {Printer.class, String.class}
- )
- })
- public void testEditorInfo() {
- EditorInfo info = new EditorInfo();
-
- info.actionId = 1;
- info.actionLabel = "actionLabel";
- info.fieldId = 2;
- info.fieldName = "fieldName";
- info.hintText = "hintText";
- info.imeOptions = EditorInfo.IME_FLAG_NO_ENTER_ACTION;
- info.initialCapsMode = TextUtils.CAP_MODE_CHARACTERS;
- info.initialSelEnd = 10;
- info.initialSelStart = 0;
- info.inputType = EditorInfo.TYPE_MASK_CLASS;
- info.label = "label";
- info.packageName = "com.android.cts.stub";
- info.privateImeOptions = "privateIme";
- Bundle b = new Bundle();
- String key = "bundleKey";
- String value = "bundleValue";
- b.putString(key, value);
- info.extras = b;
-
- assertEquals(0, info.describeContents());
-
- Parcel p = Parcel.obtain();
- info.writeToParcel(p, 0);
- p.setDataPosition(0);
- EditorInfo targetInfo = EditorInfo.CREATOR.createFromParcel(p);
- p.recycle();
- assertEquals(info.actionId, targetInfo.actionId);
- assertEquals(info.fieldId, targetInfo.fieldId);
- assertEquals(info.fieldName, targetInfo.fieldName);
- assertEquals(info.imeOptions, targetInfo.imeOptions);
- assertEquals(info.initialCapsMode, targetInfo.initialCapsMode);
- assertEquals(info.initialSelEnd, targetInfo.initialSelEnd);
- assertEquals(info.initialSelStart, targetInfo.initialSelStart);
- assertEquals(info.inputType, targetInfo.inputType);
- assertEquals(info.packageName, targetInfo.packageName);
- assertEquals(info.privateImeOptions, targetInfo.privateImeOptions);
- assertEquals(info.hintText.toString(), targetInfo.hintText.toString());
- assertEquals(info.actionLabel.toString(), targetInfo.actionLabel.toString());
- assertEquals(info.label.toString(), targetInfo.label.toString());
- assertEquals(info.extras.getString(key), targetInfo.extras.getString(key));
-
- TestPrinter printer = new TestPrinter();
- String prefix = "TestEditorInfo";
- info.dump(printer, prefix);
- assertTrue(printer.isPrintlnCalled);
- }
-
- private class TestPrinter implements Printer {
- public boolean isPrintlnCalled;
- public void println(String x) {
- isPrintlnCalled = true;
- }
- }
-}
diff --git a/tests/tests/view/src/android/view/inputmethod/cts/ExtractedTextRequestTest.java b/tests/tests/view/src/android/view/inputmethod/cts/ExtractedTextRequestTest.java
deleted file mode 100644
index 0f0a987..0000000
--- a/tests/tests/view/src/android/view/inputmethod/cts/ExtractedTextRequestTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2009 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.view.inputmethod.cts;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
-import android.os.Parcel;
-import android.test.AndroidTestCase;
-import android.view.inputmethod.ExtractedTextRequest;
-
-@TestTargetClass(ExtractedTextRequest.class)
-public class ExtractedTextRequestTest extends AndroidTestCase {
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "describeContents",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "writeToParcel",
- args = {Parcel.class, int.class}
- )
- })
- public void testExtractedTextRequest() {
- ExtractedTextRequest request = new ExtractedTextRequest();
- request.flags = 1;
- request.hintMaxChars = 100;
- request.hintMaxLines = 10;
- request.token = 2;
-
- assertEquals(0, request.describeContents());
-
- Parcel p = Parcel.obtain();
- request.writeToParcel(p, 0);
- p.setDataPosition(0);
- ExtractedTextRequest target = ExtractedTextRequest.CREATOR.createFromParcel(p);
- p.recycle();
- assertEquals(request.flags, target.flags);
- assertEquals(request.hintMaxChars, request.hintMaxChars);
- assertEquals(request.hintMaxLines, target.hintMaxLines);
- assertEquals(request.token, target.token);
- }
-}
diff --git a/tests/tests/view/src/android/view/inputmethod/cts/ExtractedTextTest.java b/tests/tests/view/src/android/view/inputmethod/cts/ExtractedTextTest.java
deleted file mode 100644
index c115902..0000000
--- a/tests/tests/view/src/android/view/inputmethod/cts/ExtractedTextTest.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 android.view.inputmethod.cts;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
-import android.os.Parcel;
-import android.test.AndroidTestCase;
-import android.view.inputmethod.ExtractedText;
-
-@TestTargetClass(ExtractedText.class)
-public class ExtractedTextTest extends AndroidTestCase {
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "describeContents",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "writeToParcel",
- args = {android.os.Parcel.class, int.class}
- )
- })
- public void testWriteToParcel() {
-
- ExtractedText extractedText = new ExtractedText();
- extractedText.flags = 1;
- extractedText.selectionEnd = 11;
- extractedText.selectionStart = 2;
- extractedText.startOffset = 1;
- CharSequence text = "test";
- extractedText.text = text;
- Parcel p = Parcel.obtain();
- extractedText.writeToParcel(p, 0);
- p.setDataPosition(0);
- ExtractedText target = ExtractedText.CREATOR.createFromParcel(p);
- assertEquals(extractedText.flags, target.flags);
- assertEquals(extractedText.selectionEnd, target.selectionEnd);
- assertEquals(extractedText.selectionStart, target.selectionStart);
- assertEquals(extractedText.startOffset, target.startOffset);
- assertEquals(extractedText.partialStartOffset, target.partialStartOffset);
- assertEquals(extractedText.partialEndOffset, target.partialEndOffset);
- assertEquals(extractedText.text.toString(), target.text.toString());
-
- assertEquals(0, extractedText.describeContents());
- }
-}
diff --git a/tests/tests/view/src/android/view/inputmethod/cts/InputBindingTest.java b/tests/tests/view/src/android/view/inputmethod/cts/InputBindingTest.java
deleted file mode 100644
index 8e0102e..0000000
--- a/tests/tests/view/src/android/view/inputmethod/cts/InputBindingTest.java
+++ /dev/null
@@ -1,107 +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.view.inputmethod.cts;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
-import android.os.Binder;
-import android.os.Parcel;
-import android.test.AndroidTestCase;
-import android.view.View;
-import android.view.inputmethod.BaseInputConnection;
-import android.view.inputmethod.InputBinding;
-
-@TestTargetClass(InputBinding.class)
-public class InputBindingTest extends AndroidTestCase {
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "describeContents",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getConnection",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getConnectionToken",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getPid",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getUid",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "InputBinding",
- args = {android.view.inputmethod.InputConnection.class,
- android.view.inputmethod.InputBinding.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "InputBinding",
- args = {android.view.inputmethod.InputConnection.class, android.os.IBinder.class,
- int.class, int.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "toString",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "writeToParcel",
- args = {android.os.Parcel.class, int.class}
- )
- })
- public void testInputBinding() {
- View view = new View(getContext());
- BaseInputConnection bic = new BaseInputConnection(view, false);
- Binder binder = new Binder();
- int uid = 1;
- int pid = 2;
- InputBinding inputBinding = new InputBinding(bic, binder, uid, pid);
- new InputBinding(bic, inputBinding);
- assertSame(bic, inputBinding.getConnection());
- assertSame(binder, inputBinding.getConnectionToken());
- assertEquals(uid, inputBinding.getUid());
- assertEquals(pid, inputBinding.getPid());
-
- assertNotNull(inputBinding.toString());
- assertEquals(0, inputBinding.describeContents());
-
- Parcel p = Parcel.obtain();
- inputBinding.writeToParcel(p, 0);
- p.setDataPosition(0);
- InputBinding target = InputBinding.CREATOR.createFromParcel(p);
- assertEquals(uid, target.getUid());
- assertEquals(pid, target.getPid());
- assertSame(binder, target.getConnectionToken());
- }
-}
diff --git a/tests/tests/view/src/android/view/inputmethod/cts/InputConnectionWrapperTest.java b/tests/tests/view/src/android/view/inputmethod/cts/InputConnectionWrapperTest.java
deleted file mode 100644
index 896e99f..0000000
--- a/tests/tests/view/src/android/view/inputmethod/cts/InputConnectionWrapperTest.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * Copyright (C) 2009 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.view.inputmethod.cts;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
-import android.os.Bundle;
-import android.test.AndroidTestCase;
-import android.text.TextUtils;
-import android.view.KeyEvent;
-import android.view.inputmethod.CompletionInfo;
-import android.view.inputmethod.EditorInfo;
-import android.view.inputmethod.ExtractedText;
-import android.view.inputmethod.ExtractedTextRequest;
-import android.view.inputmethod.InputConnection;
-import android.view.inputmethod.InputConnectionWrapper;
-
-@TestTargetClass(InputConnectionWrapper.class)
-public class InputConnectionWrapperTest extends AndroidTestCase {
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "InputConnectionWrapper",
- args = {InputConnection.class, boolean.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setTarget",
- args = {InputConnection.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "beginBatchEdit",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "commitCompletion",
- args = {CompletionInfo.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "endBatchEdit",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getExtractedText",
- args = {ExtractedTextRequest.class, int.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "performContextMenuAction",
- args = {int.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "performEditorAction",
- args = {int.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "performPrivateCommand",
- args = {String.class, Bundle.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setSelection",
- args = {int.class, int.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getTextAfterCursor",
- args = {int.class, int.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getTextBeforeCursor",
- args = {int.class, int.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getCursorCapsMode",
- args = {int.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "clearMetaKeyStates",
- args = {int.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "commitText",
- args = {CharSequence.class, int.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "deleteSurroundingText",
- args = {int.class, int.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "finishComposingText",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setComposingText",
- args = {CharSequence.class, int.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "sendKeyEvent",
- args = {KeyEvent.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "reportFullscreenMode",
- args = {boolean.class}
- )
- })
- public void testInputConnectionWrapper() {
- MockInputConnection inputConnection = new MockInputConnection();
- InputConnectionWrapper wrapper = new InputConnectionWrapper(null, true);
- try {
- wrapper.beginBatchEdit();
- fail("Failed to throw NullPointerException!");
- } catch (NullPointerException e) {
- // expected
- }
- wrapper.setTarget(inputConnection);
-
- wrapper.beginBatchEdit();
- assertTrue(inputConnection.isBeginBatchEditCalled);
- wrapper.clearMetaKeyStates(KeyEvent.META_ALT_ON);
- assertTrue(inputConnection.isClearMetaKeyStatesCalled);
- wrapper.commitCompletion(new CompletionInfo(1, 1, "testText"));
- assertTrue(inputConnection.isCommitCompletionCalled);
- wrapper.commitText("Text", 1);
- assertTrue(inputConnection.isCommitTextCalled);
- wrapper.deleteSurroundingText(10, 100);
- assertTrue(inputConnection.isDeleteSurroundingTextCalled);
- wrapper.endBatchEdit();
- assertTrue(inputConnection.isEndBatchEditCalled);
- wrapper.finishComposingText();
- assertTrue(inputConnection.isFinishComposingTextCalled);
- wrapper.getCursorCapsMode(TextUtils.CAP_MODE_CHARACTERS);
- assertTrue(inputConnection.isGetCursorCapsModeCalled);
- wrapper.getExtractedText(new ExtractedTextRequest(), 0);
- assertTrue(inputConnection.isGetExtractedTextCalled);
- wrapper.getTextAfterCursor(5, 0);
- assertTrue(inputConnection.isGetTextAfterCursorCalled);
- wrapper.getTextBeforeCursor(3, 0);
- assertTrue(inputConnection.isGetTextBeforeCursorCalled);
- wrapper.performContextMenuAction(1);
- assertTrue(inputConnection.isPerformContextMenuActionCalled);
- wrapper.performEditorAction(EditorInfo.IME_ACTION_GO);
- assertTrue(inputConnection.isPerformEditorActionCalled);
- wrapper.performPrivateCommand("com.android.action.MAIN", new Bundle());
- assertTrue(inputConnection.isPerformPrivateCommandCalled);
- wrapper.reportFullscreenMode(true);
- assertTrue(inputConnection.isReportFullscreenModeCalled);
- wrapper.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_0));
- assertTrue(inputConnection.isSendKeyEventCalled);
- wrapper.setComposingText("Text", 1);
- assertTrue(inputConnection.isSetComposingTextCalled);
- wrapper.setSelection(0, 10);
- assertTrue(inputConnection.isSetSelectionCalled);
- }
-
- private class MockInputConnection implements InputConnection {
- public boolean isBeginBatchEditCalled;
- public boolean isClearMetaKeyStatesCalled;
- public boolean isCommitCompletionCalled;
- public boolean isCommitTextCalled;
- public boolean isDeleteSurroundingTextCalled;
- public boolean isEndBatchEditCalled;
- public boolean isFinishComposingTextCalled;
- public boolean isGetCursorCapsModeCalled;
- public boolean isGetExtractedTextCalled;
- public boolean isGetTextAfterCursorCalled;
- public boolean isGetTextBeforeCursorCalled;
- public boolean isPerformContextMenuActionCalled;
- public boolean isPerformEditorActionCalled;
- public boolean isPerformPrivateCommandCalled;
- public boolean isReportFullscreenModeCalled;
- public boolean isSendKeyEventCalled;
- public boolean isSetComposingTextCalled;
- public boolean isSetSelectionCalled;
-
- public boolean beginBatchEdit() {
- isBeginBatchEditCalled = true;
- return false;
- }
-
- public boolean clearMetaKeyStates(int states) {
- isClearMetaKeyStatesCalled = true;
- return false;
- }
-
- public boolean commitCompletion(CompletionInfo text) {
- isCommitCompletionCalled = true;
- return false;
- }
-
- public boolean commitText(CharSequence text, int newCursorPosition) {
- isCommitTextCalled = true;
- return false;
- }
-
- public boolean deleteSurroundingText(int leftLength, int rightLength) {
- isDeleteSurroundingTextCalled = true;
- return false;
- }
-
- public boolean endBatchEdit() {
- isEndBatchEditCalled = true;
- return false;
- }
-
- public boolean finishComposingText() {
- isFinishComposingTextCalled = true;
- return false;
- }
-
- public int getCursorCapsMode(int reqModes) {
- isGetCursorCapsModeCalled = true;
- return 0;
- }
-
- public ExtractedText getExtractedText(ExtractedTextRequest request, int flags) {
- isGetExtractedTextCalled = true;
- return null;
- }
-
- public CharSequence getTextAfterCursor(int n, int flags) {
- isGetTextAfterCursorCalled = true;
- return null;
- }
-
- public CharSequence getTextBeforeCursor(int n, int flags) {
- isGetTextBeforeCursorCalled = true;
- return null;
- }
-
- public boolean performContextMenuAction(int id) {
- isPerformContextMenuActionCalled = true;
- return false;
- }
-
- public boolean performEditorAction(int editorAction) {
- isPerformEditorActionCalled = true;
- return false;
- }
-
- public boolean performPrivateCommand(String action, Bundle data) {
- isPerformPrivateCommandCalled = true;
- return false;
- }
-
- public boolean reportFullscreenMode(boolean enabled) {
- isReportFullscreenModeCalled = true;
- return false;
- }
-
- public boolean sendKeyEvent(KeyEvent event) {
- isSendKeyEventCalled = true;
- return false;
- }
-
- public boolean setComposingText(CharSequence text, int newCursorPosition) {
- isSetComposingTextCalled = true;
- return false;
- }
-
- public boolean setSelection(int start, int end) {
- isSetSelectionCalled = true;
- return false;
- }
- }
-}
diff --git a/tests/tests/view/src/android/view/inputmethod/cts/InputMethodInfoTest.java b/tests/tests/view/src/android/view/inputmethod/cts/InputMethodInfoTest.java
deleted file mode 100644
index 35a5a44..0000000
--- a/tests/tests/view/src/android/view/inputmethod/cts/InputMethodInfoTest.java
+++ /dev/null
@@ -1,226 +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.view.inputmethod.cts;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
-import android.content.ComponentName;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.content.pm.ServiceInfo;
-import android.os.Parcel;
-import android.test.AndroidTestCase;
-import android.util.Printer;
-import android.view.inputmethod.InputMethod;
-import android.view.inputmethod.InputMethodInfo;
-
-import org.xmlpull.v1.XmlPullParserException;
-
-import java.io.IOException;
-import java.util.List;
-
-@TestTargetClass(InputMethodInfo.class)
-public class InputMethodInfoTest extends AndroidTestCase {
- private InputMethodInfo mInputMethodInfo;
- private String mPackageName;
- private String mClassName;
- private CharSequence mLabel;
- private String mSettingsActivity;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mPackageName = mContext.getPackageName();
- mClassName = InputMethodInfoStub.class.getName();
- mLabel = "test";
- mSettingsActivity = "android.view.inputmethod.cts.InputMethodInfoStub";
- mInputMethodInfo = new InputMethodInfo(mPackageName, mClassName, mLabel, mSettingsActivity);
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "describeContents",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getComponent",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getId",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Can't make sure how to make the default id non-0",
- method = "getIsDefaultResourceId",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getPackageName",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getServiceInfo",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getServiceName",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getSettingsActivity",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "loadIcon",
- args = {android.content.pm.PackageManager.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "InputMethodInfo",
- args = {android.content.Context.class, android.content.pm.ResolveInfo.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "InputMethodInfo",
- args = {java.lang.String.class, java.lang.String.class, java.lang.CharSequence.class,
- java.lang.String.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "toString",
- args = {}
- )
- })
- public void testInputMethodInfoProperties() throws XmlPullParserException, IOException {
- assertEquals(0, mInputMethodInfo.describeContents());
- assertNotNull(mInputMethodInfo.toString());
-
- assertInfo(mInputMethodInfo);
- assertEquals(0, mInputMethodInfo.getIsDefaultResourceId());
-
- Intent intent = new Intent(InputMethod.SERVICE_INTERFACE);
- intent.setClass(mContext, InputMethodInfoStub.class);
- PackageManager pm = mContext.getPackageManager();
- List<ResolveInfo> ris = pm.queryIntentServices(intent, PackageManager.GET_META_DATA);
- for (int i = 0; i < ris.size(); i++) {
- ResolveInfo resolveInfo = ris.get(i);
- mInputMethodInfo = new InputMethodInfo(mContext, resolveInfo);
- assertService(resolveInfo.serviceInfo, mInputMethodInfo.getServiceInfo());
- assertInfo(mInputMethodInfo);
- }
- }
-
- private void assertService(ServiceInfo expected, ServiceInfo actual) {
- assertEquals(expected.getIconResource(), actual.getIconResource());
- assertEquals(expected.labelRes, actual.labelRes);
- assertEquals(expected.nonLocalizedLabel, actual.nonLocalizedLabel);
- assertEquals(expected.icon, actual.icon);
- assertEquals(expected.permission, actual.permission);
- }
-
- private void assertInfo(InputMethodInfo info) {
- assertEquals(mPackageName, info.getPackageName());
- assertEquals(mSettingsActivity, info.getSettingsActivity());
- ComponentName component = info.getComponent();
- assertEquals(mClassName, component.getClassName());
- String expectedId = component.flattenToShortString();
- assertEquals(expectedId, info.getId());
- assertEquals(mClassName, info.getServiceName());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "dump",
- args = {android.util.Printer.class, java.lang.String.class}
- )
- public void testDump() {
- MockPrinter printer = new MockPrinter();
- String prefix = "test";
- mInputMethodInfo.dump(printer, prefix);
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "loadIcon",
- args = {android.content.pm.PackageManager.class}
- )
- public void testLoadIcon() {
- PackageManager pm = mContext.getPackageManager();
- assertNotNull(mInputMethodInfo.loadIcon(pm));
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "equals",
- args = {java.lang.Object.class}
- )
- public void testEquals() {
- InputMethodInfo inputMethodInfo = new InputMethodInfo(mPackageName, mClassName, mLabel,
- mSettingsActivity);
- assertTrue(inputMethodInfo.equals(mInputMethodInfo));
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "loadLabel",
- args = {android.content.pm.PackageManager.class}
- )
- public void testLoadLabel() {
- CharSequence expected = "test";
- PackageManager pm = mContext.getPackageManager();
- assertEquals(expected.toString(), mInputMethodInfo.loadLabel(pm).toString());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "writeToParcel",
- args = {android.os.Parcel.class, int.class}
- )
- public void testWriteToParcel() {
- Parcel p = Parcel.obtain();
- mInputMethodInfo.writeToParcel(p, 0);
- p.setDataPosition(0);
- InputMethodInfo inputMethodInfo = InputMethodInfo.CREATOR.createFromParcel(p);
-
- assertEquals(mInputMethodInfo.getPackageName(), inputMethodInfo.getPackageName());
- assertEquals(mInputMethodInfo.getServiceName(), inputMethodInfo.getServiceName());
- assertEquals(mInputMethodInfo.getSettingsActivity(), inputMethodInfo.getSettingsActivity());
- assertEquals(mInputMethodInfo.getId(), inputMethodInfo.getId());
- assertEquals(mInputMethodInfo.getIsDefaultResourceId(), inputMethodInfo
- .getIsDefaultResourceId());
- assertService(mInputMethodInfo.getServiceInfo(), inputMethodInfo.getServiceInfo());
- }
-
- class MockPrinter implements Printer {
- public void println(String x) {
- }
- }
-}
diff --git a/tests/tests/view/src/android/view/inputmethod/cts/InputMethodManagerTest.java b/tests/tests/view/src/android/view/inputmethod/cts/InputMethodManagerTest.java
deleted file mode 100755
index d92f446..0000000
--- a/tests/tests/view/src/android/view/inputmethod/cts/InputMethodManagerTest.java
+++ /dev/null
@@ -1,200 +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.view.inputmethod.cts;
-
-import com.android.cts.stub.R;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
-import android.app.Instrumentation;
-import android.content.Context;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.ResultReceiver;
-import android.test.ActivityInstrumentationTestCase2;
-import android.test.UiThreadTest;
-import android.view.KeyEvent;
-import android.view.View;
-import android.view.Window;
-import android.view.inputmethod.BaseInputConnection;
-import android.view.inputmethod.InputMethodInfo;
-import android.view.inputmethod.InputMethodManager;
-import android.widget.EditText;
-
-import java.util.List;
-
-@TestTargetClass(InputMethodManager.class)
-public class InputMethodManagerTest
- extends ActivityInstrumentationTestCase2<InputMethodStubActivity> {
-
- public InputMethodManagerTest() {
- super("com.android.cts.stub", InputMethodStubActivity.class);
- }
-
- private InputMethodStubActivity mActivity;
- private Instrumentation mInstrumentation;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mActivity = getActivity();
- mInstrumentation = getInstrumentation();
- }
-
- @Override
- protected void tearDown() throws Exception {
- // Close soft input just in case.
- sendKeys(KeyEvent.KEYCODE_BACK);
- super.tearDown();
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- method = "hideSoftInputFromInputMethod",
- args = {IBinder.class, int.class}
- ),
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- method = "hideSoftInputFromWindow",
- args = {IBinder.class, int.class}
- ),
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- method = "hideSoftInputFromWindow",
- args = {IBinder.class, int.class, ResultReceiver.class}
- ),
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- method = "isAcceptingText",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- method = "isActive",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- method = "isActive",
- args = {View.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "isFullscreenMode",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "isWatchingCursor",
- args = {View.class}
- ),
- @TestTargetNew(
- level = TestLevel.NOT_FEASIBLE,
- method = "restartInput",
- args = {View.class}
- ),
- @TestTargetNew(
- level = TestLevel.SUFFICIENT,
- method = "getEnabledInputMethodList",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.SUFFICIENT,
- method = "getInputMethodList",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.SUFFICIENT,
- method = "setInputMethod",
- args = {IBinder.class, String.class}
- ),
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- method = "showSoftInput",
- args = {View.class, int.class}
- ),
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- method = "showSoftInput",
- args = {View.class, int.class, ResultReceiver.class}
- ),
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- method = "showSoftInputFromInputMethod",
- args = {IBinder.class, int.class}
- ),
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- method = "toggleSoftInputFromWindow",
- args = {IBinder.class, int.class, int.class}
- )
- })
- @UiThreadTest
- public void testInputMethodManager() {
- Window window = mActivity.getWindow();
- EditText view = (EditText) window.findViewById(R.id.entry);
-
- BaseInputConnection connection = new BaseInputConnection(view, false);
- Context context = mInstrumentation.getTargetContext();
- InputMethodManager imManager = (InputMethodManager) context
- .getSystemService(Context.INPUT_METHOD_SERVICE);
- assertTrue(imManager.isActive());
- assertTrue(imManager.isAcceptingText());
- assertTrue(imManager.isActive(view));
-
- connection.reportFullscreenMode(false);
- assertFalse(imManager.isFullscreenMode());
- connection.reportFullscreenMode(true);
- assertTrue(imManager.isFullscreenMode());
-
- // Currently can't set this status, always false.
- assertFalse(imManager.isWatchingCursor(view));
-
- IBinder token = view.getWindowToken();
-
- // Show and hide input method.
- assertTrue(imManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT));
- assertTrue(imManager.hideSoftInputFromWindow(token, 0));
-
- Handler handler = new Handler();
- ResultReceiver receiver = new ResultReceiver(handler);
- assertTrue(imManager.showSoftInput(view, 0, receiver));
- receiver = new ResultReceiver(handler);
- assertTrue(imManager.hideSoftInputFromWindow(token, 0, receiver));
-
- imManager.showSoftInputFromInputMethod(token, InputMethodManager.SHOW_FORCED);
- imManager.hideSoftInputFromInputMethod(token, InputMethodManager.HIDE_NOT_ALWAYS);
-
- // status: hide to show to hide
- imManager.toggleSoftInputFromWindow(token, 0, InputMethodManager.HIDE_NOT_ALWAYS);
- imManager.toggleSoftInputFromWindow(token, 0, InputMethodManager.HIDE_NOT_ALWAYS);
-
- List<InputMethodInfo> enabledImList = imManager.getEnabledInputMethodList();
- if (enabledImList != null && enabledImList.size() > 0) {
- imManager.setInputMethod(token, enabledImList.get(0).getId());
- // cannot test whether setting was successful
- }
-
- List<InputMethodInfo> imList = imManager.getInputMethodList();
- if (imList != null && enabledImList != null) {
- assertTrue(imList.size() >= enabledImList.size());
- }
- }
-}
diff --git a/tests/tests/webkit/src/android/webkit/cts/CookieSyncManagerTest.java b/tests/tests/webkit/src/android/webkit/cts/CookieSyncManagerTest.java
deleted file mode 100644
index 2f4c35a..0000000
--- a/tests/tests/webkit/src/android/webkit/cts/CookieSyncManagerTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2010 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.webkit.cts;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
-import android.content.Context;
-import android.test.ActivityInstrumentationTestCase2;
-import android.view.animation.cts.DelayedCheck;
-import android.webkit.CookieManager;
-import android.webkit.CookieSyncManager;
-
-@TestTargetClass(android.webkit.CookieSyncManager.class)
-public class CookieSyncManagerTest
- extends ActivityInstrumentationTestCase2<CookieSyncManagerStubActivity> {
-
- public CookieSyncManagerTest() {
- super("com.android.cts.stub", CookieSyncManagerStubActivity.class);
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "createInstance",
- args = {Context.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getInstance",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "sync",
- args = {}
- )
- })
- public void testCookieSyncManager() {
- CookieSyncManager csm1 = CookieSyncManager.createInstance(getActivity());
- assertNotNull(csm1);
-
- CookieSyncManager csm2 = CookieSyncManager.getInstance();
- assertNotNull(csm2);
-
- assertSame(csm1, csm2);
-
- final CookieManager cookieManager = CookieManager.getInstance();
- assertFalse(cookieManager.hasCookies());
-
- cookieManager.setAcceptCookie(true);
- assertTrue(cookieManager.acceptCookie());
-
- String cookieValue = "a = b";
- cookieManager.setCookie(TestHtmlConstants.HELLO_WORLD_URL, cookieValue);
- assertEquals(cookieValue, cookieManager.getCookie(TestHtmlConstants.HELLO_WORLD_URL));
-
- // Cookie is stored in RAM but not in the database.
- assertFalse(cookieManager.hasCookies());
-
- // Store the cookie to the database.
- csm1.sync();
- new DelayedCheck(10000) {
- @Override
- protected boolean check() {
- return cookieManager.hasCookies();
- }
- }.run();
-
- // Remove all cookies from the database.
- cookieManager.removeAllCookie();
- new DelayedCheck(10000) {
- @Override
- protected boolean check() {
- return !cookieManager.hasCookies();
- }
- }.run();
- }
-}
diff --git a/tests/tests/widget/src/android/widget/cts/AbsListViewTest.java b/tests/tests/widget/src/android/widget/cts/AbsListViewTest.java
index 0995f28..ffd57df 100644
--- a/tests/tests/widget/src/android/widget/cts/AbsListViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AbsListViewTest.java
@@ -504,16 +504,11 @@
setAdapter();
- View row = mListView.getChildAt(0);
- int rowHeight = row.getHeight();
- int middleOfSecondRow = rowHeight + rowHeight/2;
-
int position1 = mListView.pointToPosition(0, 0);
- int position2 = mListView.pointToPosition(50, middleOfSecondRow);
+ int position2 = mListView.pointToPosition(50, 200);
assertEquals(mAdapter_countries.getItemId(position1), mListView.pointToRowId(0, 0));
- assertEquals(mAdapter_countries.getItemId(position2),
- mListView.pointToRowId(50, middleOfSecondRow));
+ assertEquals(mAdapter_countries.getItemId(position2), mListView.pointToRowId(50, 200));
assertTrue(position2 > position1);
}
diff --git a/tests/tests/widget/src/android/widget/cts/DialerFilterTest.java b/tests/tests/widget/src/android/widget/cts/DialerFilterTest.java
index 0b436b2..76de651 100644
--- a/tests/tests/widget/src/android/widget/cts/DialerFilterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/DialerFilterTest.java
@@ -117,7 +117,7 @@
});
mInstrumentation.waitForIdleSync();
- mInstrumentation.sendStringSync("123");
+ sendKeys(KeyEvent.KEYCODE_1, KeyEvent.KEYCODE_2, KeyEvent.KEYCODE_3);
assertEquals("", mDialerFilter.getLetters().toString());
assertEquals("123", mDialerFilter.getDigits().toString());
@@ -129,7 +129,7 @@
});
mInstrumentation.waitForIdleSync();
- mInstrumentation.sendStringSync("adg");
+ sendKeys(KeyEvent.KEYCODE_A, KeyEvent.KEYCODE_D, KeyEvent.KEYCODE_G);
assertEquals("ADG", mDialerFilter.getLetters().toString());
assertEquals("", mDialerFilter.getDigits().toString());
@@ -141,7 +141,7 @@
});
mInstrumentation.waitForIdleSync();
- mInstrumentation.sendStringSync("adg");
+ sendKeys(KeyEvent.KEYCODE_A, KeyEvent.KEYCODE_D, KeyEvent.KEYCODE_G);
assertEquals("ADG", mDialerFilter.getLetters().toString());
// A, D, K may map to numbers on some keyboards. Don't test.
@@ -153,7 +153,7 @@
});
mInstrumentation.waitForIdleSync();
- mInstrumentation.sendStringSync("123");
+ sendKeys(KeyEvent.KEYCODE_1, KeyEvent.KEYCODE_2, KeyEvent.KEYCODE_3);
// 1, 2, 3 may map to letters on some keyboards. Don't test.
assertEquals("123", mDialerFilter.getDigits().toString());
}
diff --git a/tests/tests/widget/src/android/widget/cts/HorizontalScrollViewTest.java b/tests/tests/widget/src/android/widget/cts/HorizontalScrollViewTest.java
index 31b0b7b..d26b217 100644
--- a/tests/tests/widget/src/android/widget/cts/HorizontalScrollViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/HorizontalScrollViewTest.java
@@ -669,12 +669,10 @@
mScrollView.setSmoothScrollingEnabled(true);
assertEquals(0, mScrollView.getScrollX());
- final int velocityX = WidgetTestUtils.convertDipToPixels(getActivity(), 2000);
-
// fling towards right
runTestOnUiThread(new Runnable() {
public void run() {
- mScrollView.fling(velocityX);
+ mScrollView.fling(2000);
}
});
delayedCheckFling(0, true);
@@ -683,7 +681,7 @@
// fling towards left
runTestOnUiThread(new Runnable() {
public void run() {
- mScrollView.fling(-velocityX);
+ mScrollView.fling(-2000);
}
});
delayedCheckFling(currentX, false);
@@ -874,7 +872,7 @@
}
return mScrollView.getScrollX() < startPosition;
}
- }.run();
+ };
new DelayedCheck() {
private int mPreviousScrollX = mScrollView.getScrollX();
diff --git a/tests/tests/widget/src/android/widget/cts/ListViewTest.java b/tests/tests/widget/src/android/widget/cts/ListViewTest.java
index e7b872a..f283681 100644
--- a/tests/tests/widget/src/android/widget/cts/ListViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ListViewTest.java
@@ -61,7 +61,6 @@
private final String[] mNameList = new String[] {
"Jacky", "David", "Kevin", "Michael", "Andy"
};
- private final String[] mEmptyList = new String[0];
private ListView mListView;
private Activity mActivity;
@@ -69,7 +68,6 @@
private AttributeSet mAttributeSet;
private ArrayAdapter<String> mAdapter_countries;
private ArrayAdapter<String> mAdapter_names;
- private ArrayAdapter<String> mAdapter_empty;
public ListViewTest() {
super("com.android.cts.stub", ListViewStubActivity.class);
@@ -87,8 +85,6 @@
android.R.layout.simple_list_item_1, mCountryList);
mAdapter_names = new ArrayAdapter<String>(mActivity, android.R.layout.simple_list_item_1,
mNameList);
- mAdapter_empty = new ArrayAdapter<String>(mActivity, android.R.layout.simple_list_item_1,
- mEmptyList);
mListView = (ListView) mActivity.findViewById(R.id.listview_default);
}
@@ -151,22 +147,26 @@
)
})
public void testGetMaxScrollAmount() {
- setAdapter(mAdapter_empty);
- int scrollAmount = mListView.getMaxScrollAmount();
- assertEquals(0, scrollAmount);
-
- setAdapter(mAdapter_names);
- scrollAmount = mListView.getMaxScrollAmount();
- assertTrue(scrollAmount > 0);
- }
-
- private void setAdapter(final ArrayAdapter<String> adapter) {
mInstrumentation.runOnMainSync(new Runnable() {
public void run() {
- mListView.setAdapter(adapter);
+ mListView.setAdapter(mAdapter_countries);
}
});
mInstrumentation.waitForIdleSync();
+
+ int amount1 = mListView.getMaxScrollAmount();
+ assertTrue(amount1 > 0);
+
+ mInstrumentation.runOnMainSync(new Runnable() {
+ public void run() {
+ mListView.setAdapter(mAdapter_names);
+ }
+ });
+ mInstrumentation.waitForIdleSync();
+
+ int amount2 = mListView.getMaxScrollAmount();
+ assertTrue(amount2 > 0);
+ assertTrue(amount2 < amount1); // because NAMES list is shorter than COUNTRIES list
}
@TestTargets({
diff --git a/tests/tests/widget/src/android/widget/cts/TextViewTest.java b/tests/tests/widget/src/android/widget/cts/TextViewTest.java
index aad008c..5d95f86 100644
--- a/tests/tests/widget/src/android/widget/cts/TextViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TextViewTest.java
@@ -80,11 +80,8 @@
import android.util.TypedValue;
import android.view.ContextMenu;
import android.view.Gravity;
-import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.View;
-import android.view.ViewGroup;
-import android.view.WindowManager;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnCreateContextMenuListener;
import android.view.View.OnLongClickListener;
@@ -93,8 +90,6 @@
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.ExtractedText;
import android.view.inputmethod.ExtractedTextRequest;
-import android.widget.AbsoluteLayout;
-import android.widget.FrameLayout;
import android.widget.Scroller;
import android.widget.TextView;
import android.widget.TextView.BufferType;
@@ -252,19 +247,19 @@
assertEquals("", mTextView.getText().toString());
// press '-' key.
- mInstrumentation.sendStringSync("-");
+ sendKeys(KeyEvent.KEYCODE_MINUS);
assertEquals("", mTextView.getText().toString());
// press '1' key.
- mInstrumentation.sendStringSync("1");
+ sendKeys(KeyEvent.KEYCODE_1);
assertEquals("1", mTextView.getText().toString());
// press '.' key.
- mInstrumentation.sendStringSync(".");
+ sendKeys(KeyEvent.KEYCODE_PERIOD);
assertEquals("1", mTextView.getText().toString());
// press 'a' key.
- mInstrumentation.sendStringSync("a");
+ sendKeys(KeyEvent.KEYCODE_A);
assertEquals("1", mTextView.getText().toString());
final QwertyKeyListener qwertyKeyListener
@@ -280,8 +275,7 @@
assertEquals("1", mTextView.getText().toString());
// press 'a' key.
- mInstrumentation.sendStringSync("a");
-
+ sendKeys(KeyEvent.KEYCODE_A);
assertEquals("1a", mTextView.getText().toString());
}
@@ -1799,13 +1793,13 @@
assertEquals(errorText, mTextView.getError().toString());
- mInstrumentation.sendStringSync("a");
+ sendKeys(KeyEvent.KEYCODE_A);
// a key event that will not change the TextView's text
assertEquals("", mTextView.getText().toString());
// The icon and error message will not be reset to null
assertNotNull(mTextView.getError());
- mInstrumentation.sendStringSync("1");
+ sendKeys(KeyEvent.KEYCODE_1);
// a key event cause changes to the TextView's text
assertEquals("1", mTextView.getText().toString());
// the error message and icon will be cleared.
@@ -1846,13 +1840,13 @@
assertSame(expected, mTextView.getFilters());
- mInstrumentation.sendStringSync("a");
+ sendKeys(KeyEvent.KEYCODE_A);
// the text is capitalized by InputFilter.AllCaps
assertEquals("A", mTextView.getText().toString());
- mInstrumentation.sendStringSync("b");
+ sendKeys(KeyEvent.KEYCODE_B);
// the text is capitalized by InputFilter.AllCaps
assertEquals("AB", mTextView.getText().toString());
- mInstrumentation.sendStringSync("c");
+ sendKeys(KeyEvent.KEYCODE_C);
// 'C' could not be accepted, because there is a length filter.
assertEquals("AB", mTextView.getText().toString());
@@ -2030,9 +2024,9 @@
});
mInstrumentation.waitForIdleSync();
- mInstrumentation.sendStringSync("a");
+ sendKeys(KeyEvent.KEYCODE_A);
assertEquals("a", mTextView.getText().toString());
- mInstrumentation.sendStringSync("b");
+ sendKeys(KeyEvent.KEYCODE_B);
assertEquals("ab", mTextView.getText().toString());
sendKeys(KeyEvent.KEYCODE_DEL);
assertEquals("a", mTextView.getText().toString());
@@ -3335,23 +3329,17 @@
args = {boolean.class}
)
})
-
public void testMarquee() {
final MockTextView textView = new MockTextView(mActivity);
textView.setText(LONG_TEXT);
textView.setSingleLine();
textView.setEllipsize(TruncateAt.MARQUEE);
- textView.setLayoutParams(new ViewGroup.LayoutParams(100, 100));
-
- final FrameLayout layout = new FrameLayout(mActivity);
- layout.addView(textView);
-
// make the fading to be shown
textView.setHorizontalFadingEdgeEnabled(true);
mActivity.runOnUiThread(new Runnable() {
public void run() {
- mActivity.setContentView(layout);
+ mActivity.setContentView(textView);
}
});
mInstrumentation.waitForIdleSync();
diff --git a/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java b/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java
index a54ee4c..d360c40 100644
--- a/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java
+++ b/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java
@@ -20,28 +20,14 @@
import android.app.Instrumentation;
import android.content.Context;
import android.content.Intent;
-import android.content.pm.FeatureInfo;
-import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
-import android.util.Log;
import android.view.Display;
import android.view.WindowManager;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
public class DeviceInfoInstrument extends Instrumentation {
-
- private static final String TAG = "DeviceInfoInstrument";
-
- private static final String PROCESSES = "processes";
- private static final String FEATURES = "features";
private static final String PHONE_NUMBER = "phoneNumber";
public static final String LOCALES = "locales";
private static final String IMSI = "imsi";
@@ -136,14 +122,6 @@
String phoneNumber = tm.getLine1Number();
addResult(PHONE_NUMBER, phoneNumber);
- // features
- String features = getFeatures();
- addResult(FEATURES, features);
-
- // processes
- String processes = getProcesses();
- addResult(PROCESSES, processes);
-
finish(Activity.RESULT_OK, mResults);
}
@@ -176,84 +154,4 @@
private void addResult(final String key, final float value){
mResults.putFloat(key, value);
}
-
- /**
- * Return a summary of the device's feature as a semi-colon-delimited list of colon separated
- * name and availability pairs like "feature1:sdk:true;feature2:sdk:false;feature3:other:true;".
- */
- private String getFeatures() {
- StringBuilder features = new StringBuilder();
-
- try {
- Set<String> checkedFeatures = new HashSet<String>();
-
- PackageManager packageManager = getContext().getPackageManager();
- for (String featureName : getPackageManagerFeatures()) {
- checkedFeatures.add(featureName);
- boolean hasFeature = packageManager.hasSystemFeature(featureName);
- addFeature(features, featureName, "sdk", hasFeature);
- }
-
- FeatureInfo[] featureInfos = packageManager.getSystemAvailableFeatures();
- if (featureInfos != null) {
- for (FeatureInfo featureInfo : featureInfos) {
- if (featureInfo.name != null && !checkedFeatures.contains(featureInfo.name)) {
- addFeature(features, featureInfo.name, "other", true);
- }
- }
- }
- } catch (Exception exception) {
- Log.e(TAG, "Error getting features: " + exception.getMessage(), exception);
- }
-
- return features.toString();
- }
-
- private static void addFeature(StringBuilder features, String name, String type,
- boolean available) {
- features.append(name).append(':').append(type).append(':').append(available).append(';');
- }
-
- /**
- * Use reflection to get the features defined by the SDK. If there are features that do not fit
- * the convention of starting with "FEATURE_" then they will still be shown under the
- * "Other Features" section.
- *
- * @return list of feature names from sdk
- */
- private List<String> getPackageManagerFeatures() {
- try {
- List<String> features = new ArrayList<String>();
- Field[] fields = PackageManager.class.getFields();
- for (Field field : fields) {
- if (field.getName().startsWith("FEATURE_")) {
- String feature = (String) field.get(null);
- features.add(feature);
- }
- }
- return features;
- } catch (IllegalAccessException illegalAccess) {
- throw new RuntimeException(illegalAccess);
- }
- }
-
- /**
- * Return a semi-colon-delimited list of the root processes that were running on the phone
- * or an error message.
- */
- private static String getProcesses() {
- StringBuilder builder = new StringBuilder();
-
- try {
- String[] rootProcesses = RootProcessScanner.getRootProcesses();
- for (String rootProcess : rootProcesses) {
- builder.append(rootProcess).append(';');
- }
- } catch (Exception exception) {
- Log.e(TAG, "Error getting processes: " + exception.getMessage(), exception);
- builder.append(exception.getMessage());
- }
-
- return builder.toString();
- }
}
diff --git a/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/RootProcessScanner.java b/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/RootProcessScanner.java
deleted file mode 100644
index 4763287..0000000
--- a/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/RootProcessScanner.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Copyright (C) 2010 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.tests.getinfo;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Scanner;
-import java.util.regex.Pattern;
-
-/** Crawls /proc to find processes that are running as root. */
-class RootProcessScanner {
-
- /** Processes that are allowed to run as root. */
- private static final Pattern ROOT_PROCESS_WHITELIST_PATTERN = getRootProcessWhitelistPattern(
- "debuggerd",
- "init",
- "installd",
- "servicemanager",
- "vold",
- "zygote"
- );
-
- /** Combine the individual patterns into one super pattern. */
- private static Pattern getRootProcessWhitelistPattern(String... patterns) {
- StringBuilder rootProcessPattern = new StringBuilder();
- for (int i = 0; i < patterns.length; i++) {
- rootProcessPattern.append(patterns[i]);
- if (i + 1 < patterns.length) {
- rootProcessPattern.append('|');
- }
- }
- return Pattern.compile(rootProcessPattern.toString());
- }
-
- /** Test that there are no unapproved root processes running on the system. */
- public static String[] getRootProcesses()
- throws FileNotFoundException, MalformedStatMException {
- List<File> rootProcessDirs = getRootProcessDirs();
- String[] rootProcessNames = new String[rootProcessDirs.size()];
- for (int i = 0; i < rootProcessNames.length; i++) {
- rootProcessNames[i] = getProcessName(rootProcessDirs.get(i));
- }
- return rootProcessNames;
- }
-
- private static List<File> getRootProcessDirs()
- throws FileNotFoundException, MalformedStatMException {
- File proc = new File("/proc");
- if (!proc.exists()) {
- throw new FileNotFoundException(proc + " is missing (man 5 proc)");
- }
-
- List<File> rootProcesses = new ArrayList<File>();
- File[] processDirs = proc.listFiles();
- if (processDirs != null && processDirs.length > 0) {
- for (File processDir : processDirs) {
- if (isUnapprovedRootProcess(processDir)) {
- rootProcesses.add(processDir);
- }
- }
- }
- return rootProcesses;
- }
-
- /**
- * Filters out processes in /proc that are not approved.
- * @throws FileNotFoundException
- * @throws MalformedStatMException
- */
- private static boolean isUnapprovedRootProcess(File pathname)
- throws FileNotFoundException, MalformedStatMException {
- return isPidDirectory(pathname)
- && !isKernelProcess(pathname)
- && isRootProcess(pathname);
- }
-
- private static boolean isPidDirectory(File pathname) {
- return pathname.isDirectory() && Pattern.matches("\\d+", pathname.getName());
- }
-
- private static boolean isKernelProcess(File processDir)
- throws FileNotFoundException, MalformedStatMException {
- File statm = getProcessStatM(processDir);
- Scanner scanner = null;
- try {
- scanner = new Scanner(statm);
-
- boolean allZero = true;
- for (int i = 0; i < 7; i++) {
- if (scanner.nextInt() != 0) {
- allZero = false;
- }
- }
-
- if (scanner.hasNext()) {
- throw new MalformedStatMException(processDir
- + " statm expected to have 7 integers (man 5 proc)");
- }
-
- return allZero;
- } finally {
- if (scanner != null) {
- scanner.close();
- }
- }
- }
-
- private static File getProcessStatM(File processDir) {
- return new File(processDir, "statm");
- }
-
- public static class MalformedStatMException extends Exception {
- MalformedStatMException(String detailMessage) {
- super(detailMessage);
- }
- }
-
- /**
- * Return whether or not this process is running as root without being approved.
- *
- * @param processDir with the status file
- * @return whether or not it is a unwhitelisted root process
- * @throws FileNotFoundException
- */
- private static boolean isRootProcess(File processDir) throws FileNotFoundException {
- File status = getProcessStatus(processDir);
- Scanner scanner = null;
- try {
- scanner = new Scanner(status);
-
- scanner = findToken(scanner, "Name:");
- String name = scanner.next();
-
- scanner = findToken(scanner, "Uid:");
- boolean rootUid = hasRootId(scanner);
-
- scanner = findToken(scanner, "Gid:");
- boolean rootGid = hasRootId(scanner);
-
- return !ROOT_PROCESS_WHITELIST_PATTERN.matcher(name).matches()
- && (rootUid || rootGid);
- } finally {
- if (scanner != null) {
- scanner.close();
- }
- }
- }
-
- /**
- * Get the status {@link File} that has name:value pairs.
- * <pre>
- * Name: init
- * ...
- * Uid: 0 0 0 0
- * Gid: 0 0 0 0
- * </pre>
- */
- private static File getProcessStatus(File processDir) {
- return new File(processDir, "status");
- }
-
- /**
- * Convenience method to move the scanner's position to the point after the given token.
- *
- * @param scanner to call next() until the token is found
- * @param token to find like "Name:"
- * @return scanner after finding token
- */
- private static Scanner findToken(Scanner scanner, String token) {
- while (true) {
- String next = scanner.next();
- if (next.equals(token)) {
- return scanner;
- }
- }
-
- // Scanner will exhaust input and throw an exception before getting here.
- }
-
- /**
- * Uid and Gid lines have four values: "Uid: 0 0 0 0"
- *
- * @param scanner that has just processed the "Uid:" or "Gid:" token
- * @return whether or not any of the ids are root
- */
- private static boolean hasRootId(Scanner scanner) {
- int realUid = scanner.nextInt();
- int effectiveUid = scanner.nextInt();
- int savedSetUid = scanner.nextInt();
- int fileSystemUid = scanner.nextInt();
- return realUid == 0 || effectiveUid == 0 || savedSetUid == 0 || fileSystemUid == 0;
- }
-
- /** Returns the name of the process corresponding to its process directory in /proc. */
- private static String getProcessName(File processDir) throws FileNotFoundException {
- File status = getProcessStatus(processDir);
- Scanner scanner = new Scanner(status);
- try {
- scanner = findToken(scanner, "Name:");
- return scanner.next();
- } finally {
- scanner.close();
- }
- }
-}
diff --git a/tools/host/src/com/android/cts/ConsoleUi.java b/tools/host/src/com/android/cts/ConsoleUi.java
index 679ecc0..27173a4 100644
--- a/tools/host/src/com/android/cts/ConsoleUi.java
+++ b/tools/host/src/com/android/cts/ConsoleUi.java
@@ -970,7 +970,7 @@
* @param resultType The result type.
*/
private void createPlanFromSession(final String name, TestSession ts, final String resultType)
- throws FileNotFoundException, IOException, ParserConfigurationException,
+ throws FileNotFoundException, ParserConfigurationException,
TransformerFactoryConfigurationError, TransformerException {
HashMap<String, ArrayList<String>> selectedResult =
diff --git a/tools/host/src/com/android/cts/TestDevice.java b/tools/host/src/com/android/cts/TestDevice.java
index 690742d..e384824 100644
--- a/tools/host/src/com/android/cts/TestDevice.java
+++ b/tools/host/src/com/android/cts/TestDevice.java
@@ -418,8 +418,6 @@
public static final String IMEI = "imei";
public static final String IMSI = "imsi";
public static final String PHONE_NUMBER = "phoneNumber";
- public static final String FEATURES = "features";
- public static final String PROCESSES = "processes";
private HashMap<String, String> mInfoMap;
@@ -787,24 +785,6 @@
public String getPhoneNumber() {
return mInfoMap.get(PHONE_NUMBER);
}
-
- /**
- * Get features.
- *
- * @return Features.
- */
- public String getFeatures() {
- return mInfoMap.get(FEATURES);
- }
-
- /**
- * Get processes.
- *
- * @return Processes.
- */
- public String getProcesses() {
- return mInfoMap.get(PROCESSES);
- }
}
/**
diff --git a/tools/host/src/com/android/cts/TestSessionBuilder.java b/tools/host/src/com/android/cts/TestSessionBuilder.java
index b4e69f1..c592476 100644
--- a/tools/host/src/com/android/cts/TestSessionBuilder.java
+++ b/tools/host/src/com/android/cts/TestSessionBuilder.java
@@ -544,7 +544,7 @@
*/
public void serialize(String planName,
ArrayList<String> packageNames, HashMap<String, ArrayList<String>> selectedResult)
- throws ParserConfigurationException, FileNotFoundException, IOException,
+ throws ParserConfigurationException, FileNotFoundException,
TransformerFactoryConfigurationError, TransformerException {
File plan = new File(HostConfig.getInstance().getPlanRepository()
.getPlanPath(planName));
diff --git a/tools/host/src/com/android/cts/TestSessionLog.java b/tools/host/src/com/android/cts/TestSessionLog.java
index b37e5a2..f874cae 100644
--- a/tools/host/src/com/android/cts/TestSessionLog.java
+++ b/tools/host/src/com/android/cts/TestSessionLog.java
@@ -69,9 +69,6 @@
static final String ATTRIBUTE_BUILD_NAME = "buildName";
static final String ATTRIBUTE_ARCH = "arch";
static final String ATTRIBUTE_VALUE = "value";
- static final String ATTRIBUTE_AVAILABLE = "available";
- static final String ATTRIBUTE_TYPE = "type";
- static final String ATTRIBUTE_UID = "uid";
static final String ATTRIBUTE_PASS = "pass";
static final String ATTRIBUTE_FAILED = "failed";
@@ -87,10 +84,6 @@
static final String TAG_SUMMARY = "Summary";
static final String TAG_SCREEN = "Screen";
static final String TAG_BUILD_INFO = "BuildInfo";
- static final String TAG_FEATURE_INFO = "FeatureInfo";
- static final String TAG_FEATURE = "Feature";
- static final String TAG_PROCESS_INFO = "ProcessInfo";
- static final String TAG_PROCESS = "Process";
static final String TAG_PHONE_SUB_INFO = "PhoneSubInfo";
static final String TAG_TEST_RESULT = "TestResult";
static final String TAG_TESTPACKAGE = "TestPackage";
@@ -334,9 +327,6 @@
DeviceParameterCollector.BUILD_ABI2, bldInfo.getBuildAbi2());
deviceSettingNode.appendChild(devInfoNode);
-
- addFeatureInfo(doc, deviceSettingNode, bldInfo);
- addProcessInfo(doc, deviceSettingNode, bldInfo);
}
Node hostInfo = doc.createElement(TAG_HOSTINFO);
@@ -403,86 +393,6 @@
}
/**
- * Creates a {@link #TAG_FEATURE_INFO} tag with {@link #TAG_FEATURE} elements indicating
- * what features are supported by the device. It parses a string from the deviceInfo argument
- * that is in the form of "feature1:true;feature2:false;featuer3;true;" with a trailing
- * semi-colon.
- *
- * <pre>
- * <FeatureInfo>
- * <Feature name="android.name.of.feature" available="true" />
- * ...
- * </FeatureInfo>
- * </pre>
- * @param document used to create elements
- * @param parentNode to attach the FeatureInfo element to
- * @param deviceInfo to get the feature data from
- */
- private void addFeatureInfo(Document document, Node parentNode,
- DeviceParameterCollector deviceInfo) {
- Node featureInfo = document.createElement(TAG_FEATURE_INFO);
- parentNode.appendChild(featureInfo);
-
- String features = deviceInfo.getFeatures();
- if (features == null) {
- features = "";
- }
-
- String[] featurePairs = features.split(";");
- for (String featurePair : featurePairs) {
- String[] nameTypeAvailability = featurePair.split(":");
- if (nameTypeAvailability.length >= 3) {
- Node feature = document.createElement(TAG_FEATURE);
- featureInfo.appendChild(feature);
-
- setAttribute(document, feature, ATTRIBUTE_NAME, nameTypeAvailability[0]);
- setAttribute(document, feature, ATTRIBUTE_TYPE, nameTypeAvailability[1]);
- setAttribute(document, feature, ATTRIBUTE_AVAILABLE, nameTypeAvailability[2]);
- }
- }
- }
-
- /**
- * Creates a {@link #TAG_PROCESS_INFO} tag with {@link #TAG_PROCESS} elements indicating
- * what particular processes of interest were running on the device. It parses a string from
- * the deviceInfo argument that is in the form of "processName1;processName2;..." with a
- * trailing semi-colon.
- *
- * <pre>
- * <ProcessInfo>
- * <Process name="long_cat_viewer" uid="0" />
- * ...
- * </ProcessInfo>
- * </pre>
- *
- * @param document
- * @param parentNode
- * @param deviceInfo
- */
- private void addProcessInfo(Document document, Node parentNode,
- DeviceParameterCollector deviceInfo) {
- Node processInfo = document.createElement(TAG_PROCESS_INFO);
- parentNode.appendChild(processInfo);
-
- String rootProcesses = deviceInfo.getProcesses();
- if (rootProcesses == null) {
- rootProcesses = "";
- }
-
- String[] processNames = rootProcesses.split(";");
- for (String processName : processNames) {
- processName = processName.trim();
- if (processName.length() > 0) {
- Node process = document.createElement(TAG_PROCESS);
- processInfo.appendChild(process);
-
- setAttribute(document, process, ATTRIBUTE_NAME, processName);
- setAttribute(document, process, ATTRIBUTE_UID, "0");
- }
- }
- }
-
- /**
* Output TestSuite and result to XML DOM Document.
*
* @param doc The document.
@@ -533,7 +443,7 @@
testNode.appendChild(failedMessageNode);
setAttribute(doc, failedMessageNode,TAG_FAILED_MESSAGE, failedMessage);
- String stackTrace = sanitizeStackTrace(result.getStackTrace());
+ String stackTrace = result.getStackTrace();
if (stackTrace != null) {
Node stackTraceNode = doc.createElement(TAG_STACK_TRACE);
failedMessageNode.appendChild(stackTraceNode);
@@ -552,18 +462,6 @@
}
/**
- * Strip out any invalid XML characters that might cause the report to be unviewable.
- * http://www.w3.org/TR/REC-xml/#dt-character
- */
- private static String sanitizeStackTrace(String trace) {
- if (trace != null) {
- return trace.replaceAll("[^\\u0009\\u000A\\u000D\\u0020-\\uD7FF\\uE000-\\uFFFD]", "");
- } else {
- return null;
- }
- }
-
- /**
* Fetch failed file name and line number
*
* @param failedResult failed message
diff --git a/tools/host/src/com/android/cts/XMLResourceHandler.java b/tools/host/src/com/android/cts/XMLResourceHandler.java
index f44a574..f77b27b 100644
--- a/tools/host/src/com/android/cts/XMLResourceHandler.java
+++ b/tools/host/src/com/android/cts/XMLResourceHandler.java
@@ -18,7 +18,6 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
-import java.io.IOException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
@@ -126,16 +125,11 @@
* @param doc DOM Document
*/
protected static void writeToFile(File file, Document doc) throws FileNotFoundException,
- IOException, TransformerFactoryConfigurationError, TransformerException {
+ TransformerFactoryConfigurationError, TransformerException {
Transformer t = TransformerFactory.newInstance().newTransformer();
// enable indent in result file
t.setOutputProperty("indent", "yes");
- FileOutputStream fos = new FileOutputStream(file);
- try {
- StreamResult sr = new StreamResult(fos);
- t.transform(new DOMSource(doc), sr);
- } finally {
- fos.close();
- }
+ t.transform(new DOMSource(doc),
+ new StreamResult(new FileOutputStream(file)));
}
}
diff --git a/tools/host/src/res/cts_result.css b/tools/host/src/res/cts_result.css
index b5b4009..869c4dd 100644
--- a/tools/host/src/res/cts_result.css
+++ b/tools/host/src/res/cts_result.css
@@ -66,7 +66,6 @@
border-color: gray;
border-style: inset;
font-size:1em;
- vertical-align: top;
}
#summaryinfo table {
@@ -80,7 +79,6 @@
#summaryinfo td {
padding:1px;
border-width: 0px 0px 0px 0px;
- vertical-align: top;
}
/* The test summary */
diff --git a/tools/host/src/res/cts_result.xsl b/tools/host/src/res/cts_result.xsl
index 72b0f86..8f5f77c 100644
--- a/tools/host/src/res/cts_result.xsl
+++ b/tools/host/src/res/cts_result.xsl
@@ -116,9 +116,7 @@
<TR>
<TD class="rowtitle">Supported Locales</TD>
<TD>
- <xsl:call-template name="formatDelimitedString">
- <xsl:with-param name="string" select="TestResult/DeviceInfo/BuildInfo/@locales"/>
- </xsl:call-template>
+ <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@locales"/>
</TD>
</TR>
<TR>
@@ -181,46 +179,6 @@
<xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@imsi"/>
</TD>
</TR>
- <TR>
- <TD class="rowtitle">Features</TD>
- <TD>
- <xsl:for-each select="TestResult/DeviceInfo/FeatureInfo/Feature[@type='sdk']">
- <xsl:text>[</xsl:text>
- <xsl:choose>
- <xsl:when test="@available = 'true'">
- <xsl:text>X</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>_</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text>] </xsl:text>
-
- <xsl:value-of select="@name" />
- <br />
- </xsl:for-each>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Other Features</TD>
- <TD>
- <UL>
- <xsl:for-each select="TestResult/DeviceInfo/FeatureInfo/Feature[@type='other']">
- <LI><xsl:value-of select="@name" /></LI>
- </xsl:for-each>
- </UL>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Root Processes</TD>
- <TD>
- <UL>
- <xsl:for-each select="TestResult/DeviceInfo/ProcessInfo/Process[@uid='0']">
- <LI><xsl:value-of select="@name" /></LI>
- </xsl:for-each>
- </UL>
- </TD>
- </TR>
</TABLE>
</div>
</TD>
@@ -459,31 +417,10 @@
</TABLE>
</xsl:for-each> <!-- end test package -->
</DIV>
- </body>
- </html>
- </xsl:template>
- <!-- Take a delimited string and insert line breaks after a some number of elements. -->
- <xsl:template name="formatDelimitedString">
- <xsl:param name="string" />
- <xsl:param name="numTokensPerRow" select="10" />
- <xsl:param name="tokenIndex" select="1" />
- <xsl:if test="$string">
- <!-- Requires the last element to also have a delimiter after it. -->
- <xsl:variable name="token" select="substring-before($string, ';')" />
- <xsl:value-of select="$token" />
- <xsl:text> </xsl:text>
-
- <xsl:if test="$tokenIndex mod $numTokensPerRow = 0">
- <br />
- </xsl:if>
+ </body>
+ </html>
+</xsl:template>
- <xsl:call-template name="formatDelimitedString">
- <xsl:with-param name="string" select="substring-after($string, ';')" />
- <xsl:with-param name="numTokensPerRow" select="$numTokensPerRow" />
- <xsl:with-param name="tokenIndex" select="$tokenIndex + 1" />
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
</xsl:stylesheet>
diff --git a/tools/utils/buildCts.py b/tools/utils/buildCts.py
index b1a6700..b3e9183 100755
--- a/tools/utils/buildCts.py
+++ b/tools/utils/buildCts.py
@@ -121,7 +121,6 @@
"""Generate the test description for the signature check."""
self.__LogGenerateDescription('android.tests.sigtest')
package = tools.TestPackage('SignatureTest', 'android.tests.sigtest')
- package.AddAttribute('appNameSpace', 'android.tests.sigtest')
package.AddAttribute('signatureCheck', 'true')
package.AddAttribute('runner', '.InstrumentationRunner')
package.AddTest('android.tests.sigtest.SignatureTest.signatureTest')
@@ -133,7 +132,6 @@
"""Generate the test description for the reference app tests."""
self.__LogGenerateDescription('android.apidemos.cts')
package = tools.TestPackage('ApiDemosReferenceTest', 'android.apidemos.cts')
- package.AddAttribute('appNameSpace', 'android.apidemos.cts')
package.AddAttribute('packageToTest', 'com.example.android.apis')
package.AddAttribute('apkToTestName', 'ApiDemos')
package.AddAttribute('runner', 'android.test.InstrumentationTestRunner')