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

Unified Diff: chrome/android/junit/src/org/chromium/chrome/browser/physicalweb/UrlInfoTest.java

Issue 2725523002: Move UrlInfoTest to junit (Closed)
Patch Set: Move UrlInfoTest to junit 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
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/physicalweb/UrlInfoTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/junit/src/org/chromium/chrome/browser/physicalweb/UrlInfoTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/physicalweb/UrlInfoTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/physicalweb/UrlInfoTest.java
similarity index 81%
rename from chrome/android/javatests/src/org/chromium/chrome/browser/physicalweb/UrlInfoTest.java
rename to chrome/android/junit/src/org/chromium/chrome/browser/physicalweb/UrlInfoTest.java
index 01bdd45e6f2e15263d957a7ace855cd01f12e205..2c35ebc989969881725e80b21d7b66fbbfdd5105 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/physicalweb/UrlInfoTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/physicalweb/UrlInfoTest.java
@@ -4,24 +4,28 @@
package org.chromium.chrome.browser.physicalweb;
-import android.support.test.filters.SmallTest;
-
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.BlockJUnit4ClassRunner;
+
/**
* Tests for {@link UrlInfo}.
*/
-public class UrlInfoTest extends TestCase {
+@RunWith(BlockJUnit4ClassRunner.class)
+public class UrlInfoTest {
private static final String URL = "https://example.com";
+ private static final double EPSILON = .001;
UrlInfo mReferenceUrlInfo = null;
JSONObject mReferenceJsonObject = null;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws JSONException {
mReferenceUrlInfo = new UrlInfo(URL, 99.5, 42)
.setHasBeenDisplayed()
.setDeviceAddress("00:11:22:33:AA:BB");
@@ -35,16 +39,16 @@ public class UrlInfoTest extends TestCase {
+ "}");
}
- @SmallTest
+ @Test
public void testJsonSerializeWorks() throws JSONException {
assertEquals(mReferenceJsonObject.toString(), mReferenceUrlInfo.jsonSerialize().toString());
}
- @SmallTest
+ @Test
public void testJsonDeserializeWorks() throws JSONException {
UrlInfo urlInfo = UrlInfo.jsonDeserialize(mReferenceJsonObject);
assertEquals(mReferenceUrlInfo.getUrl(), urlInfo.getUrl());
- assertEquals(mReferenceUrlInfo.getDistance(), urlInfo.getDistance());
+ assertEquals(mReferenceUrlInfo.getDistance(), urlInfo.getDistance(), EPSILON);
assertEquals(mReferenceUrlInfo.getScanTimestamp(), urlInfo.getScanTimestamp());
assertEquals(mReferenceUrlInfo.getDeviceAddress(), urlInfo.getDeviceAddress());
assertEquals(mReferenceUrlInfo.hasBeenDisplayed(), urlInfo.hasBeenDisplayed());
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/physicalweb/UrlInfoTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698