| Index: net/android/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java
|
| diff --git a/net/android/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java b/net/android/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java
|
| index 0d4608c241e41369f370d86650d3f8b299346e88..a9c2b29bb494aeb45c96f8b3663a68f09b1d35bd 100644
|
| --- a/net/android/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java
|
| +++ b/net/android/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java
|
| @@ -171,12 +171,12 @@ public class NetworkChangeNotifierTest extends InstrumentationTestCase {
|
| };
|
|
|
| NetworkChangeNotifierAutoDetect receiver = new NetworkChangeNotifierAutoDetect(
|
| - observer, context, false /* always watch for changes */) {
|
| - @Override
|
| - int getApplicationState() {
|
| - return ApplicationState.HAS_RUNNING_ACTIVITIES;
|
| - }
|
| - };
|
| + observer, context, new RegistrationPolicyApplicationStatus() {
|
| + @Override
|
| + int getApplicationState() {
|
| + return ApplicationState.HAS_RUNNING_ACTIVITIES;
|
| + }
|
| + });
|
|
|
| assertTrue(receiver.isReceiverRegisteredForTesting());
|
| }
|
| @@ -189,13 +189,15 @@ public class NetworkChangeNotifierTest extends InstrumentationTestCase {
|
| @MediumTest
|
| @Feature({"Android-AppBase"})
|
| public void testNetworkChangeNotifierRegistersForIntents() throws InterruptedException {
|
| - mReceiver.onApplicationStateChange(ApplicationState.HAS_RUNNING_ACTIVITIES);
|
| + RegistrationPolicyApplicationStatus policy =
|
| + (RegistrationPolicyApplicationStatus) mReceiver.getRegistrationPolicy();
|
| + policy.onApplicationStateChange(ApplicationState.HAS_RUNNING_ACTIVITIES);
|
| assertTrue(mReceiver.isReceiverRegisteredForTesting());
|
|
|
| - mReceiver.onApplicationStateChange(ApplicationState.HAS_PAUSED_ACTIVITIES);
|
| + policy.onApplicationStateChange(ApplicationState.HAS_PAUSED_ACTIVITIES);
|
| assertFalse(mReceiver.isReceiverRegisteredForTesting());
|
|
|
| - mReceiver.onApplicationStateChange(ApplicationState.HAS_RUNNING_ACTIVITIES);
|
| + policy.onApplicationStateChange(ApplicationState.HAS_RUNNING_ACTIVITIES);
|
| assertTrue(mReceiver.isReceiverRegisteredForTesting());
|
| }
|
|
|
| @@ -331,14 +333,16 @@ public class NetworkChangeNotifierTest extends InstrumentationTestCase {
|
|
|
| observer.resetHasReceivedNotification();
|
| // Pretend we got moved to the background.
|
| - mReceiver.onApplicationStateChange(ApplicationState.HAS_PAUSED_ACTIVITIES);
|
| + final RegistrationPolicyApplicationStatus policy =
|
| + (RegistrationPolicyApplicationStatus) mReceiver.getRegistrationPolicy();
|
| + policy.onApplicationStateChange(ApplicationState.HAS_PAUSED_ACTIVITIES);
|
| // Change the state.
|
| mConnectivityDelegate.setActiveNetworkExists(true);
|
| mConnectivityDelegate.setNetworkType(ConnectivityManager.TYPE_WIFI);
|
| // The NetworkChangeNotifierAutoDetect doesn't receive any notification while we are in the
|
| // background, but when we get back to the foreground the state changed should be detected
|
| // and a notification sent.
|
| - mReceiver.onApplicationStateChange(ApplicationState.HAS_RUNNING_ACTIVITIES);
|
| + policy.onApplicationStateChange(ApplicationState.HAS_RUNNING_ACTIVITIES);
|
| assertTrue(observer.hasReceivedNotification());
|
| }
|
|
|
|
|