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

Unified Diff: content/public/android/javatests/src/org/chromium/content/browser/LocationProviderTest.java

Issue 2708243004: Auto convert content shell tests to JUnit4 (Closed)
Patch Set: Remove test that failed Created 3 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: 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 baed10135d35c6ee3a92f8712f63aadd7321db07..1767c33f0ad61361f4ccbc8f3abe3cface1d95f4 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
@@ -1,58 +1,68 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.content.browser;
import android.app.Activity;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.annotation.UiThreadTest;
import android.support.test.filters.SmallTest;
-import android.test.InstrumentationTestCase;
-import android.test.UiThreadTest;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.chromium.base.annotations.SuppressFBWarnings;
+import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.chromium.base.test.util.Feature;
import org.chromium.device.geolocation.LocationProviderAdapter;
/**
* Test suite for LocationProvider.
*/
-public class LocationProviderTest extends InstrumentationTestCase {
+@RunWith(BaseJUnit4ClassRunner.class)
+public class LocationProviderTest {
private Activity mActivity;
private LocationProviderAdapter mLocationProvider;
+ @Before
@SuppressFBWarnings("URF_UNREAD_FIELD")
- @Override
+
public void setUp() {
mActivity = new Activity();
mLocationProvider =
- LocationProviderAdapter.create(getInstrumentation().getTargetContext());
+ LocationProviderAdapter.create(InstrumentationRegistry.getInstrumentation().getTargetContext());
}
/**
* Verify a normal start/stop call pair without any activity pauses.
*/
+ @Test
@SmallTest
@UiThreadTest
@Feature({"Location"})
public void testStartStop() throws Exception {
mLocationProvider.start(false);
- assertTrue("Should be running", mLocationProvider.isRunning());
+ Assert.assertTrue("Should be running", mLocationProvider.isRunning());
mLocationProvider.stop();
- assertFalse("Should have stopped", mLocationProvider.isRunning());
+ Assert.assertFalse("Should have stopped", mLocationProvider.isRunning());
}
/**
* Verify a start/upgrade/stop call sequence without any activity pauses.
*/
+ @Test
@SmallTest
@UiThreadTest
@Feature({"Location"})
public void testStartUpgradeStop() throws Exception {
mLocationProvider.start(false);
- assertTrue("Should be running", mLocationProvider.isRunning());
+ Assert.assertTrue("Should be running", mLocationProvider.isRunning());
mLocationProvider.start(true);
- assertTrue("Should be running", mLocationProvider.isRunning());
+ Assert.assertTrue("Should be running", mLocationProvider.isRunning());
mLocationProvider.stop();
- assertFalse("Should have stopped", mLocationProvider.isRunning());
+ Assert.assertFalse("Should have stopped", mLocationProvider.isRunning());
}
}

Powered by Google App Engine
This is Rietveld 408576698