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

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

Issue 2239003002: Revert of [Android] Update all Robolectric tests to Robolectric 3.0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/junit/src/org/chromium/chrome/browser/invalidation/InvalidationControllerTest.java
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/invalidation/InvalidationControllerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/invalidation/InvalidationControllerTest.java
index a902b728d34a8bc3a6f075250c0ecd53b16fa7c7..43020fadb496ce6e36e34b51655c92994f690193 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/invalidation/InvalidationControllerTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/invalidation/InvalidationControllerTest.java
@@ -30,10 +30,8 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
-import org.robolectric.Shadows;
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowActivity;
-import org.robolectric.shadows.ShadowLooper;
import java.util.HashSet;
import java.util.Set;
@@ -89,7 +87,7 @@
@Before
public void setUp() throws Exception {
Activity activity = Robolectric.buildActivity(Activity.class).setup().get();
- mShadowActivity = Shadows.shadowOf(activity);
+ mShadowActivity = Robolectric.shadowOf(activity);
mContext = activity;
ContextUtils.initApplicationContextForTests(mContext.getApplicationContext());
@@ -227,11 +225,11 @@
Assert.assertEquals(mAllTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
controller.onRecentTabsPageOpened();
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
- assertNoNewIntents();
-
- controller.onRecentTabsPageClosed();
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
+ assertNoNewIntents();
+
+ controller.onRecentTabsPageClosed();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
assertNoNewIntents();
}
@@ -251,11 +249,11 @@
Assert.assertEquals(mNonSessionTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
controller.onRecentTabsPageOpened();
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
- Assert.assertEquals(mAllTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
-
- controller.onRecentTabsPageClosed();
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
+ Assert.assertEquals(mAllTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
+
+ controller.onRecentTabsPageClosed();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
Assert.assertEquals(mNonSessionTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
}
@@ -269,16 +267,16 @@
public void testStartWhileRecentTabsPageShown() {
InvalidationController controller = new InvalidationController(mContext, true, false);
controller.onRecentTabsPageOpened();
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
assertNoNewIntents();
controller.ensureStartedAndUpdateRegisteredTypes();
Assert.assertEquals(IntentType.START_AND_REGISTER, getIntentType(getOnlyIntent()));
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
- Assert.assertEquals(mAllTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
-
- controller.onRecentTabsPageClosed();
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
+ Assert.assertEquals(mAllTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
+
+ controller.onRecentTabsPageClosed();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
Assert.assertEquals(mNonSessionTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
}
@@ -293,19 +291,19 @@
Assert.assertEquals(mNonSessionTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
controller.onRecentTabsPageOpened();
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
- Assert.assertEquals(mAllTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
-
- controller.onRecentTabsPageOpened();
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
- assertNoNewIntents();
-
- controller.onRecentTabsPageClosed();
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
- assertNoNewIntents();
-
- controller.onRecentTabsPageClosed();
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
+ Assert.assertEquals(mAllTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
+
+ controller.onRecentTabsPageOpened();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
+ assertNoNewIntents();
+
+ controller.onRecentTabsPageClosed();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
+ assertNoNewIntents();
+
+ controller.onRecentTabsPageClosed();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
Assert.assertEquals(mNonSessionTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
}
@@ -322,18 +320,18 @@
controller.onRecentTabsPageOpened();
controller.onRecentTabsPageClosed();
controller.onRecentTabsPageOpened();
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
- Assert.assertEquals(mAllTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
-
- controller.onRecentTabsPageClosed();
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
- Assert.assertEquals(mNonSessionTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
-
- controller.onRecentTabsPageOpened();
- controller.onRecentTabsPageClosed();
- controller.onRecentTabsPageOpened();
- controller.onRecentTabsPageClosed();
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
+ Assert.assertEquals(mAllTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
+
+ controller.onRecentTabsPageClosed();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
+ Assert.assertEquals(mNonSessionTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
+
+ controller.onRecentTabsPageOpened();
+ controller.onRecentTabsPageClosed();
+ controller.onRecentTabsPageOpened();
+ controller.onRecentTabsPageClosed();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
assertNoNewIntents();
}
@@ -349,17 +347,17 @@
controller.ensureStartedAndUpdateRegisteredTypes();
Assert.assertEquals(mNonSessionTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
controller.onRecentTabsPageOpened();
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
Assert.assertEquals(mAllTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
controller.onRecentTabsPageClosed();
controller.stop();
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
Assert.assertEquals(IntentType.STOP, getIntentType(getOnlyIntent()));
controller.ensureStartedAndUpdateRegisteredTypes();
Assert.assertEquals(mAllTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
Assert.assertEquals(mNonSessionTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
}
@@ -375,17 +373,17 @@
controller.ensureStartedAndUpdateRegisteredTypes();
Assert.assertEquals(mNonSessionTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
controller.onRecentTabsPageOpened();
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
Assert.assertEquals(mAllTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
controller.onRecentTabsPageClosed();
controller.onApplicationStateChange(ApplicationState.HAS_PAUSED_ACTIVITIES);
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
Assert.assertEquals(IntentType.STOP, getIntentType(getOnlyIntent()));
controller.onApplicationStateChange(ApplicationState.HAS_RUNNING_ACTIVITIES);
Assert.assertEquals(IntentType.START, getIntentType(getOnlyIntent()));
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
Assert.assertEquals(mNonSessionTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
}
@@ -400,16 +398,16 @@
controller.ensureStartedAndUpdateRegisteredTypes();
Assert.assertEquals(mNonSessionTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
controller.onRecentTabsPageOpened();
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
Assert.assertEquals(mAllTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
controller.onApplicationStateChange(ApplicationState.HAS_PAUSED_ACTIVITIES);
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
Assert.assertEquals(IntentType.STOP, getIntentType(getOnlyIntent()));
// Resuming the activity should not send a START_AND_REGISTER intent.
controller.onApplicationStateChange(ApplicationState.HAS_RUNNING_ACTIVITIES);
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
Assert.assertEquals(IntentType.START, getIntentType(getOnlyIntent()));
}
@@ -425,11 +423,11 @@
Assert.assertEquals(mNonSessionTypes, getRegisterIntentRegisterTypes(getOnlyIntent()));
controller.stop();
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
Assert.assertEquals(IntentType.STOP, getIntentType(getOnlyIntent()));
controller.onRecentTabsPageOpened();
- ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
+ Robolectric.runUiThreadTasksIncludingDelayedTasks();
assertNoNewIntents();
}

Powered by Google App Engine
This is Rietveld 408576698