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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/invalidation/InvalidationControllerTest.java

Issue 159173002: Refactor ActivityStatus to not store current activity (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 10 months 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
Index: chrome/android/javatests/src/org/chromium/chrome/browser/invalidation/InvalidationControllerTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/invalidation/InvalidationControllerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/invalidation/InvalidationControllerTest.java
index 9a6fb512f0becf4bd58f4aad4d91318eda26f70c..df03dc35f3c26d2fbacbe11ee9dfa5e6f97ab91b 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/invalidation/InvalidationControllerTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/invalidation/InvalidationControllerTest.java
@@ -15,7 +15,9 @@ import android.test.suitebuilder.annotation.SmallTest;
import com.google.ipc.invalidation.external.client.types.ObjectId;
-import org.chromium.base.ActivityStatus;
+import org.chromium.base.ActivityState;
+import org.chromium.base.ApplicationState;
+import org.chromium.base.ApplicationStatus;
import org.chromium.base.CollectionUtil;
import org.chromium.base.test.util.AdvancedMockContext;
import org.chromium.base.test.util.Feature;
@@ -79,7 +81,7 @@ public class InvalidationControllerTest extends InstrumentationTestCase {
public void testResumingMainActivity() throws Exception {
// Resuming main activity should trigger a start if sync is enabled.
setupSync(true);
- mController.onActivityStateChange(ActivityStatus.RESUMED);
+ mController.onApplicationStateChange(ApplicationState.HAS_RUNNING_ACTIVITIES);
assertEquals(1, mContext.getNumStartedIntents());
Intent intent = mContext.getStartedIntent(0);
validateIntentComponent(intent);
@@ -90,7 +92,7 @@ public class InvalidationControllerTest extends InstrumentationTestCase {
public void testResumingMainActivityWithSyncDisabled() throws Exception {
// Resuming main activity should NOT trigger a start if sync is disabled.
setupSync(false);
- mController.onActivityStateChange(ActivityStatus.RESUMED);
+ mController.onApplicationStateChange(ApplicationState.HAS_RUNNING_ACTIVITIES);
assertEquals(0, mContext.getNumStartedIntents());
}
@@ -99,7 +101,7 @@ public class InvalidationControllerTest extends InstrumentationTestCase {
public void testPausingMainActivity() throws Exception {
// Resuming main activity should trigger a stop if sync is enabled.
setupSync(true);
- mController.onActivityStateChange(ActivityStatus.PAUSED);
+ mController.onApplicationStateChange(ApplicationState.HAS_PAUSED_ACTIVITIES);
assertEquals(1, mContext.getNumStartedIntents());
Intent intent = mContext.getStartedIntent(0);
validateIntentComponent(intent);
@@ -113,7 +115,7 @@ public class InvalidationControllerTest extends InstrumentationTestCase {
public void testPausingMainActivityWithSyncDisabled() throws Exception {
// Resuming main activity should NOT trigger a stop if sync is disabled.
setupSync(false);
- mController.onActivityStateChange(ActivityStatus.PAUSED);
+ mController.onApplicationStateChange(ApplicationState.HAS_PAUSED_ACTIVITIES);
assertEquals(0, mContext.getNumStartedIntents());
}
@@ -137,7 +139,7 @@ public class InvalidationControllerTest extends InstrumentationTestCase {
// Create instance.
new InvalidationController(mContext) {
@Override
- public void onActivityStateChange(int newState) {
+ public void onApplicationStateChange(int newState) {
listenerCallbackCalled.set(true);
}
};
@@ -146,7 +148,7 @@ public class InvalidationControllerTest extends InstrumentationTestCase {
assertFalse(listenerCallbackCalled.get());
// Ensure we get a callback, which means we have registered for them.
- ActivityStatus.onStateChangeForTesting(new Activity(), ActivityStatus.RESUMED);
+ ApplicationStatus.onStateChangeForTesting(new Activity(), ActivityState.CREATED);
assertTrue(listenerCallbackCalled.get());
}

Powered by Google App Engine
This is Rietveld 408576698