diff options
author | Brett Chabot <brettchabot@android.com> | 2010-03-25 13:49:26 -0700 |
---|---|---|
committer | Brett Chabot <brettchabot@android.com> | 2010-03-26 14:16:59 -0700 |
commit | a3de74555120cc4dc205a3f93ef44c843b8d64a8 (patch) | |
tree | 9f5d76cc13a03ba0161fda6bbb0208d4a69a69ca | |
parent | 092cfaaa22795b7e63f2e55ff9102a569ec17efe (diff) | |
download | frameworks_base-a3de74555120cc4dc205a3f93ef44c843b8d64a8.zip frameworks_base-a3de74555120cc4dc205a3f93ef44c843b8d64a8.tar.gz frameworks_base-a3de74555120cc4dc205a3f93ef44c843b8d64a8.tar.bz2 |
Move PackageManagerTests and AsecTests.
Remove PackageManagerTests test's from continuous due to flakiness.
merged from abandoned master.
Change-Id: I0a542df9df572c37bd1aa987cdc9fb2f95001a7c
-rw-r--r-- | core/tests/coretests/AndroidManifest.xml | 10 | ||||
-rw-r--r-- | core/tests/coretests/res/raw/install (renamed from tests/AndroidTests/res/raw/install) | bin | 40604 -> 40604 bytes | |||
-rw-r--r-- | core/tests/coretests/res/raw/install_decl_perm (renamed from tests/AndroidTests/res/raw/install_decl_perm) | bin | 2646 -> 2646 bytes | |||
-rw-r--r-- | core/tests/coretests/res/raw/install_loc_auto (renamed from tests/AndroidTests/res/raw/install_loc_auto) | bin | 329182 -> 329182 bytes | |||
-rw-r--r-- | core/tests/coretests/res/raw/install_loc_internal (renamed from tests/AndroidTests/res/raw/install_loc_internal) | bin | 329191 -> 329191 bytes | |||
-rw-r--r-- | core/tests/coretests/res/raw/install_loc_sdcard (renamed from tests/AndroidTests/res/raw/install_loc_sdcard) | bin | 329181 -> 329181 bytes | |||
-rw-r--r-- | core/tests/coretests/res/raw/install_loc_unspecified (renamed from tests/AndroidTests/res/raw/install_loc_unspecified) | bin | 329175 -> 329175 bytes | |||
-rw-r--r-- | core/tests/coretests/res/raw/install_use_perm_good (renamed from tests/AndroidTests/res/raw/install_use_perm_good) | bin | 2480 -> 2480 bytes | |||
-rwxr-xr-x | core/tests/coretests/src/android/content/pm/PackageManagerTests.java (renamed from tests/AndroidTests/src/com/android/unit_tests/PackageManagerTests.java) | 87 | ||||
-rwxr-xr-x | core/tests/coretests/src/android/os/storage/AsecTests.java (renamed from tests/AndroidTests/src/com/android/unit_tests/AsecTests.java) | 38 | ||||
-rw-r--r-- | core/tests/coretests/src/android/os/storage/StorageListener.java | 45 |
11 files changed, 76 insertions, 104 deletions
diff --git a/core/tests/coretests/AndroidManifest.xml b/core/tests/coretests/AndroidManifest.xml index 6a7c6ec..eb005ce 100644 --- a/core/tests/coretests/AndroidManifest.xml +++ b/core/tests/coretests/AndroidManifest.xml @@ -74,6 +74,16 @@ <!-- package manager test permissions --> <uses-permission android:name="android.permission.INSTALL_PACKAGES" /> <uses-permission android:name="android.permission.DELETE_PACKAGES" /> + <uses-permission android:name="android.permission.MOVE_PACKAGE" /> + + <!--os storage test permissions --> + <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> + <uses-permission android:name="android.permission.ASEC_ACCESS" /> + <uses-permission android:name="android.permission.ASEC_CREATE" /> + <uses-permission android:name="android.permission.ASEC_DESTROY" /> + <uses-permission android:name="android.permission.ASEC_MOUNT_UNMOUNT" /> + <uses-permission android:name="android.permission.ASEC_RENAME" /> + <uses-permission android:name="android.permission.SHUTDOWN" /> <application android:theme="@style/Theme"> <uses-library android:name="android.test.runner" /> diff --git a/tests/AndroidTests/res/raw/install b/core/tests/coretests/res/raw/install Binary files differindex 2ee1f3c..2ee1f3c 100644 --- a/tests/AndroidTests/res/raw/install +++ b/core/tests/coretests/res/raw/install diff --git a/tests/AndroidTests/res/raw/install_decl_perm b/core/tests/coretests/res/raw/install_decl_perm Binary files differindex 6f22321..6f22321 100644 --- a/tests/AndroidTests/res/raw/install_decl_perm +++ b/core/tests/coretests/res/raw/install_decl_perm diff --git a/tests/AndroidTests/res/raw/install_loc_auto b/core/tests/coretests/res/raw/install_loc_auto Binary files differindex d5d2739..d5d2739 100644 --- a/tests/AndroidTests/res/raw/install_loc_auto +++ b/core/tests/coretests/res/raw/install_loc_auto diff --git a/tests/AndroidTests/res/raw/install_loc_internal b/core/tests/coretests/res/raw/install_loc_internal Binary files differindex eb6279a..eb6279a 100644 --- a/tests/AndroidTests/res/raw/install_loc_internal +++ b/core/tests/coretests/res/raw/install_loc_internal diff --git a/tests/AndroidTests/res/raw/install_loc_sdcard b/core/tests/coretests/res/raw/install_loc_sdcard Binary files differindex c774989..c774989 100644 --- a/tests/AndroidTests/res/raw/install_loc_sdcard +++ b/core/tests/coretests/res/raw/install_loc_sdcard diff --git a/tests/AndroidTests/res/raw/install_loc_unspecified b/core/tests/coretests/res/raw/install_loc_unspecified Binary files differindex ab226c6..ab226c6 100644 --- a/tests/AndroidTests/res/raw/install_loc_unspecified +++ b/core/tests/coretests/res/raw/install_loc_unspecified diff --git a/tests/AndroidTests/res/raw/install_use_perm_good b/core/tests/coretests/res/raw/install_use_perm_good Binary files differindex d5216f8..d5216f8 100644 --- a/tests/AndroidTests/res/raw/install_use_perm_good +++ b/core/tests/coretests/res/raw/install_use_perm_good diff --git a/tests/AndroidTests/src/com/android/unit_tests/PackageManagerTests.java b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java index 449661c..7b9e95a 100755 --- a/tests/AndroidTests/src/com/android/unit_tests/PackageManagerTests.java +++ b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java @@ -14,61 +14,37 @@ * limitations under the License. */ -package com.android.unit_tests; +package android.content.pm; +import com.android.frameworks.coretests.R; import com.android.internal.content.PackageHelper; -import android.os.storage.IMountService.Stub; - -import android.net.Uri; -import android.os.FileUtils; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.content.pm.ApplicationInfo; -import android.content.pm.IPackageDataObserver; -import android.content.pm.IPackageInstallObserver; -import android.content.pm.IPackageDeleteObserver; -import android.content.pm.IPackageMoveObserver; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager; -import android.content.pm.PackageParser; -import android.content.pm.PackageStats; -import android.content.pm.IPackageManager; -import android.content.pm.PermissionInfo; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Resources; import android.content.res.Resources.NotFoundException; -import android.test.AndroidTestCase; -import android.test.suitebuilder.annotation.LargeTest; -import android.test.suitebuilder.annotation.MediumTest; -import android.test.suitebuilder.annotation.SmallTest; -import android.test.suitebuilder.annotation.Suppress; -import android.util.DisplayMetrics; -import android.util.Log; +import android.net.Uri; import android.os.Environment; -import android.os.Handler; +import android.os.FileUtils; import android.os.IBinder; -import android.os.storage.IMountService; -import android.os.storage.IMountServiceListener; -import android.os.storage.StorageEventListener; -import android.os.storage.StorageManager; -import android.os.storage.StorageResultCode; import android.os.RemoteException; import android.os.ServiceManager; import android.os.StatFs; +import android.os.storage.IMountService; +import android.os.storage.StorageListener; +import android.os.storage.StorageManager; +import android.os.storage.StorageResultCode; import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; +import android.test.AndroidTestCase; +import android.util.DisplayMetrics; +import android.util.Log; + +import java.io.File; +import java.io.InputStream; public class PackageManagerTests extends AndroidTestCase { private static final boolean localLOGV = true; @@ -573,17 +549,14 @@ public class PackageManagerTests extends AndroidTestCase { return ip; } - @MediumTest public void testInstallNormalInternal() { sampleInstallFromRawResource(0, true); } - @MediumTest public void testInstallFwdLockedInternal() { sampleInstallFromRawResource(PackageManager.INSTALL_FORWARD_LOCK, true); } - @MediumTest public void testInstallSdcard() { sampleInstallFromRawResource(PackageManager.INSTALL_EXTERNAL, true); } @@ -674,33 +647,27 @@ public class PackageManagerTests extends AndroidTestCase { } } - @MediumTest public void testReplaceFailNormalInternal() { replaceFromRawResource(0); } - @MediumTest public void testReplaceFailFwdLockedInternal() { replaceFromRawResource(PackageManager.INSTALL_FORWARD_LOCK); } - @MediumTest public void testReplaceFailSdcard() { replaceFromRawResource(PackageManager.INSTALL_EXTERNAL); } - @MediumTest public void testReplaceNormalInternal() { replaceFromRawResource(PackageManager.INSTALL_REPLACE_EXISTING); } - @MediumTest public void testReplaceFwdLockedInternal() { replaceFromRawResource(PackageManager.INSTALL_REPLACE_EXISTING | PackageManager.INSTALL_FORWARD_LOCK); } - @MediumTest public void testReplaceSdcard() { replaceFromRawResource(PackageManager.INSTALL_REPLACE_EXISTING | PackageManager.INSTALL_EXTERNAL); @@ -815,32 +782,26 @@ public class PackageManagerTests extends AndroidTestCase { } } - @MediumTest public void testDeleteNormalInternal() { deleteFromRawResource(0, 0); } - @MediumTest public void testDeleteFwdLockedInternal() { deleteFromRawResource(PackageManager.INSTALL_FORWARD_LOCK, 0); } - @MediumTest public void testDeleteSdcard() { deleteFromRawResource(PackageManager.INSTALL_EXTERNAL, 0); } - @MediumTest public void testDeleteNormalInternalRetainData() { deleteFromRawResource(0, PackageManager.DONT_DELETE_DATA); } - @MediumTest public void testDeleteFwdLockedInternalRetainData() { deleteFromRawResource(PackageManager.INSTALL_FORWARD_LOCK, PackageManager.DONT_DELETE_DATA); } - @MediumTest public void testDeleteSdcardRetainData() { deleteFromRawResource(PackageManager.INSTALL_EXTERNAL, PackageManager.DONT_DELETE_DATA); } @@ -947,27 +908,7 @@ public class PackageManagerTests extends AndroidTestCase { } } - class StorageListener extends StorageEventListener { - String oldState; - String newState; - String path; - private boolean doneFlag = false; - @Override - public void onStorageStateChanged(String path, String oldState, String newState) { - if (localLOGV) Log.i(TAG, "Storage state changed from " + oldState + " to " + newState); - synchronized (this) { - this.oldState = oldState; - this.newState = newState; - this.path = path; - doneFlag = true; - notifyAll(); - } - } - public boolean isDone() { - return doneFlag; - } - } private boolean unmountMedia() { if (!getMediaState()) { diff --git a/tests/AndroidTests/src/com/android/unit_tests/AsecTests.java b/core/tests/coretests/src/android/os/storage/AsecTests.java index 9a75047..dda3010 100755 --- a/tests/AndroidTests/src/com/android/unit_tests/AsecTests.java +++ b/core/tests/coretests/src/android/os/storage/AsecTests.java @@ -14,43 +14,19 @@ * limitations under the License. */ -package com.android.unit_tests; +package android.os.storage; -import com.android.unit_tests.PackageManagerTests.StorageListener; - -import android.os.storage.IMountService.Stub; - -import android.net.Uri; -import android.os.FileUtils; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import android.app.PendingIntent; -import android.content.BroadcastReceiver; import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.test.AndroidTestCase; -import android.test.suitebuilder.annotation.Suppress; -import android.util.DisplayMetrics; -import android.util.Log; import android.os.Environment; -import android.os.Handler; import android.os.IBinder; -import android.os.storage.IMountService; -import android.os.storage.IMountShutdownObserver; -import android.os.storage.StorageEventListener; -import android.os.storage.StorageManager; -import android.os.storage.StorageResultCode; import android.os.RemoteException; import android.os.ServiceManager; -import android.os.StatFs; -import android.provider.Settings; +import android.test.AndroidTestCase; +import android.util.Log; + +import java.io.File; +import java.io.FileOutputStream; + import junit.framework.Assert; public class AsecTests extends AndroidTestCase { diff --git a/core/tests/coretests/src/android/os/storage/StorageListener.java b/core/tests/coretests/src/android/os/storage/StorageListener.java new file mode 100644 index 0000000..d6dae22 --- /dev/null +++ b/core/tests/coretests/src/android/os/storage/StorageListener.java @@ -0,0 +1,45 @@ +/* + * 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.storage; + +import android.util.Log; + +public class StorageListener extends StorageEventListener { + private static final boolean localLOGV = true; + + public static final String TAG="StorageListener"; + + String oldState; + String newState; + String path; + private boolean doneFlag = false; + @Override + public void onStorageStateChanged(String path, String oldState, String newState) { + if (localLOGV) Log.i(TAG, "Storage state changed from " + oldState + " to " + newState); + synchronized (this) { + this.oldState = oldState; + this.newState = newState; + this.path = path; + doneFlag = true; + notifyAll(); + } + } + + public boolean isDone() { + return doneFlag; + } +} |