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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/gsa/GSAAccountChangeListenerTest.java

Issue 2766373004: Convert the rest of chrome_public_test_apk InstrumentationTestCases to JUnit4 (Closed)
Patch Set: nits and rebase 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/javatests/src/org/chromium/chrome/browser/gsa/GSAAccountChangeListenerTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/gsa/GSAAccountChangeListenerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/gsa/GSAAccountChangeListenerTest.java
index 9e9aad4ef3eb9e8297b183cb3c9f0cae6941cf02..10a7094390eb0a3f90b168dfa4c2d72a1ec1f759 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/gsa/GSAAccountChangeListenerTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/gsa/GSAAccountChangeListenerTest.java
@@ -8,30 +8,37 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.support.test.InstrumentationRegistry;
import android.support.test.filters.SmallTest;
-import android.test.InstrumentationTestCase;
import junit.framework.AssertionFailedError;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import org.chromium.base.metrics.RecordHistogram;
+import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
/** Tests for GSAAccountChangeListener. */
-public class GSAAccountChangeListenerTest extends InstrumentationTestCase {
+@RunWith(ChromeJUnit4ClassRunner.class)
+public class GSAAccountChangeListenerTest {
private static final String ACCOUNT_NAME = "me@gmail.com";
private static final String ACCOUNT_NAME2 = "you@gmail.com";
private static final String PERMISSION = "permission.you.dont.have";
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
RecordHistogram.setDisabledForTests(true);
}
+ @Test
@SmallTest
public void testReceivesBroadcastIntents() throws Exception {
- final Context context = getInstrumentation().getTargetContext();
+ final Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
BroadcastReceiver receiver = new GSAAccountChangeListener.AccountChangeBroadcastReceiver();
context.registerReceiver(receiver,
new IntentFilter(GSAAccountChangeListener.ACCOUNT_UPDATE_BROADCAST_INTENT));
@@ -73,6 +80,6 @@ public class GSAAccountChangeListenerTest extends InstrumentationTestCase {
} catch (AssertionFailedError e) {
return;
}
- fail("The broadcast was received.");
+ Assert.fail("The broadcast was received.");
}
}

Powered by Google App Engine
This is Rietveld 408576698