OSDN Git Service

Move out all framework-tests classes.
authorBrett Chabot <brettchabot@android.com>
Tue, 15 Jun 2010 00:06:34 +0000 (17:06 -0700)
committerBrett Chabot <brettchabot@android.com>
Tue, 15 Jun 2010 00:23:08 +0000 (17:23 -0700)
Previously tests/framework-tests contained a quarantined set of test classes
that needed access to package-private framework api. Running these tests
normally would cause the dalvik verifier to throw errors.

runtest now has support for turning off the dalvik verifier for frameworks
tests, so move this tests into their recommended location, close to the source
being tested.

Also move policy source into a 'src' folder to accommodate the tests move.

Change-Id: I62f839da185a55bc553b653bf583fd99da438512

38 files changed:
core/tests/coretests/src/android/text/PackedIntVectorTest.java [moved from tests/framework-tests/src/android/text/PackedIntVectorTest.java with 99% similarity]
core/tests/coretests/src/com/android/internal/http/multipart/MultipartTest.java [moved from tests/framework-tests/src/com/android/internal/http/multipart/MultipartTest.java with 100% similarity]
core/tests/coretests/src/com/android/internal/os/LoggingPrintStreamTest.java [moved from tests/framework-tests/src/com/android/internal/os/LoggingPrintStreamTest.java with 100% similarity]
policy/Android.mk
policy/src/com/android/internal/policy/impl/AccountUnlockScreen.java [moved from policy/com/android/internal/policy/impl/AccountUnlockScreen.java with 100% similarity]
policy/src/com/android/internal/policy/impl/GlobalActions.java [moved from policy/com/android/internal/policy/impl/GlobalActions.java with 100% similarity]
policy/src/com/android/internal/policy/impl/IconUtilities.java [moved from policy/com/android/internal/policy/impl/IconUtilities.java with 100% similarity]
policy/src/com/android/internal/policy/impl/KeyguardScreen.java [moved from policy/com/android/internal/policy/impl/KeyguardScreen.java with 100% similarity]
policy/src/com/android/internal/policy/impl/KeyguardScreenCallback.java [moved from policy/com/android/internal/policy/impl/KeyguardScreenCallback.java with 100% similarity]
policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java [moved from policy/com/android/internal/policy/impl/KeyguardUpdateMonitor.java with 100% similarity]
policy/src/com/android/internal/policy/impl/KeyguardViewBase.java [moved from policy/com/android/internal/policy/impl/KeyguardViewBase.java with 100% similarity]
policy/src/com/android/internal/policy/impl/KeyguardViewCallback.java [moved from policy/com/android/internal/policy/impl/KeyguardViewCallback.java with 100% similarity]
policy/src/com/android/internal/policy/impl/KeyguardViewManager.java [moved from policy/com/android/internal/policy/impl/KeyguardViewManager.java with 100% similarity]
policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java [moved from policy/com/android/internal/policy/impl/KeyguardViewMediator.java with 100% similarity]
policy/src/com/android/internal/policy/impl/KeyguardViewProperties.java [moved from policy/com/android/internal/policy/impl/KeyguardViewProperties.java with 100% similarity]
policy/src/com/android/internal/policy/impl/KeyguardWindowController.java [moved from policy/com/android/internal/policy/impl/KeyguardWindowController.java with 100% similarity]
policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java [moved from policy/com/android/internal/policy/impl/LockPatternKeyguardView.java with 100% similarity]
policy/src/com/android/internal/policy/impl/LockPatternKeyguardViewProperties.java [moved from policy/com/android/internal/policy/impl/LockPatternKeyguardViewProperties.java with 100% similarity]
policy/src/com/android/internal/policy/impl/LockScreen.java [moved from policy/com/android/internal/policy/impl/LockScreen.java with 100% similarity]
policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java [moved from policy/com/android/internal/policy/impl/PasswordUnlockScreen.java with 100% similarity]
policy/src/com/android/internal/policy/impl/PatternUnlockScreen.java [moved from policy/com/android/internal/policy/impl/PatternUnlockScreen.java with 100% similarity]
policy/src/com/android/internal/policy/impl/PhoneLayoutInflater.java [moved from policy/com/android/internal/policy/impl/PhoneLayoutInflater.java with 100% similarity]
policy/src/com/android/internal/policy/impl/PhoneWindow.java [moved from policy/com/android/internal/policy/impl/PhoneWindow.java with 100% similarity]
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java [moved from policy/com/android/internal/policy/impl/PhoneWindowManager.java with 100% similarity]
policy/src/com/android/internal/policy/impl/Policy.java [moved from policy/com/android/internal/policy/impl/Policy.java with 100% similarity]
policy/src/com/android/internal/policy/impl/PowerDialog.java [moved from policy/com/android/internal/policy/impl/PowerDialog.java with 100% similarity]
policy/src/com/android/internal/policy/impl/RecentApplicationsBackground.java [moved from policy/com/android/internal/policy/impl/RecentApplicationsBackground.java with 100% similarity]
policy/src/com/android/internal/policy/impl/RecentApplicationsDialog.java [moved from policy/com/android/internal/policy/impl/RecentApplicationsDialog.java with 100% similarity]
policy/src/com/android/internal/policy/impl/ShortcutManager.java [moved from policy/com/android/internal/policy/impl/ShortcutManager.java with 100% similarity]
policy/src/com/android/internal/policy/impl/SimUnlockScreen.java [moved from policy/com/android/internal/policy/impl/SimUnlockScreen.java with 100% similarity]
policy/src/com/android/internal/policy/impl/package.html [moved from policy/com/android/internal/policy/impl/package.html with 100% similarity]
policy/tests/Android.mk [new file with mode: 0644]
policy/tests/AndroidManifest.xml [new file with mode: 0644]
policy/tests/src/com/android/internal/policy/impl/LockPatternKeyguardViewTest.java [moved from tests/framework-tests/src/com/android/internal/policy/impl/LockPatternKeyguardViewTest.java with 98% similarity]
tests/framework-tests/Android.mk [deleted file]
tests/framework-tests/README [deleted file]
tests/framework-tests/src/Android.mk [deleted file]
tests/framework-tests/src/android/test/FrameworkTests.java [deleted file]

index a887142..47d8fb8 100644 (file)
@@ -4,9 +4,11 @@ LOCAL_PATH:= $(call my-dir)
 # ============================================================
 include $(CLEAR_VARS)
 
-LOCAL_SRC_FILES := \
-            $(call all-subdir-java-files)
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
             
 LOCAL_MODULE := android.policy
 
 include $(BUILD_JAVA_LIBRARY)
+
+# additionally, build unit tests in a separate .apk
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/policy/tests/Android.mk b/policy/tests/Android.mk
new file mode 100644 (file)
index 0000000..ffb60b1
--- /dev/null
@@ -0,0 +1,29 @@
+# Copyright 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)
+
+# We only want this apk build for tests.
+LOCAL_MODULE_TAGS := tests
+
+LOCAL_JAVA_LIBRARIES := android.policy android.test.runner
+
+# Include all test java files.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := FrameworkPolicyTests
+
+include $(BUILD_PACKAGE)
+
diff --git a/policy/tests/AndroidManifest.xml b/policy/tests/AndroidManifest.xml
new file mode 100644 (file)
index 0000000..dbdabfa
--- /dev/null
@@ -0,0 +1,31 @@
+<?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.frameworks.policy.tests">
+
+    <application>
+        <uses-library android:name="android.test.runner" />
+    </application>
+
+    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
+    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
+    
+    <instrumentation
+        android:name="android.test.InstrumentationTestRunner"
+        android:targetPackage="com.android.frameworks.policy.tests"
+        android:label="Framework policy tests" />
+</manifest>
@@ -55,8 +55,8 @@ public class LockPatternKeyguardViewTest extends AndroidTestCase {
         boolean isLockPatternEnabled = true;
         public boolean isPermanentlyLocked = false;
 
-        public MockLockPatternUtils() {
-            super(null);
+        public MockLockPatternUtils(Context context) {
+            super(context);
         }
 
         @Override
@@ -149,7 +149,7 @@ public class LockPatternKeyguardViewTest extends AndroidTestCase {
         @Override
         View createUnlockScreenFor(UnlockMode unlockMode) {
             final MockKeyguardScreen newView = new MockKeyguardScreen(getContext());
-            if (mInjectedUnlockScreens == null)  mInjectedUnlockScreens = Lists.newArrayList();
+            if (mInjectedUnlockScreens == null) mInjectedUnlockScreens = Lists.newArrayList();
             mInjectedUnlockScreens.add(newView);
             return newView;
         }
@@ -197,7 +197,7 @@ public class LockPatternKeyguardViewTest extends AndroidTestCase {
     protected void setUp() throws Exception {
         super.setUp();
         mUpdateMonitor = new MockUpdateMonitor(getContext());
-        mLockPatternUtils = new MockLockPatternUtils();
+        mLockPatternUtils = new MockLockPatternUtils(getContext());
 
         mLPKV = new TestableLockPatternKeyguardView(getContext(), mUpdateMonitor,
                 mLockPatternUtils, new KeyguardWindowController() {
diff --git a/tests/framework-tests/Android.mk b/tests/framework-tests/Android.mk
deleted file mode 100644 (file)
index 5053e7d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-include $(call all-subdir-makefiles)
diff --git a/tests/framework-tests/README b/tests/framework-tests/README
deleted file mode 100644 (file)
index 7b46b25..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-This package contains tests which need to access package-private members in the framework code.
-To do this, the tests must be loaded in the same class loader as the classes which they are
-testing. This package is loaded in the boot classpath.
-
-Run these tests via AndroidTests -> FrameworkTests.
diff --git a/tests/framework-tests/src/Android.mk b/tests/framework-tests/src/Android.mk
deleted file mode 100644 (file)
index f537b52..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_MODULE := framework-tests
-
-LOCAL_JAVA_LIBRARIES := android.policy android.test.runner
-
-include $(BUILD_JAVA_LIBRARY)
diff --git a/tests/framework-tests/src/android/test/FrameworkTests.java b/tests/framework-tests/src/android/test/FrameworkTests.java
deleted file mode 100644 (file)
index cb3f493..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.test;
-
-import com.android.internal.os.LoggingPrintStreamTest;
-import junit.framework.TestSuite;
-import com.android.internal.http.multipart.MultipartTest;
-import com.android.internal.policy.impl.LockPatternKeyguardViewTest;
-
-/**
- * Tests that are loaded in the boot classpath along with the Android framework
- * classes. This enables you to access package-private members in the framework
- * classes; doing so is not possible when the test classes are loaded in an
- * application classloader.
- */
-public class FrameworkTests {
-    public static TestSuite suite() {
-        TestSuite suite = new TestSuite(FrameworkTests.class.getName());
-
-        suite.addTestSuite(MultipartTest.class);
-        suite.addTestSuite(LoggingPrintStreamTest.class);
-        suite.addTestSuite(LockPatternKeyguardViewTest.class);
-
-        return suite;
-    }
-}