Instrumentation test for PokesDashboardApp
Reviewed By: AaaChiuuu Differential Revision: D4758149 fbshipit-source-id: 17e448d44af4deccc288738d294146a612d5e9c3
This commit is contained in:
parent
3f46e591ff
commit
820c8e2466
|
@ -26,6 +26,7 @@ android_library(
|
||||||
react_native_target("java/com/facebook/react/common:common"),
|
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/cxxbridge:bridge"),
|
||||||
react_native_target("java/com/facebook/react/devsupport:interfaces"),
|
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/module/model:model"),
|
||||||
react_native_target("java/com/facebook/react/modules/core:core"),
|
react_native_target("java/com/facebook/react/modules/core:core"),
|
||||||
react_native_target("java/com/facebook/react/modules/debug:interfaces"),
|
react_native_target("java/com/facebook/react/modules/debug:interfaces"),
|
||||||
|
|
|
@ -10,6 +10,7 @@ android_library(
|
||||||
react_native_dep("third-party/android/support/v4:lib-support-v4"),
|
react_native_dep("third-party/android/support/v4:lib-support-v4"),
|
||||||
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
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/bridge:bridge"),
|
||||||
|
react_native_target("java/com/facebook/react/module/annotations:annotations"),
|
||||||
react_native_target("java/com/facebook/react/modules/core:core"),
|
react_native_target("java/com/facebook/react/modules/core:core"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -19,12 +19,14 @@ import com.facebook.react.bridge.ReadableArray;
|
||||||
import com.facebook.react.bridge.ReadableMap;
|
import com.facebook.react.bridge.ReadableMap;
|
||||||
import com.facebook.react.bridge.WritableArray;
|
import com.facebook.react.bridge.WritableArray;
|
||||||
import com.facebook.react.bridge.WritableMap;
|
import com.facebook.react.bridge.WritableMap;
|
||||||
|
import com.facebook.react.module.annotations.ReactModule;
|
||||||
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mock Networking module that records last request received by {@link #sendRequest} method and
|
* 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}
|
* returns reponse code and body that should be set with {@link #setResponse}
|
||||||
*/
|
*/
|
||||||
|
@ReactModule(name = "Networking", canOverrideExistingModule = true)
|
||||||
public class NetworkRecordingModuleMock extends ReactContextBaseJavaModule {
|
public class NetworkRecordingModuleMock extends ReactContextBaseJavaModule {
|
||||||
|
|
||||||
public int mRequestCount = 0;
|
public int mRequestCount = 0;
|
||||||
|
@ -108,6 +110,11 @@ public class NetworkRecordingModuleMock extends ReactContextBaseJavaModule {
|
||||||
mAbortedRequest = true;
|
mAbortedRequest = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canOverrideExistingModule() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private void onDataReceived(int requestId, String data) {
|
private void onDataReceived(int requestId, String data) {
|
||||||
WritableArray args = Arguments.createArray();
|
WritableArray args = Arguments.createArray();
|
||||||
args.pushInt(requestId);
|
args.pushInt(requestId);
|
||||||
|
|
Loading…
Reference in New Issue