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

Unified Diff: chrome/android/javatests/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
Index: chrome/android/javatests/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/javatests/src/org/chromium/chrome/browser/physicalweb/UrlInfoTest.java
deleted file mode 100644
index 01bdd45e6f2e15263d957a7ace855cd01f12e205..0000000000000000000000000000000000000000
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/physicalweb/UrlInfoTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.chrome.browser.physicalweb;
-
-import android.support.test.filters.SmallTest;
-
-import junit.framework.TestCase;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-/**
- * Tests for {@link UrlInfo}.
- */
-public class UrlInfoTest extends TestCase {
- private static final String URL = "https://example.com";
- UrlInfo mReferenceUrlInfo = null;
- JSONObject mReferenceJsonObject = null;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mReferenceUrlInfo = new UrlInfo(URL, 99.5, 42)
- .setHasBeenDisplayed()
- .setDeviceAddress("00:11:22:33:AA:BB");
- // Because we can't print JSON sorted by keys, the order is important here.
- mReferenceJsonObject = new JSONObject("{"
- + " \"url\": \"" + URL + "\","
- + " \"distance\": 99.5,"
- + " \"scan_timestamp\": 42,"
- + " \"device_address\": \"00:11:22:33:AA:BB\","
- + " \"has_been_displayed\": true"
- + "}");
- }
-
- @SmallTest
- public void testJsonSerializeWorks() throws JSONException {
- assertEquals(mReferenceJsonObject.toString(), mReferenceUrlInfo.jsonSerialize().toString());
- }
-
- @SmallTest
- public void testJsonDeserializeWorks() throws JSONException {
- UrlInfo urlInfo = UrlInfo.jsonDeserialize(mReferenceJsonObject);
- assertEquals(mReferenceUrlInfo.getUrl(), urlInfo.getUrl());
- assertEquals(mReferenceUrlInfo.getDistance(), urlInfo.getDistance());
- assertEquals(mReferenceUrlInfo.getScanTimestamp(), urlInfo.getScanTimestamp());
- assertEquals(mReferenceUrlInfo.getDeviceAddress(), urlInfo.getDeviceAddress());
- assertEquals(mReferenceUrlInfo.hasBeenDisplayed(), urlInfo.hasBeenDisplayed());
- }
-}
« no previous file with comments | « chrome/android/java_sources.gni ('k') | chrome/android/junit/src/org/chromium/chrome/browser/physicalweb/UrlInfoTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698