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

Unified Diff: chrome/android/junit/src/org/chromium/chrome/browser/omaha/ResponseParserTest.java

Issue 994283006: Add initial test and build files for Robolectric unit test suites. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/junit/src/org/chromium/chrome/browser/omaha/ResponseParserTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/omaha/ResponseParserTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/omaha/ResponseParserTest.java
similarity index 96%
copy from chrome/android/javatests/src/org/chromium/chrome/browser/omaha/ResponseParserTest.java
copy to chrome/android/junit/src/org/chromium/chrome/browser/omaha/ResponseParserTest.java
index 6ad87a99c89b773655fd5bbfb546adde854d180d..ee174a89827339c48f680f056e755f0a1c556895 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/omaha/ResponseParserTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/omaha/ResponseParserTest.java
@@ -4,11 +4,19 @@
package org.chromium.chrome.browser.omaha;
-import android.test.InstrumentationTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+import static org.junit.Assert.assertEquals;
jbudorick 2015/03/24 21:27:07 nix the import statics.
mikecase (-- gone --) 2015/03/24 22:00:40 Done.
+import static org.junit.Assert.fail;
+
import android.util.Xml;
import org.chromium.base.test.util.Feature;
+import org.chromium.testing.local.LocalRobolectricTestRunner;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import org.robolectric.annotation.Config;
+
import org.xmlpull.v1.XmlSerializer;
import java.io.IOException;
@@ -17,7 +25,9 @@ import java.io.StringWriter;
/**
* Unit tests for the Omaha ResponseParser.
*/
-public class ResponseParserTest extends InstrumentationTestCase {
+@RunWith(LocalRobolectricTestRunner.class)
+@Config(manifest = Config.NONE)
+public class ResponseParserTest {
// Note that the Omaha server appends "/" to the end of the URL codebase.
private static final String STRIPPED_URL =
"https://play.google.com/store/apps/details?id=com.google.android.apps.chrome";
@@ -225,62 +235,62 @@ public class ResponseParserTest extends InstrumentationTestCase {
fail("Failed to throw RequestFailureException for bad XML.");
}
- @SmallTest
+ @Test
@Feature({"Omaha"})
public void testValidAllTypes() throws RequestFailureException {
runSuccessTest(APP_STATUS_OK, true, true, UPDATE_STATUS_OK);
}
- @SmallTest
+ @Test
@Feature({"Omaha"})
public void testValidNoInstall() throws RequestFailureException {
runSuccessTest(APP_STATUS_OK, false, true, UPDATE_STATUS_OK);
}
- @SmallTest
+ @Test
@Feature({"Omaha"})
public void testValidNoPing() throws RequestFailureException {
runSuccessTest(APP_STATUS_OK, true, false, UPDATE_STATUS_OK);
}
- @SmallTest
+ @Test
@Feature({"Omaha"})
public void testValidNoUpdatecheck() throws RequestFailureException {
runSuccessTest(APP_STATUS_OK, true, true, null);
}
- @SmallTest
+ @Test
@Feature({"Omaha"})
public void testValidUpdatecheckNoUpdate() throws RequestFailureException {
runSuccessTest(APP_STATUS_OK, false, false, UPDATE_STATUS_NOUPDATE);
}
- @SmallTest
+ @Test
@Feature({"Omaha"})
public void testValidUpdatecheckError() throws RequestFailureException {
runSuccessTest(APP_STATUS_OK, false, false, UPDATE_STATUS_ERROR);
}
- @SmallTest
+ @Test
@Feature({"Omaha"})
public void testValidUpdatecheckUnknown() throws RequestFailureException {
runSuccessTest(APP_STATUS_OK, false, false, UPDATE_STATUS_WTF);
}
- @SmallTest
+ @Test
@Feature({"Omaha"})
public void testValidAppStatusRestricted() throws RequestFailureException {
runSuccessTest(APP_STATUS_RESTRICTED, false, false, null);
}
- @SmallTest
+ @Test
@Feature({"Omaha"})
public void testFailBogusResponse() {
String xml = "Bogus";
runFailureTest(xml, RequestFailureException.ERROR_MALFORMED_XML, false, false, false);
}
- @SmallTest
+ @Test
@Feature({"Omaha"})
public void testBadResponseProtocol() {
String xml =
@@ -288,7 +298,7 @@ public class ResponseParserTest extends InstrumentationTestCase {
runFailureTest(xml, RequestFailureException.ERROR_PARSE_RESPONSE, false, false, false);
}
- @SmallTest
+ @Test
@Feature({"Omaha"})
public void testFailMissingDaystart() {
String xml =
@@ -296,7 +306,7 @@ public class ResponseParserTest extends InstrumentationTestCase {
runFailureTest(xml, RequestFailureException.ERROR_PARSE_DAYSTART, false, false, true);
}
- @SmallTest
+ @Test
@Feature({"Omaha"})
public void testAppTagMissingUpdatecheck() {
String xml =
@@ -304,7 +314,7 @@ public class ResponseParserTest extends InstrumentationTestCase {
runFailureTest(xml, RequestFailureException.ERROR_PARSE_UPDATECHECK, true, false, true);
}
- @SmallTest
+ @Test
@Feature({"Omaha"})
public void testAppTagUnexpectedUpdatecheck() {
String xml =
@@ -312,7 +322,7 @@ public class ResponseParserTest extends InstrumentationTestCase {
runFailureTest(xml, RequestFailureException.ERROR_PARSE_UPDATECHECK, true, false, false);
}
- @SmallTest
+ @Test
@Feature({"Omaha"})
public void testAppTagMissingPing() {
String xml =
@@ -320,7 +330,7 @@ public class ResponseParserTest extends InstrumentationTestCase {
runFailureTest(xml, RequestFailureException.ERROR_PARSE_PING, false, true, true);
}
- @SmallTest
+ @Test
@Feature({"Omaha"})
public void testAppTagUnexpectedPing() {
String xml =
@@ -328,7 +338,7 @@ public class ResponseParserTest extends InstrumentationTestCase {
runFailureTest(xml, RequestFailureException.ERROR_PARSE_PING, false, false, true);
}
- @SmallTest
+ @Test
@Feature({"Omaha"})
public void testAppTagMissingInstall() {
String xml =
@@ -336,7 +346,7 @@ public class ResponseParserTest extends InstrumentationTestCase {
runFailureTest(xml, RequestFailureException.ERROR_PARSE_EVENT, true, false, true);
}
- @SmallTest
+ @Test
@Feature({"Omaha"})
public void testAppTagUnexpectedInstall() {
String xml =
@@ -344,7 +354,7 @@ public class ResponseParserTest extends InstrumentationTestCase {
runFailureTest(xml, RequestFailureException.ERROR_PARSE_EVENT, false, false, true);
}
- @SmallTest
+ @Test
@Feature({"Omaha"})
public void testAppTagStatusError() {
String xml =
@@ -352,7 +362,7 @@ public class ResponseParserTest extends InstrumentationTestCase {
runFailureTest(xml, RequestFailureException.ERROR_PARSE_APP, false, false, false);
}
- @SmallTest
+ @Test
@Feature({"Omaha"})
public void testUpdatecheckMissingUrl() {
String xml = createTestXML(

Powered by Google App Engine
This is Rietveld 408576698