summaryrefslogtreecommitdiffstats
path: root/base/android/java
diff options
context:
space:
mode:
authordgn <dgn@chromium.org>2015-11-26 04:05:04 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-26 12:06:12 +0000
commit2a88ce48d75d70f24c210bcc0ae64b9314e65d78 (patch)
tree321bd1595c969dd36a6a82536080d5c8b06f6cfe /base/android/java
parent471ce1870263f6be21ea3f82af9d284d94838c60 (diff)
downloadchromium_src-2a88ce48d75d70f24c210bcc0ae64b9314e65d78.zip
chromium_src-2a88ce48d75d70f24c210bcc0ae64b9314e65d78.tar.gz
chromium_src-2a88ce48d75d70f24c210bcc0ae64b9314e65d78.tar.bz2
Make Android HttpNegotiateAuthenticator work without an activity
Fallback on the various alternatives to AccountManager#getAuthTokenByFeatures that don't require an activity when we don't have one. This will allow using this authenticator in WebView. BUG=533513 Review URL: https://codereview.chromium.org/1422693002 Cr-Commit-Position: refs/heads/master@{#361871}
Diffstat (limited to 'base/android/java')
-rw-r--r--base/android/java/src/org/chromium/base/ApplicationStatus.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/base/android/java/src/org/chromium/base/ApplicationStatus.java b/base/android/java/src/org/chromium/base/ApplicationStatus.java
index 9f77595..d6da142 100644
--- a/base/android/java/src/org/chromium/base/ApplicationStatus.java
+++ b/base/android/java/src/org/chromium/base/ApplicationStatus.java
@@ -393,6 +393,23 @@ public class ApplicationStatus {
}
/**
+ * Robolectric JUnit tests create a new application between each test, while all the context
+ * in static classes isn't reset. This function allows to reset the application status to avoid
+ * being in a dirty state.
+ */
+ public static void destroyForJUnitTests() {
+ sApplicationStateListeners.clear();
+ sGeneralActivityStateListeners.clear();
+ sActivityInfo.clear();
+ synchronized (sCachedApplicationStateLock) {
+ sCachedApplicationState = null;
+ }
+ sActivity = null;
+ sApplication = null;
+ sNativeApplicationStateListener = null;
+ }
+
+ /**
* Registers the single thread-safe native activity status listener.
* This handles the case where the caller is not on the main thread.
* Note that this is used by a leaky singleton object from the native