package android.text;
-import android.text.PackedIntVector;
import junit.framework.TestCase;
/**
# ============================================================
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))
--- /dev/null
+# 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)
+
--- /dev/null
+<?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>
boolean isLockPatternEnabled = true;
public boolean isPermanentlyLocked = false;
- public MockLockPatternUtils() {
- super(null);
+ public MockLockPatternUtils(Context context) {
+ super(context);
}
@Override
@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;
}
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() {
+++ /dev/null
-include $(call all-subdir-makefiles)
+++ /dev/null
-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.
+++ /dev/null
-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)
+++ /dev/null
-/*
- * 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;
- }
-}