| 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));
|
| }
|
| }
|
|
|