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

Unified Diff: chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerTest.java

Issue 2760743002: Add support for robolectric play-services-shadows. (Closed)
Patch Set: Updated robolectric DEPS to pull in hard-coded file Created 3 years, 9 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/offlinepages/BackgroundSchedulerTest.java
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerTest.java
index 2fa8a536141dd184553fd03576289a6d68080acb..1c07205f2b7dc41341c0b63603fa58939158515f 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerTest.java
@@ -11,6 +11,8 @@ import static org.junit.Assert.assertTrue;
import android.content.Context;
+import com.google.android.gms.common.ConnectionResult;
+import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.gcm.GcmNetworkManager;
import com.google.android.gms.gcm.Task;
@@ -20,6 +22,8 @@ import org.junit.runner.RunWith;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import org.robolectric.internal.ShadowExtractor;
+import org.robolectric.shadows.gms.Shadows;
+import org.robolectric.shadows.gms.common.ShadowGoogleApiAvailability;
import org.chromium.base.BaseChromiumApplication;
import org.chromium.base.test.util.Feature;
@@ -39,6 +43,9 @@ public class BackgroundSchedulerTest {
@Before
public void setUp() throws Exception {
+ Shadows.shadowOf(GoogleApiAvailability.getInstance())
+ .setIsGooglePlayServicesAvailable(ConnectionResult.SUCCESS);
+
mContext = RuntimeEnvironment.application;
mGcmNetworkManager = (ShadowGcmNetworkManager) ShadowExtractor.extract(
GcmNetworkManager.getInstance(mContext));

Powered by Google App Engine
This is Rietveld 408576698