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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/test/util/ChromeSigninUtilsTest.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
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/widget/DualControlLayoutTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/javatests/src/org/chromium/chrome/test/util/ChromeSigninUtilsTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/test/util/ChromeSigninUtilsTest.java b/chrome/android/javatests/src/org/chromium/chrome/test/util/ChromeSigninUtilsTest.java
index fad929282e48ec7b057b2e853637e0c19b655586..c2295bdad285cd1e97e8036821e7012ffadb7aae 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/test/util/ChromeSigninUtilsTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/test/util/ChromeSigninUtilsTest.java
@@ -4,18 +4,26 @@
package org.chromium.chrome.test.util;
+import android.support.test.InstrumentationRegistry;
import android.support.test.filters.SmallTest;
-import android.test.InstrumentationTestCase;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.chromium.base.test.util.EnormousTest;
import org.chromium.base.test.util.FlakyTest;
import org.chromium.base.test.util.Restriction;
+import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.components.signin.ChromeSigninController;
/**
* Tests for {@link ChromeSigninUtils}.
*/
-public class ChromeSigninUtilsTest extends InstrumentationTestCase {
+@RunWith(ChromeJUnit4ClassRunner.class)
+public class ChromeSigninUtilsTest {
private static final String FAKE_ACCOUNT_USERNAME = "test@google.com";
private static final String FAKE_ACCOUNT_PASSWORD = "$3cr3t";
private static final String GOOGLE_ACCOUNT_USERNAME = "chromiumforandroid01@gmail.com";
@@ -25,74 +33,75 @@ public class ChromeSigninUtilsTest extends InstrumentationTestCase {
private ChromeSigninUtils mSigninUtil;
private ChromeSigninController mSigninController;
- @Override
+ @Before
public void setUp() throws Exception {
- super.setUp();
- mSigninUtil = new ChromeSigninUtils(getInstrumentation());
- mSigninController = ChromeSigninController.get(getInstrumentation().getTargetContext());
+ mSigninUtil = new ChromeSigninUtils(InstrumentationRegistry.getInstrumentation());
+ mSigninController = ChromeSigninController.get(
+ InstrumentationRegistry.getInstrumentation().getTargetContext());
mSigninController.setSignedInAccountName(null);
mSigninUtil.removeAllFakeAccountsFromOs();
mSigninUtil.removeAllGoogleAccountsFromOs();
}
+ @Test
@SmallTest
public void testActivityIsNotSignedInOnAppOrFakeOSorGoogleOS() {
- assertFalse("Should not be signed into app.",
- mSigninController.isSignedIn());
- assertFalse("Should not be signed into OS with fake account.",
+ Assert.assertFalse("Should not be signed into app.", mSigninController.isSignedIn());
+ Assert.assertFalse("Should not be signed into OS with fake account.",
mSigninUtil.isExistingFakeAccountOnOs(FAKE_ACCOUNT_USERNAME));
- assertFalse("Should not be signed in on OS with Google account.",
+ Assert.assertFalse("Should not be signed in on OS with Google account.",
mSigninUtil.isExistingGoogleAccountOnOs(GOOGLE_ACCOUNT_USERNAME));
}
+ @Test
@SmallTest
public void testIsSignedInOnApp() {
mSigninUtil.addAccountToApp(FAKE_ACCOUNT_USERNAME);
- assertTrue("Should be signed on app.",
- mSigninController.isSignedIn());
- assertFalse("Should not be signed on OS with fake account.",
+ Assert.assertTrue("Should be signed on app.", mSigninController.isSignedIn());
+ Assert.assertFalse("Should not be signed on OS with fake account.",
mSigninUtil.isExistingFakeAccountOnOs(FAKE_ACCOUNT_USERNAME));
- assertFalse("Should not be signed in on OS with Google account.",
+ Assert.assertFalse("Should not be signed in on OS with Google account.",
mSigninUtil.isExistingGoogleAccountOnOs(GOOGLE_ACCOUNT_USERNAME));
}
+ @Test
@SmallTest
public void testIsSignedInOnFakeOS() {
mSigninUtil.addFakeAccountToOs(FAKE_ACCOUNT_USERNAME, FAKE_ACCOUNT_PASSWORD);
- assertFalse("Should not be signed in on app.",
- mSigninController.isSignedIn());
- assertTrue("Should be signed in on OS with fake account.",
+ Assert.assertFalse("Should not be signed in on app.", mSigninController.isSignedIn());
+ Assert.assertTrue("Should be signed in on OS with fake account.",
mSigninUtil.isExistingFakeAccountOnOs(FAKE_ACCOUNT_USERNAME));
- assertFalse("Should not be signed in on OS with Google account.",
+ Assert.assertFalse("Should not be signed in on OS with Google account.",
mSigninUtil.isExistingGoogleAccountOnOs(GOOGLE_ACCOUNT_USERNAME));
}
+ @Test
@FlakyTest(message = "https://crbug.com/517849")
@EnormousTest
@Restriction(Restriction.RESTRICTION_TYPE_INTERNET)
public void testIsSignedInOnGoogleOS() {
mSigninUtil.addGoogleAccountToOs(GOOGLE_ACCOUNT_USERNAME, GOOGLE_ACCOUNT_PASSWORD,
GOOGLE_ACCOUNT_TYPE);
- assertFalse("Should not be signed into app.",
- mSigninController.isSignedIn());
- assertFalse("Should not be signed into OS with fake account.",
+ Assert.assertFalse("Should not be signed into app.", mSigninController.isSignedIn());
+ Assert.assertFalse("Should not be signed into OS with fake account.",
mSigninUtil.isExistingFakeAccountOnOs(FAKE_ACCOUNT_USERNAME));
- assertTrue("Should be signed in on OS with Google account.",
+ Assert.assertTrue("Should be signed in on OS with Google account.",
mSigninUtil.isExistingGoogleAccountOnOs(GOOGLE_ACCOUNT_USERNAME));
}
+ @Test
@SmallTest
public void testIsSignedInOnFakeOSandApp() {
mSigninUtil.addAccountToApp(FAKE_ACCOUNT_USERNAME);
mSigninUtil.addFakeAccountToOs(FAKE_ACCOUNT_USERNAME, FAKE_ACCOUNT_PASSWORD);
- assertTrue("Should be signed in on app.",
- mSigninController.isSignedIn());
- assertTrue("Should be signed in on OS with fake account.",
+ Assert.assertTrue("Should be signed in on app.", mSigninController.isSignedIn());
+ Assert.assertTrue("Should be signed in on OS with fake account.",
mSigninUtil.isExistingFakeAccountOnOs(FAKE_ACCOUNT_USERNAME));
- assertFalse("Should not be signed in on OS with Google account.",
+ Assert.assertFalse("Should not be signed in on OS with Google account.",
mSigninUtil.isExistingGoogleAccountOnOs(GOOGLE_ACCOUNT_USERNAME));
}
+ @Test
@FlakyTest(message = "https://crbug.com/517849")
@EnormousTest
@Restriction(Restriction.RESTRICTION_TYPE_INTERNET)
@@ -100,14 +109,14 @@ public class ChromeSigninUtilsTest extends InstrumentationTestCase {
mSigninUtil.addAccountToApp(FAKE_ACCOUNT_USERNAME);
mSigninUtil.addGoogleAccountToOs(GOOGLE_ACCOUNT_USERNAME, GOOGLE_ACCOUNT_PASSWORD,
GOOGLE_ACCOUNT_TYPE);
- assertTrue("Should be signed into app.",
- mSigninController.isSignedIn());
- assertFalse("Should not be signed into OS with fake account.",
+ Assert.assertTrue("Should be signed into app.", mSigninController.isSignedIn());
+ Assert.assertFalse("Should not be signed into OS with fake account.",
mSigninUtil.isExistingFakeAccountOnOs(FAKE_ACCOUNT_USERNAME));
- assertTrue("Should be signed in on OS with Google account.",
+ Assert.assertTrue("Should be signed in on OS with Google account.",
mSigninUtil.isExistingGoogleAccountOnOs(GOOGLE_ACCOUNT_USERNAME));
}
+ @Test
@FlakyTest(message = "https://crbug.com/517849")
@EnormousTest
@Restriction(Restriction.RESTRICTION_TYPE_INTERNET)
@@ -115,14 +124,14 @@ public class ChromeSigninUtilsTest extends InstrumentationTestCase {
mSigninUtil.addFakeAccountToOs(FAKE_ACCOUNT_USERNAME, FAKE_ACCOUNT_PASSWORD);
mSigninUtil.addGoogleAccountToOs(GOOGLE_ACCOUNT_USERNAME, GOOGLE_ACCOUNT_PASSWORD,
GOOGLE_ACCOUNT_TYPE);
- assertFalse("Should not be signed into app.",
- mSigninController.isSignedIn());
- assertTrue("Should be signed into OS with fake account.",
+ Assert.assertFalse("Should not be signed into app.", mSigninController.isSignedIn());
+ Assert.assertTrue("Should be signed into OS with fake account.",
mSigninUtil.isExistingFakeAccountOnOs(FAKE_ACCOUNT_USERNAME));
- assertTrue("Should be signed in on OS with Google account.",
+ Assert.assertTrue("Should be signed in on OS with Google account.",
mSigninUtil.isExistingGoogleAccountOnOs(GOOGLE_ACCOUNT_USERNAME));
}
+ @Test
@FlakyTest(message = "https://crbug.com/517849")
@EnormousTest
@Restriction(Restriction.RESTRICTION_TYPE_INTERNET)
@@ -131,19 +140,17 @@ public class ChromeSigninUtilsTest extends InstrumentationTestCase {
mSigninUtil.addFakeAccountToOs(FAKE_ACCOUNT_USERNAME, FAKE_ACCOUNT_PASSWORD);
mSigninUtil.addGoogleAccountToOs(GOOGLE_ACCOUNT_USERNAME, GOOGLE_ACCOUNT_PASSWORD,
GOOGLE_ACCOUNT_TYPE);
- assertTrue("Should be signed into app.",
- mSigninController.isSignedIn());
- assertTrue("Should be signed into OS with fake account.",
+ Assert.assertTrue("Should be signed into app.", mSigninController.isSignedIn());
+ Assert.assertTrue("Should be signed into OS with fake account.",
mSigninUtil.isExistingFakeAccountOnOs(FAKE_ACCOUNT_USERNAME));
- assertTrue("Should be signed in on OS with Google account.",
+ Assert.assertTrue("Should be signed in on OS with Google account.",
mSigninUtil.isExistingGoogleAccountOnOs(GOOGLE_ACCOUNT_USERNAME));
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
mSigninController.setSignedInAccountName(null);
mSigninUtil.removeAllFakeAccountsFromOs();
mSigninUtil.removeAllGoogleAccountsFromOs();
- super.tearDown();
}
}
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/widget/DualControlLayoutTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698