diff options
author | Wu-cheng Li <wuchengli@google.com> | 2010-11-26 14:03:08 +0800 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2010-11-29 13:59:59 +0800 |
commit | 559f5cf9f42c4983eaef9e6e55ff3ba7c406426a (patch) | |
tree | a93bb107a8b5ca14ecce963a02ef5c452d5fb638 /tests/src/com/android/camera/functional | |
parent | 9b7bfbc8ac25f1df20b7ed0aa79bf1f36299e981 (diff) | |
download | LegacyCamera-559f5cf9f42c4983eaef9e6e55ff3ba7c406426a.zip LegacyCamera-559f5cf9f42c4983eaef9e6e55ff3ba7c406426a.tar.gz LegacyCamera-559f5cf9f42c4983eaef9e6e55ff3ba7c406426a.tar.bz2 |
Remove the hard-coded package name in camera tests.
bug:3210567
Change-Id: I4bdc012bc39cb15459cdd6e03164be7d88e492d3
Diffstat (limited to 'tests/src/com/android/camera/functional')
-rw-r--r-- | tests/src/com/android/camera/functional/CameraTest.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/src/com/android/camera/functional/CameraTest.java b/tests/src/com/android/camera/functional/CameraTest.java index bf0bb64..9d71301 100644 --- a/tests/src/com/android/camera/functional/CameraTest.java +++ b/tests/src/com/android/camera/functional/CameraTest.java @@ -1,5 +1,8 @@ package com.android.camera.functional; +import com.android.camera.Camera; +import com.android.camera.VideoCamera; + import android.app.Activity; import android.content.Intent; import android.net.Uri; @@ -16,14 +19,11 @@ import java.util.ArrayList; public class CameraTest extends InstrumentationTestCase { private static final String TAG = "CameraTest"; - private static final String CAMERA_PACKAGE = "com.google.android.camera"; - private static final String CAMERA_ACTIVITY = "com.android.camera.Camera"; - private static final String CAMCORDER_ACTIVITY = "com.android.camera.VideoCamera"; @LargeTest public void testVideoCaptureIntentFdLeak() throws Exception { Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); - intent.setClassName(CAMERA_PACKAGE, CAMCORDER_ACTIVITY); + intent.setClass(getInstrumentation().getTargetContext(), VideoCamera.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.parse("file://" + Environment.getExternalStorageDirectory().toString() @@ -37,15 +37,15 @@ public class CameraTest extends InstrumentationTestCase { @LargeTest public void testActivityLeak() throws Exception { - checkActivityLeak(CAMERA_ACTIVITY); - checkActivityLeak(CAMCORDER_ACTIVITY); + checkActivityLeak(Camera.class); + checkActivityLeak(VideoCamera.class); } - private void checkActivityLeak(String activityName) throws Exception { + private void checkActivityLeak(Class<?> cls) throws Exception { final int TEST_COUNT = 5; Intent intent = new Intent(); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - intent.setClassName(CAMERA_PACKAGE, activityName); + intent.setClass(getInstrumentation().getTargetContext(), cls); ArrayList<WeakReference<Activity>> refs = new ArrayList<WeakReference<Activity>>(); for (int i = 0; i < TEST_COUNT; i++) { |