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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappAuthenticatorTest.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/webapps/WebappAuthenticatorTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappAuthenticatorTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappAuthenticatorTest.java
index 3a64e47d1c0747ff051f8a752f352a85fe32539a..1c8b35156c0fafa3c7ecec7c4bed5095226d5c3f 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappAuthenticatorTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappAuthenticatorTest.java
@@ -5,38 +5,45 @@
package org.chromium.chrome.browser.webapps;
import android.content.Context;
+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.metrics.RecordHistogram;
import org.chromium.base.test.util.Feature;
+import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
/**
* Tests for {@link WebappAuthenticator}.
*/
-public class WebappAuthenticatorTest extends InstrumentationTestCase {
- @Override
+@RunWith(ChromeJUnit4ClassRunner.class)
+public class WebappAuthenticatorTest {
+ @Before
public void setUp() throws Exception {
- super.setUp();
RecordHistogram.setDisabledForTests(true);
}
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
+ @After
+ public void tearDown() throws Exception {
RecordHistogram.setDisabledForTests(false);
}
+ @Test
@SmallTest
@Feature({"Webapps"})
public void testAuthentication() {
- Context context = getInstrumentation().getTargetContext();
+ Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
String url = "http://www.example.org/hello.html";
byte[] mac = WebappAuthenticator.getMacForUrl(context, url);
- assertNotNull(mac);
- assertTrue(WebappAuthenticator.isUrlValid(context, url, mac));
- assertFalse(WebappAuthenticator.isUrlValid(context, url + "?goats=true", mac));
+ Assert.assertNotNull(mac);
+ Assert.assertTrue(WebappAuthenticator.isUrlValid(context, url, mac));
+ Assert.assertFalse(WebappAuthenticator.isUrlValid(context, url + "?goats=true", mac));
mac[4] += (byte) 1;
- assertFalse(WebappAuthenticator.isUrlValid(context, url, mac));
+ Assert.assertFalse(WebappAuthenticator.isUrlValid(context, url, mac));
}
}

Powered by Google App Engine
This is Rietveld 408576698