4.5 / N [RNFeed] Isolate reusable util methods out of NetworkingModule

Reviewed By: lexs

Differential Revision: D3394808

fbshipit-source-id: 19c916be693377651f2c8e21eb3dd490ec68f74c
This commit is contained in:
Saurabh Aggarwal
2016-06-07 09:32:47 -07:00
committed by Facebook Github Bot 2
parent 49a5fe493e
commit 7e7abff55a
3 changed files with 159 additions and 108 deletions

View File

@@ -84,8 +84,8 @@ public class NetworkingModuleTest {
return callMock;
}
});
NetworkingModule networkingModule = new NetworkingModule(null, "", httpClient);
NetworkingModule networkingModule =
new NetworkingModule(mock(ReactApplicationContext.class), "", httpClient);
networkingModule.sendRequest(
mock(ExecutorToken.class),
@@ -196,8 +196,8 @@ public class NetworkingModuleTest {
return callMock;
}
});
NetworkingModule networkingModule = new NetworkingModule(null, "", httpClient);
NetworkingModule networkingModule =
new NetworkingModule(mock(ReactApplicationContext.class), "", httpClient);
JavaOnlyMap body = new JavaOnlyMap();
body.putString("string", "This is request body");
@@ -234,7 +234,8 @@ public class NetworkingModuleTest {
return callMock;
}
});
NetworkingModule networkingModule = new NetworkingModule(null, "", httpClient);
NetworkingModule networkingModule =
new NetworkingModule(mock(ReactApplicationContext.class), "", httpClient);
List<JavaOnlyArray> headers = Arrays.asList(
JavaOnlyArray.of("Accept", "text/plain"),
@@ -287,8 +288,8 @@ public class NetworkingModuleTest {
return callMock;
}
});
NetworkingModule networkingModule = new NetworkingModule(null, "", httpClient);
NetworkingModule networkingModule =
new NetworkingModule(mock(ReactApplicationContext.class), "", httpClient);
networkingModule.sendRequest(
mock(ExecutorToken.class),
"POST",
@@ -347,8 +348,8 @@ public class NetworkingModuleTest {
return callMock;
}
});
NetworkingModule networkingModule = new NetworkingModule(null, "", httpClient);
NetworkingModule networkingModule =
new NetworkingModule(mock(ReactApplicationContext.class), "", httpClient);
networkingModule.sendRequest(
mock(ExecutorToken.class),
"POST",
@@ -445,7 +446,8 @@ public class NetworkingModuleTest {
}
});
NetworkingModule networkingModule = new NetworkingModule(null, "", httpClient);
NetworkingModule networkingModule =
new NetworkingModule(mock(ReactApplicationContext.class), "", httpClient);
networkingModule.sendRequest(
mock(ExecutorToken.class),
"POST",
@@ -501,7 +503,8 @@ public class NetworkingModuleTest {
return calls[(Integer) request.tag() - 1];
}
});
NetworkingModule networkingModule = new NetworkingModule(null, "", httpClient);
NetworkingModule networkingModule =
new NetworkingModule(mock(ReactApplicationContext.class), "", httpClient);
networkingModule.initialize();
for (int idx = 0; idx < requests; idx++) {
@@ -547,7 +550,8 @@ public class NetworkingModuleTest {
return calls[(Integer) request.tag() - 1];
}
});
NetworkingModule networkingModule = new NetworkingModule(null, "", httpClient);
NetworkingModule networkingModule =
new NetworkingModule(mock(ReactApplicationContext.class), "", httpClient);
for (int idx = 0; idx < requests; idx++) {
networkingModule.sendRequest(