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

Unified Diff: net/android/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java

Issue 2247143004: Remove app context init from LibraryLoader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix per review. Created 4 years, 3 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: net/android/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java
diff --git a/net/android/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java b/net/android/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java
index 997e9476c5ceaf8028acd54f65d5abb9325428f1..7f40247242107704cf17aed6a2421fae954b6425 100644
--- a/net/android/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java
+++ b/net/android/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java
@@ -144,7 +144,7 @@ public class NetworkChangeNotifierTest extends InstrumentationTestCase {
}
// List of networks we're pretending are currently connected.
- private final ArrayList<MockNetwork> mMockNetworks = new ArrayList<MockNetwork>();
+ private final ArrayList<MockNetwork> mMockNetworks = new ArrayList<>();
private boolean mActiveNetworkExists;
private int mNetworkType;
@@ -304,7 +304,7 @@ public class NetworkChangeNotifierTest extends InstrumentationTestCase {
private static class TestNetworkChangeNotifierAutoDetectObserver
implements NetworkChangeNotifierAutoDetect.Observer {
// The list of network changes that have been witnessed.
- final ArrayList<ChangeInfo> mChanges = new ArrayList<ChangeInfo>();
+ final ArrayList<ChangeInfo> mChanges = new ArrayList<>();
@Override
public void onConnectionTypeChanged(int newConnectionType) {}
@@ -413,13 +413,13 @@ public class NetworkChangeNotifierTest extends InstrumentationTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER)
- .ensureInitialized(getInstrumentation().getTargetContext());
+ LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// Find Network.Network(int netId) using reflection.
mNetworkConstructor = Network.class.getConstructor(Integer.TYPE);
}
ThreadUtils.postOnUiThread(new Runnable() {
+ @Override
public void run() {
createTestNotifier(WatchForChanges.ONLY_WHEN_APP_IN_FOREGROUND);
}
@@ -779,6 +779,7 @@ public class NetworkChangeNotifierTest extends InstrumentationTestCase {
new TestNetworkChangeNotifierAutoDetectObserver();
Callable<NetworkChangeNotifierAutoDetect> callable =
new Callable<NetworkChangeNotifierAutoDetect>() {
+ @Override
public NetworkChangeNotifierAutoDetect call() {
return new NetworkChangeNotifierAutoDetect(
observer, context, new RegistrationPolicyApplicationStatus() {
@@ -794,8 +795,7 @@ public class NetworkChangeNotifierTest extends InstrumentationTestCase {
});
}
};
- FutureTask<NetworkChangeNotifierAutoDetect> task =
- new FutureTask<NetworkChangeNotifierAutoDetect>(callable);
+ FutureTask<NetworkChangeNotifierAutoDetect> task = new FutureTask<>(callable);
ThreadUtils.postOnUiThread(task);
NetworkChangeNotifierAutoDetect ncn = task.get();

Powered by Google App Engine
This is Rietveld 408576698