OSDN Git Service

Mark two test methods public so they can be mocked
authorHakan Seyalioglu <hseya@google.com>
Wed, 25 Jan 2017 18:48:44 +0000 (10:48 -0800)
committerHakan Seyalioglu <hseya@google.com>
Wed, 25 Jan 2017 18:51:53 +0000 (10:51 -0800)
Without this, the mocked version looks like it's calling
the default implementation (which immediately fails due to
a bunch of null fields) - with this it just returns null.

I would ultimately like to stop mocking out the controller
and instead use a mocked package manager (which there is
already some set up to do). But in the meanwhile, this at least
gets the test passing.

Test: Checked the test passes.

Change-Id: I92d1f2796cfce21bf55e927bd56690c582f41e91

core/java/com/android/internal/app/ResolverListController.java

index 00faf65..4071ff4 100644 (file)
@@ -69,14 +69,14 @@ public class ResolverListController {
     }
 
     @VisibleForTesting
-    ResolveInfo getLastChosen() throws RemoteException {
+    public ResolveInfo getLastChosen() throws RemoteException {
         return AppGlobals.getPackageManager().getLastChosenActivity(
                 mTargetIntent, mTargetIntent.resolveTypeIfNeeded(mContext.getContentResolver()),
                 PackageManager.MATCH_DEFAULT_ONLY);
     }
 
     @VisibleForTesting
-    void setLastChosen(Intent intent, IntentFilter filter, int match)
+    public void setLastChosen(Intent intent, IntentFilter filter, int match)
             throws RemoteException {
         AppGlobals.getPackageManager().setLastChosenActivity(intent,
                 intent.resolveType(mContext.getContentResolver()),