mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-04 09:27:53 +08:00
Reverted commit D3334273
Reviewed By: astreet Differential Revision: D3334273 fbshipit-source-id: a3849604ea89db74900850c294685e7da9aeeacc
This commit is contained in:
committed by
Facebook Github Bot 7
parent
757ab0b936
commit
705daabbb1
@@ -15,7 +15,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import com.facebook.react.bridge.BaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.JavaScriptModule;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
import com.facebook.react.testing.ReactInstanceSpecForTest;
|
||||
import com.facebook.react.testing.ReactAppInstrumentationTestCase;
|
||||
|
||||
@@ -46,8 +45,6 @@ public abstract class AbstractScrollViewTestCase extends ReactAppInstrumentation
|
||||
}
|
||||
|
||||
// See ScrollViewListenerModule.js
|
||||
// Matches ScrollViewListenerModule.js
|
||||
@ReactModule(name = "ScrollListener")
|
||||
protected static class ScrollListenerModule extends BaseJavaModule {
|
||||
|
||||
private final ArrayList<Double> mXOffsets = new ArrayList<Double>();
|
||||
@@ -57,6 +54,12 @@ public abstract class AbstractScrollViewTestCase extends ReactAppInstrumentation
|
||||
private boolean mScrollBeginDragCalled;
|
||||
private boolean mScrollEndDragCalled;
|
||||
|
||||
// Matches ScrollViewListenerModule.js
|
||||
@Override
|
||||
public String getName() {
|
||||
return "ScrollListener";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void onScroll(double x, double y) {
|
||||
mXOffsets.add(x);
|
||||
|
||||
@@ -12,7 +12,6 @@ import javax.annotation.Nullable;
|
||||
|
||||
import com.facebook.react.bridge.BaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
|
||||
import static junit.framework.Assert.assertFalse;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
@@ -20,13 +19,17 @@ import static junit.framework.Assert.assertTrue;
|
||||
/**
|
||||
* NativeModule for tests that allows assertions from JS to propagate to Java.
|
||||
*/
|
||||
@ReactModule(name = "Assert")
|
||||
public class AssertModule extends BaseJavaModule {
|
||||
|
||||
private boolean mGotSuccess;
|
||||
private boolean mGotFailure;
|
||||
private @Nullable String mFirstFailureStackTrace;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Assert";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void fail(String stackTrace) {
|
||||
if (!mGotFailure) {
|
||||
|
||||
@@ -14,12 +14,10 @@ import com.facebook.react.bridge.Callback;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
|
||||
/**
|
||||
* Dummy implementation of storage module, used for testing
|
||||
*/
|
||||
@ReactModule(name = "AsyncSQLiteDBStorage")
|
||||
public final class FakeAsyncLocalStorage extends BaseJavaModule {
|
||||
|
||||
private static WritableMap errorMessage;
|
||||
@@ -28,6 +26,11 @@ public final class FakeAsyncLocalStorage extends BaseJavaModule {
|
||||
errorMessage.putString("message", "Fake Async Local Storage");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "AsyncSQLiteDBStorage";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void multiGet(final ReadableArray keys, final Callback callback) {
|
||||
callback.invoke(errorMessage, null);
|
||||
|
||||
@@ -15,18 +15,21 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.facebook.react.bridge.BaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
|
||||
/**
|
||||
* Native module provides single method {@link #record} which records its single int argument
|
||||
* in calls array
|
||||
*/
|
||||
@ReactModule(name = "Recording")
|
||||
public class IntRecordingModule extends BaseJavaModule {
|
||||
|
||||
private final List<Integer> mCalls = new ArrayList<>();
|
||||
private final CountDownLatch mCountDownLatch = new CountDownLatch(1);
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Recording";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void record(int i) {
|
||||
mCalls.add(i);
|
||||
|
||||
@@ -14,7 +14,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import com.facebook.react.bridge.BaseJavaModule;
|
||||
import com.facebook.react.bridge.Callback;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
|
||||
/**
|
||||
* This class is used to verify that some JS integration tests have completed successfully.
|
||||
@@ -24,7 +23,6 @@ import com.facebook.react.bridge.annotations.ReactModule;
|
||||
* to wait for the test to run, and {#link JSIntegrationTestChecker#isTestDone()} to check if it
|
||||
* completed successfully.
|
||||
*/
|
||||
@ReactModule(name = "TestModule")
|
||||
public class JSIntegrationTestChecker extends BaseJavaModule {
|
||||
|
||||
private final CountDownLatch mLatch;
|
||||
@@ -33,6 +31,11 @@ public class JSIntegrationTestChecker extends BaseJavaModule {
|
||||
mLatch = new CountDownLatch(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "TestModule";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void markTestCompleted() {
|
||||
mLatch.countDown();
|
||||
|
||||
@@ -19,14 +19,12 @@ 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.bridge.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 = "RCTNetworking")
|
||||
public class NetworkRecordingModuleMock extends ReactContextBaseJavaModule {
|
||||
|
||||
public int mRequestCount = 0;
|
||||
@@ -65,6 +63,11 @@ public class NetworkRecordingModuleMock extends ReactContextBaseJavaModule {
|
||||
mRequestListener = requestListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getName() {
|
||||
return "RCTNetworking";
|
||||
}
|
||||
|
||||
private void fireReactCallback(
|
||||
Callback callback,
|
||||
int status,
|
||||
|
||||
@@ -13,17 +13,20 @@ import java.util.List;
|
||||
|
||||
import com.facebook.react.bridge.BaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
|
||||
/**
|
||||
* Native module provides single method {@link #record} which records its single string argument
|
||||
* in calls array
|
||||
*/
|
||||
@ReactModule(name = "Recording")
|
||||
public class StringRecordingModule extends BaseJavaModule {
|
||||
|
||||
private final List<String> mCalls = new ArrayList<String>();
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Recording";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void record(String text) {
|
||||
mCalls.add(text);
|
||||
|
||||
Reference in New Issue
Block a user