Instrumentation test for PokesDashboardApp

Reviewed By: AaaChiuuu

Differential Revision: D4758149

fbshipit-source-id: 17e448d44af4deccc288738d294146a612d5e9c3
This commit is contained in:
Andrew Y. Chen 2017-03-24 11:11:04 -07:00 committed by Facebook Github Bot
parent 3f46e591ff
commit 820c8e2466
3 changed files with 9 additions and 0 deletions

View File

@ -26,6 +26,7 @@ android_library(
react_native_target("java/com/facebook/react/common:common"),
react_native_target("java/com/facebook/react/cxxbridge:bridge"),
react_native_target("java/com/facebook/react/devsupport:interfaces"),
react_native_target("java/com/facebook/react/module/annotations:annotations"),
react_native_target("java/com/facebook/react/module/model:model"),
react_native_target("java/com/facebook/react/modules/core:core"),
react_native_target("java/com/facebook/react/modules/debug:interfaces"),

View File

@ -10,6 +10,7 @@ android_library(
react_native_dep("third-party/android/support/v4:lib-support-v4"),
react_native_dep("third-party/java/jsr-305:jsr-305"),
react_native_target("java/com/facebook/react/bridge:bridge"),
react_native_target("java/com/facebook/react/module/annotations:annotations"),
react_native_target("java/com/facebook/react/modules/core:core"),
],
)

View File

@ -19,12 +19,14 @@ import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.modules.core.DeviceEventManagerModule;
/**
* Mock Networking module that records last request received by {@link #sendRequest} method and
* returns reponse code and body that should be set with {@link #setResponse}
*/
@ReactModule(name = "Networking", canOverrideExistingModule = true)
public class NetworkRecordingModuleMock extends ReactContextBaseJavaModule {
public int mRequestCount = 0;
@ -108,6 +110,11 @@ public class NetworkRecordingModuleMock extends ReactContextBaseJavaModule {
mAbortedRequest = true;
}
@Override
public boolean canOverrideExistingModule() {
return true;
}
private void onDataReceived(int requestId, String data) {
WritableArray args = Arguments.createArray();
args.pushInt(requestId);