summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclamy@chromium.org <clamy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-23 18:38:15 +0000
committerclamy@chromium.org <clamy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-23 18:38:15 +0000
commite05c1c7a8450d3ed825f00ea0739f67fb857dee4 (patch)
treec269116d6de1871973e84046a3eeb75a1429c796
parenteb0ea65427fdfb71bee0200e23a099efe60f3911 (diff)
downloadchromium_src-e05c1c7a8450d3ed825f00ea0739f67fb857dee4.zip
chromium_src-e05c1c7a8450d3ed825f00ea0739f67fb857dee4.tar.gz
chromium_src-e05c1c7a8450d3ed825f00ea0739f67fb857dee4.tar.bz2
Fix context problem in Android Sync test utilities
BUG=159203 Review URL: https://chromiumcodereview.appspot.com/12512016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190054 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--sync/test/android/javatests/src/org/chromium/sync/test/util/MockAccountManager.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/sync/test/android/javatests/src/org/chromium/sync/test/util/MockAccountManager.java b/sync/test/android/javatests/src/org/chromium/sync/test/util/MockAccountManager.java
index c92bad7..d293918 100644
--- a/sync/test/android/javatests/src/org/chromium/sync/test/util/MockAccountManager.java
+++ b/sync/test/android/javatests/src/org/chromium/sync/test/util/MockAccountManager.java
@@ -12,6 +12,7 @@ import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.app.Activity;
import android.content.BroadcastReceiver;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -70,6 +71,8 @@ public class MockAccountManager implements AccountManagerDelegate {
protected final Context mContext;
+ private final Context mTestContext;
+
private final Set<AccountHolder> mAccounts;
private final List<AccountAuthTokenPreparation> mAccountPermissionPreparations;
@@ -78,8 +81,11 @@ public class MockAccountManager implements AccountManagerDelegate {
private final SingleThreadedExecutor mExecutor;
- public MockAccountManager(Context context, Account... accounts) {
+ public MockAccountManager(Context context, Context testContext, Account... accounts) {
mContext = context;
+ // The manifest that is backing testContext needs to provide the
+ // MockGrantCredentialsPermissionActivity.
+ mTestContext = testContext;
mMainHandler = new Handler(mContext.getMainLooper());
mExecutor = new SingleThreadedExecutor();
mAccounts = new HashSet<AccountHolder>();
@@ -321,11 +327,11 @@ public class MockAccountManager implements AccountManagerDelegate {
}
}
- private static Intent newGrantCredentialsPermissionIntent(boolean hasActivity, Account account,
+ private Intent newGrantCredentialsPermissionIntent(boolean hasActivity, Account account,
String authTokenType) {
Intent intent = new Intent();
- intent.setClassName("org.chromium.sync.test.util",
- MockGrantCredentialsPermissionActivity.class.getCanonicalName());
+ intent.setComponent(new ComponentName(mTestContext,
+ MockGrantCredentialsPermissionActivity.class.getCanonicalName()));
intent.putExtra(MockGrantCredentialsPermissionActivity.ACCOUNT, account);
intent.putExtra(MockGrantCredentialsPermissionActivity.AUTH_TOKEN_TYPE, authTokenType);
if (!hasActivity) {