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

Unified Diff: base/test/android/junit/src/org/chromium/base/test/TestListInstrumentationRunListenerTest.java

Issue 2991833003: Revert of List Java Instru Test Information From JUnit Runner (Closed)
Patch Set: Created 3 years, 5 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: base/test/android/junit/src/org/chromium/base/test/TestListInstrumentationRunListenerTest.java
diff --git a/base/test/android/junit/src/org/chromium/base/test/TestListInstrumentationRunListenerTest.java b/base/test/android/junit/src/org/chromium/base/test/TestListInstrumentationRunListenerTest.java
deleted file mode 100644
index da6e4df132b0aea7135ea3fe58c6f3aea1d7736e..0000000000000000000000000000000000000000
--- a/base/test/android/junit/src/org/chromium/base/test/TestListInstrumentationRunListenerTest.java
+++ /dev/null
@@ -1,120 +0,0 @@
-// Copyright 2017 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.base.test;
-
-import static org.chromium.base.test.TestListInstrumentationRunListener.getAnnotationJSON;
-import static org.chromium.base.test.TestListInstrumentationRunListener.getTestMethodJSON;
-
-import org.json.JSONObject;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.Description;
-import org.junit.runner.RunWith;
-import org.robolectric.annotation.Config;
-
-import org.chromium.base.test.util.CommandLineFlags;
-import org.chromium.testing.local.LocalRobolectricTestRunner;
-
-import java.util.Arrays;
-
-/**
- * Robolectric test to ensure static methods in TestListInstrumentationRunListener works properly.
- */
-@RunWith(LocalRobolectricTestRunner.class)
-@Config(manifest = Config.NONE)
-public class TestListInstrumentationRunListenerTest {
- @CommandLineFlags.Add("hello")
- private static class ParentClass {
- public void testA() {}
-
- @CommandLineFlags.Add("world")
- public void testB() {}
- }
-
- @CommandLineFlags.Remove("hello")
- private static class ChildClass extends ParentClass {
- }
-
- @Test
- public void testGetTestMethodJSON_testA() throws Throwable {
- Description desc = Description.createTestDescription(
- ParentClass.class, "testA",
- ParentClass.class.getMethod("testA").getAnnotations());
- JSONObject json = getTestMethodJSON(desc);
- String expectedJsonString =
- "{"
- + "'method': 'testA',"
- + "'annotations': {}"
- + "}";
- expectedJsonString = expectedJsonString
- .replaceAll("\\s", "")
- .replaceAll("'", "\"");
- Assert.assertEquals(expectedJsonString, json.toString());
- }
-
- @Test
- public void testGetTestMethodJSON_testB() throws Throwable {
- Description desc = Description.createTestDescription(
- ParentClass.class, "testB",
- ParentClass.class.getMethod("testB").getAnnotations());
- JSONObject json = getTestMethodJSON(desc);
- String expectedJsonString =
- "{"
- + "'method': 'testB',"
- + "'annotations': {"
- + " 'Add': {"
- + " 'value': ['world']"
- + " }"
- + " }"
- + "}";
- expectedJsonString = expectedJsonString
- .replaceAll("\\s", "")
- .replaceAll("'", "\"");
- Assert.assertEquals(expectedJsonString, json.toString());
- }
-
-
- @Test
- public void testGetTestMethodJSONForInheritedClass() throws Throwable {
- Description desc = Description.createTestDescription(
- ChildClass.class, "testB",
- ChildClass.class.getMethod("testB").getAnnotations());
- JSONObject json = getTestMethodJSON(desc);
- String expectedJsonString =
- "{"
- + "'method': 'testB',"
- + "'annotations': {"
- + " 'Add': {"
- + " 'value': ['world']"
- + " }"
- + " }"
- + "}";
- expectedJsonString = expectedJsonString
- .replaceAll("\\s", "")
- .replaceAll("'", "\"");
- Assert.assertEquals(expectedJsonString, json.toString());
- }
-
- @Test
- public void testGetAnnotationJSONForParentClass() throws Throwable {
- JSONObject json = getAnnotationJSON(Arrays.asList(ParentClass.class.getAnnotations()));
- String expectedJsonString = "{'Add':{'value':['hello']}}";
- expectedJsonString = expectedJsonString
- .replaceAll("\\s", "")
- .replaceAll("'", "\"");
- Assert.assertEquals(expectedJsonString, json.toString());
- }
-
- @Test
- public void testGetAnnotationJSONForChildClass() throws Throwable {
- JSONObject json = getAnnotationJSON(Arrays.asList(ChildClass.class.getAnnotations()));
- String expectedJsonString = "{'Add':{'value':['hello']},'Remove':{'value':['hello']}}";
- expectedJsonString = expectedJsonString
- .replaceAll("\\s", "")
- .replaceAll("'", "\"");
- Assert.assertEquals(expectedJsonString, json.toString());
- }
-}
-

Powered by Google App Engine
This is Rietveld 408576698