| Index: content/public/android/javatests/src/org/chromium/content/browser/LocationProviderTest.java
|
| diff --git a/content/public/android/javatests/src/org/chromium/content/browser/LocationProviderTest.java b/content/public/android/javatests/src/org/chromium/content/browser/LocationProviderTest.java
|
| index aeba7bb05ed7b54f1e98d807fe071bf2ae821855..297d5f3271c8a93cd1ff38dba29e7b990d0abf4c 100644
|
| --- a/content/public/android/javatests/src/org/chromium/content/browser/LocationProviderTest.java
|
| +++ b/content/public/android/javatests/src/org/chromium/content/browser/LocationProviderTest.java
|
| @@ -9,7 +9,6 @@ import android.test.InstrumentationTestCase;
|
| import android.test.UiThreadTest;
|
| import android.test.suitebuilder.annotation.SmallTest;
|
|
|
| -import org.chromium.base.ActivityStatus;
|
| import org.chromium.base.test.util.Feature;
|
|
|
| /**
|
| @@ -17,12 +16,13 @@ import org.chromium.base.test.util.Feature;
|
| */
|
| public class LocationProviderTest extends InstrumentationTestCase {
|
| private Activity mActivity;
|
| - private LocationProvider mLocationProvider;
|
| + private LocationProviderAdapter mLocationProvider;
|
|
|
| @Override
|
| public void setUp() {
|
| mActivity = new Activity();
|
| - mLocationProvider = LocationProvider.create(getInstrumentation().getTargetContext());
|
| + mLocationProvider =
|
| + LocationProviderAdapter.create(getInstrumentation().getTargetContext());
|
| }
|
|
|
| /**
|
| @@ -32,7 +32,6 @@ public class LocationProviderTest extends InstrumentationTestCase {
|
| @UiThreadTest
|
| @Feature({"Location"})
|
| public void testStartStop() throws Exception {
|
| - ActivityStatus.onStateChangeForTesting(mActivity, ActivityStatus.RESUMED);
|
| mLocationProvider.start(false);
|
| assertTrue("Should be running", mLocationProvider.isRunning());
|
| mLocationProvider.stop();
|
| @@ -46,7 +45,6 @@ public class LocationProviderTest extends InstrumentationTestCase {
|
| @UiThreadTest
|
| @Feature({"Location"})
|
| public void testStartUpgradeStop() throws Exception {
|
| - ActivityStatus.onStateChangeForTesting(mActivity, ActivityStatus.RESUMED);
|
| mLocationProvider.start(false);
|
| assertTrue("Should be running", mLocationProvider.isRunning());
|
| mLocationProvider.start(true);
|
| @@ -54,119 +52,4 @@ public class LocationProviderTest extends InstrumentationTestCase {
|
| mLocationProvider.stop();
|
| assertFalse("Should have stopped", mLocationProvider.isRunning());
|
| }
|
| -
|
| - /**
|
| - * Verify that pausing the activity stops location listener and when
|
| - * activity resumes it restarts listening.
|
| - */
|
| - @SmallTest
|
| - @UiThreadTest
|
| - @Feature({"Location"})
|
| - public void testStartPauseResumeStop() throws Exception {
|
| - ActivityStatus.onStateChangeForTesting(mActivity, ActivityStatus.RESUMED);
|
| - mLocationProvider.start(false);
|
| - assertTrue("Should be running", mLocationProvider.isRunning());
|
| - ActivityStatus.onStateChangeForTesting(mActivity, ActivityStatus.PAUSED);
|
| - assertFalse("Should have paused", mLocationProvider.isRunning());
|
| - ActivityStatus.onStateChangeForTesting(mActivity, ActivityStatus.RESUMED);
|
| - assertTrue("Should have resumed", mLocationProvider.isRunning());
|
| - mLocationProvider.stop();
|
| - assertFalse("Should have stopped", mLocationProvider.isRunning());
|
| - }
|
| -
|
| - /**
|
| - * Verify that calling start when the activity is paused doesn't start listening
|
| - * for location updates until activity resumes.
|
| - */
|
| - @SmallTest
|
| - @UiThreadTest
|
| - @Feature({"Location"})
|
| - public void testPauseStartResumeStop() throws Exception {
|
| - ActivityStatus.onStateChangeForTesting(mActivity, ActivityStatus.PAUSED);
|
| - mLocationProvider.start(false);
|
| - assertFalse("Should not be running", mLocationProvider.isRunning());
|
| - ActivityStatus.onStateChangeForTesting(mActivity, ActivityStatus.RESUMED);
|
| - assertTrue("Should have resumed", mLocationProvider.isRunning());
|
| - mLocationProvider.stop();
|
| - assertFalse("Should have stopped", mLocationProvider.isRunning());
|
| - }
|
| -
|
| - /**
|
| - * Verify that calling start when the activity is being created doesn't start listening
|
| - * for location updates until activity resumes.
|
| - */
|
| - @SmallTest
|
| - @UiThreadTest
|
| - @Feature({"Location"})
|
| - public void testCreatedStartedStartResumeStop() throws Exception {
|
| - ActivityStatus.onStateChangeForTesting(mActivity, ActivityStatus.CREATED);
|
| - mLocationProvider.start(false);
|
| - assertFalse("Should not be running", mLocationProvider.isRunning());
|
| - ActivityStatus.onStateChangeForTesting(mActivity, ActivityStatus.STARTED);
|
| - mLocationProvider.start(false);
|
| - assertFalse("Should not be running", mLocationProvider.isRunning());
|
| - ActivityStatus.onStateChangeForTesting(mActivity, ActivityStatus.RESUMED);
|
| - assertTrue("Should have resumed", mLocationProvider.isRunning());
|
| - mLocationProvider.stop();
|
| - assertFalse("Should have stopped", mLocationProvider.isRunning());
|
| - }
|
| -
|
| - /**
|
| - * Verify that calling start when the activity is being created then immediately paused doesn't
|
| - * start listening for location updates until activity resumes.
|
| - */
|
| - @SmallTest
|
| - @UiThreadTest
|
| - @Feature({"Location"})
|
| - public void testCreatedStartedStartPausedResumeStop() throws Exception {
|
| - ActivityStatus.onStateChangeForTesting(mActivity, ActivityStatus.CREATED);
|
| - mLocationProvider.start(false);
|
| - assertFalse("Should not be running", mLocationProvider.isRunning());
|
| - ActivityStatus.onStateChangeForTesting(mActivity, ActivityStatus.STARTED);
|
| - mLocationProvider.start(false);
|
| - assertFalse("Should not be running", mLocationProvider.isRunning());
|
| - ActivityStatus.onStateChangeForTesting(mActivity, ActivityStatus.PAUSED);
|
| - assertFalse("Should not be running", mLocationProvider.isRunning());
|
| - ActivityStatus.onStateChangeForTesting(mActivity, ActivityStatus.RESUMED);
|
| - assertTrue("Should have resumed", mLocationProvider.isRunning());
|
| - mLocationProvider.stop();
|
| - assertFalse("Should have stopped", mLocationProvider.isRunning());
|
| - }
|
| -
|
| - /**
|
| - * Verify that calling start when the activity is stopped doesn't start listening
|
| - * for location updates until activity resumes.
|
| - */
|
| - @SmallTest
|
| - @UiThreadTest
|
| - @Feature({"Location"})
|
| - public void testStopStartResumeStop() throws Exception {
|
| - ActivityStatus.onStateChangeForTesting(mActivity, ActivityStatus.STOPPED);
|
| - mLocationProvider.start(false);
|
| - assertFalse("Should not be running", mLocationProvider.isRunning());
|
| - ActivityStatus.onStateChangeForTesting(mActivity, ActivityStatus.RESUMED);
|
| - assertTrue("Should have resumed", mLocationProvider.isRunning());
|
| - mLocationProvider.stop();
|
| - assertFalse("Should have stopped", mLocationProvider.isRunning());
|
| - }
|
| -
|
| - /**
|
| - * Verify that upgrading when paused works as expected.
|
| - */
|
| - @SmallTest
|
| - @UiThreadTest
|
| - @Feature({"Location"})
|
| - public void testStartPauseUpgradeResumeStop() throws Exception {
|
| - ActivityStatus.onStateChangeForTesting(mActivity, ActivityStatus.RESUMED);
|
| - mLocationProvider.start(false);
|
| - assertTrue("Should be running", mLocationProvider.isRunning());
|
| - ActivityStatus.onStateChangeForTesting(mActivity, ActivityStatus.PAUSED);
|
| - assertFalse("Should have paused", mLocationProvider.isRunning());
|
| - mLocationProvider.start(true);
|
| - assertFalse("Should be paused", mLocationProvider.isRunning());
|
| - ActivityStatus.onStateChangeForTesting(mActivity, ActivityStatus.RESUMED);
|
| - assertTrue("Should have resumed", mLocationProvider.isRunning());
|
| - mLocationProvider.stop();
|
| - assertFalse("Should have stopped", mLocationProvider.isRunning());
|
| - }
|
| }
|
|
|