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 |