Commit d1e63771 authored by Michael Thiessen's avatar Michael Thiessen Committed by Commit Bot

Migrate trivial Unit Test cases to UNIT_TESTS Batch

These tests all use only the NativeLibraryTestRule, and aren't
obviously modifying other global state.

For reference, the UNIT_TESTS batch can be run locally using:
run_chrome_public_test_apk -A Batch=UnitTests

Bug: 989569
Change-Id: Ie870bff30d88d5de82051c05bfd074274a61b41b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2216044Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771942}
parent 38cf3666
...@@ -17,6 +17,7 @@ import org.junit.Test; ...@@ -17,6 +17,7 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.chromium.base.test.BaseJUnit4ClassRunner; import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions;
import org.chromium.components.browser_ui.notifications.ChromeNotification; import org.chromium.components.browser_ui.notifications.ChromeNotification;
...@@ -33,6 +34,7 @@ import org.chromium.content_public.browser.test.NativeLibraryTestRule; ...@@ -33,6 +34,7 @@ import org.chromium.content_public.browser.test.NativeLibraryTestRule;
* during testEnsureNormalizedIconBehavior(). * during testEnsureNormalizedIconBehavior().
*/ */
@RunWith(BaseJUnit4ClassRunner.class) @RunWith(BaseJUnit4ClassRunner.class)
@Batch(Batch.UNIT_TESTS)
public class NotificationBuilderBaseTest { public class NotificationBuilderBaseTest {
@Rule @Rule
public NativeLibraryTestRule mActivityTestRule = new NativeLibraryTestRule(); public NativeLibraryTestRule mActivityTestRule = new NativeLibraryTestRule();
......
...@@ -27,6 +27,7 @@ import org.junit.Test; ...@@ -27,6 +27,7 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.chromium.base.test.BaseJUnit4ClassRunner; import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.MinAndroidSdkLevel; import org.chromium.base.test.util.MinAndroidSdkLevel;
import org.chromium.chrome.R; import org.chromium.chrome.R;
...@@ -45,18 +46,19 @@ import org.chromium.content_public.browser.test.NativeLibraryTestRule; ...@@ -45,18 +46,19 @@ import org.chromium.content_public.browser.test.NativeLibraryTestRule;
* during notification construction. * during notification construction.
*/ */
@RunWith(BaseJUnit4ClassRunner.class) @RunWith(BaseJUnit4ClassRunner.class)
@Batch(Batch.UNIT_TESTS)
public class StandardNotificationBuilderTest { public class StandardNotificationBuilderTest {
private static final String NOTIFICATION_TAG = "TestNotificationTag"; private static final String NOTIFICATION_TAG = "TestNotificationTag";
private static final int NOTIFICATION_ID = 99; private static final int NOTIFICATION_ID = 99;
@Rule @Rule
public NativeLibraryTestRule mActivityTestRule = new NativeLibraryTestRule(); public NativeLibraryTestRule mLibraryTestRule = new NativeLibraryTestRule();
@Before @Before
public void setUp() { public void setUp() {
// Not initializing the browser process is safe because GetDomainAndRegistry() is // Not initializing the browser process is safe because GetDomainAndRegistry() is
// stand-alone. // stand-alone.
mActivityTestRule.loadNativeLibraryNoBrowserProcess(); mLibraryTestRule.loadNativeLibraryNoBrowserProcess();
} }
private NotificationBuilderBase createAllOptionsBuilder( private NotificationBuilderBase createAllOptionsBuilder(
......
...@@ -19,6 +19,7 @@ import android.os.Build; ...@@ -19,6 +19,7 @@ import android.os.Build;
import android.support.test.InstrumentationRegistry; import android.support.test.InstrumentationRegistry;
import android.support.test.filters.SmallTest; import android.support.test.filters.SmallTest;
import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
...@@ -26,6 +27,7 @@ import org.junit.rules.TestRule; ...@@ -26,6 +27,7 @@ import org.junit.rules.TestRule;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.chromium.base.test.BaseJUnit4ClassRunner; import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.MinAndroidSdkLevel; import org.chromium.base.test.util.MinAndroidSdkLevel;
import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.ChromePreferenceKeys;
import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.browser.preferences.SharedPreferencesManager;
...@@ -43,6 +45,7 @@ import java.util.List; ...@@ -43,6 +45,7 @@ import java.util.List;
* Tests that ChannelsUpdater correctly initializes channels on the notification manager. * Tests that ChannelsUpdater correctly initializes channels on the notification manager.
*/ */
@RunWith(BaseJUnit4ClassRunner.class) @RunWith(BaseJUnit4ClassRunner.class)
@Batch(Batch.UNIT_TESTS)
@TargetApi(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O)
public class ChannelsUpdaterTest { public class ChannelsUpdaterTest {
private NotificationManagerProxy mNotificationManagerProxy; private NotificationManagerProxy mNotificationManagerProxy;
...@@ -80,6 +83,13 @@ public class ChannelsUpdaterTest { ...@@ -80,6 +83,13 @@ public class ChannelsUpdaterTest {
} }
} }
@After
public void tearDown() {
// TODO(https://crbug.com/1086663): Replace with a SharedPreferencesTestRule when
// implemented.
mSharedPreferences.removeKey(ChromePreferenceKeys.NOTIFICATIONS_CHANNELS_VERSION);
}
@Test @Test
@SmallTest @SmallTest
@MinAndroidSdkLevel(Build.VERSION_CODES.O) @MinAndroidSdkLevel(Build.VERSION_CODES.O)
......
...@@ -17,6 +17,7 @@ import org.junit.runner.RunWith; ...@@ -17,6 +17,7 @@ import org.junit.runner.RunWith;
import org.chromium.base.task.PostTask; import org.chromium.base.task.PostTask;
import org.chromium.base.task.TaskTraits; import org.chromium.base.task.TaskTraits;
import org.chromium.base.test.BaseJUnit4ClassRunner; import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.chromium.base.test.util.Batch;
import org.chromium.content_public.browser.test.NativeLibraryTestRule; import org.chromium.content_public.browser.test.NativeLibraryTestRule;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
...@@ -28,9 +29,10 @@ import java.io.FileNotFoundException; ...@@ -28,9 +29,10 @@ import java.io.FileNotFoundException;
* not work correctly. * not work correctly.
*/ */
@RunWith(BaseJUnit4ClassRunner.class) @RunWith(BaseJUnit4ClassRunner.class)
@Batch(Batch.UNIT_TESTS)
public class ChromeFileProviderTest { public class ChromeFileProviderTest {
@Rule @Rule
public NativeLibraryTestRule mActivityTestRule = new NativeLibraryTestRule(); public NativeLibraryTestRule mLibraryTestRule = new NativeLibraryTestRule();
private ParcelFileDescriptor openFileFromProvider(Uri uri) { private ParcelFileDescriptor openFileFromProvider(Uri uri) {
ChromeFileProvider provider = new ChromeFileProvider(); ChromeFileProvider provider = new ChromeFileProvider();
......
...@@ -15,6 +15,7 @@ import org.junit.runner.RunWith; ...@@ -15,6 +15,7 @@ import org.junit.runner.RunWith;
import org.chromium.base.ImportantFileWriterAndroid; import org.chromium.base.ImportantFileWriterAndroid;
import org.chromium.base.test.BaseJUnit4ClassRunner; import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.content_public.browser.test.NativeLibraryTestRule; import org.chromium.content_public.browser.test.NativeLibraryTestRule;
...@@ -31,6 +32,7 @@ import java.io.IOException; ...@@ -31,6 +32,7 @@ import java.io.IOException;
* testing that the Java code is calling the native code correctly. * testing that the Java code is calling the native code correctly.
*/ */
@RunWith(BaseJUnit4ClassRunner.class) @RunWith(BaseJUnit4ClassRunner.class)
@Batch(Batch.UNIT_TESTS)
public class ImportantFileWriterAndroidTest { public class ImportantFileWriterAndroidTest {
@Rule @Rule
public NativeLibraryTestRule mActivityTestRule = new NativeLibraryTestRule(); public NativeLibraryTestRule mActivityTestRule = new NativeLibraryTestRule();
......
...@@ -15,6 +15,7 @@ import org.junit.Test; ...@@ -15,6 +15,7 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.chromium.base.test.BaseJUnit4ClassRunner; import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.chromium.base.test.util.Batch;
import org.chromium.content_public.browser.test.NativeLibraryTestRule; import org.chromium.content_public.browser.test.NativeLibraryTestRule;
import org.chromium.content_public.browser.test.util.CriteriaHelper; import org.chromium.content_public.browser.test.util.CriteriaHelper;
import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.content_public.browser.test.util.TestThreadUtils;
...@@ -24,6 +25,7 @@ import org.chromium.ui.test.util.DummyUiActivityTestCase; ...@@ -24,6 +25,7 @@ import org.chromium.ui.test.util.DummyUiActivityTestCase;
* Clipboard tests for Android platform that depend on access to the ClipboardManager. * Clipboard tests for Android platform that depend on access to the ClipboardManager.
*/ */
@RunWith(BaseJUnit4ClassRunner.class) @RunWith(BaseJUnit4ClassRunner.class)
@Batch(Batch.UNIT_TESTS)
public class ClipboardAndroidTest extends DummyUiActivityTestCase { public class ClipboardAndroidTest extends DummyUiActivityTestCase {
@Rule @Rule
public NativeLibraryTestRule mNativeLibraryTestRule = new NativeLibraryTestRule(); public NativeLibraryTestRule mNativeLibraryTestRule = new NativeLibraryTestRule();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment