Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1535)

Unified Diff: base/android/java/src/org/chromium/base/ApplicationStatus.java

Issue 1422693002: Make Android HttpNegotiateAuthenticator work without an activity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@AppStatusWebview
Patch Set: ApplicationStatus.destroyForTesting => ApplicationStatus.destroyForJUnitTests Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/android/java/src/org/chromium/net/HttpNegotiateAuthenticator.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/java/src/org/chromium/base/ApplicationStatus.java
diff --git a/base/android/java/src/org/chromium/base/ApplicationStatus.java b/base/android/java/src/org/chromium/base/ApplicationStatus.java
index 9f775958491811c93237391ad9c55964dd29d2c9..88940499dd3951fe38391ecfe2c067cabdd57e30 100644
--- a/base/android/java/src/org/chromium/base/ApplicationStatus.java
+++ b/base/android/java/src/org/chromium/base/ApplicationStatus.java
@@ -393,6 +393,21 @@ public static void unregisterApplicationStateListener(ApplicationStateListener l
}
/**
+ * 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();
+ sCachedApplicationState = 0;
Torne 2015/11/25 19:10:52 You should update this holding the lock (because *
dgn 2015/11/25 19:53:04 Thanks, that was bad :/ Done.
+ 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
« no previous file with comments | « no previous file | net/android/java/src/org/chromium/net/HttpNegotiateAuthenticator.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698