mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-29 21:46:07 +08:00
Move idle detection classes to its own directory
Reviewed By: AaaChiuuu Differential Revision: D4738755 fbshipit-source-id: df3b215991a45932283f6ba9d800aeff1c31d2e6
This commit is contained in:
committed by
Facebook Github Bot
parent
3954400565
commit
a4300dab67
@@ -2,7 +2,10 @@ include_defs("//ReactAndroid/DEFS")
|
|||||||
|
|
||||||
android_library(
|
android_library(
|
||||||
name = "testing",
|
name = "testing",
|
||||||
srcs = glob(["**/*.java"]),
|
srcs = glob(
|
||||||
|
["**/*.java"],
|
||||||
|
excludes = ["idledetection/**/*.java"],
|
||||||
|
),
|
||||||
visibility = [
|
visibility = [
|
||||||
"PUBLIC",
|
"PUBLIC",
|
||||||
],
|
],
|
||||||
@@ -25,5 +28,6 @@ android_library(
|
|||||||
react_native_target("java/com/facebook/react/modules/debug:interfaces"),
|
react_native_target("java/com/facebook/react/modules/debug:interfaces"),
|
||||||
react_native_target("java/com/facebook/react/shell:shell"),
|
react_native_target("java/com/facebook/react/shell:shell"),
|
||||||
react_native_target("java/com/facebook/react/uimanager:uimanager"),
|
react_native_target("java/com/facebook/react/uimanager:uimanager"),
|
||||||
|
react_native_integration_tests_target("java/com/facebook/react/testing/idledetection:idledetection"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import android.view.ViewGroup;
|
|||||||
|
|
||||||
import com.facebook.infer.annotation.Assertions;
|
import com.facebook.infer.annotation.Assertions;
|
||||||
import com.facebook.react.bridge.ReactContext;
|
import com.facebook.react.bridge.ReactContext;
|
||||||
|
import com.facebook.react.testing.idledetection.IdleWaiter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for instrumentation tests that runs React based react application in UI mode
|
* Base class for instrumentation tests that runs React based react application in UI mode
|
||||||
@@ -123,7 +124,6 @@ public abstract class ReactAppInstrumentationTestCase extends
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
getActivity().runOnUiThread(getScreenshotRunnable);
|
getActivity().runOnUiThread(getScreenshotRunnable);
|
||||||
try {
|
try {
|
||||||
if (!latch.await(5000, TimeUnit.MILLISECONDS)) {
|
if (!latch.await(5000, TimeUnit.MILLISECONDS)) {
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ import com.facebook.react.bridge.ReactContext;
|
|||||||
import com.facebook.react.common.LifecycleState;
|
import com.facebook.react.common.LifecycleState;
|
||||||
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
|
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
|
||||||
import com.facebook.react.shell.MainReactPackage;
|
import com.facebook.react.shell.MainReactPackage;
|
||||||
|
import com.facebook.react.testing.idledetection.ReactBridgeIdleSignaler;
|
||||||
|
import com.facebook.react.testing.idledetection.ReactIdleDetectionUtil;
|
||||||
import com.facebook.react.uimanager.UIImplementationProvider;
|
import com.facebook.react.uimanager.UIImplementationProvider;
|
||||||
|
|
||||||
public class ReactAppTestActivity extends FragmentActivity implements
|
public class ReactAppTestActivity extends FragmentActivity implements
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ import com.facebook.react.common.ApplicationHolder;
|
|||||||
import com.facebook.react.common.futures.SimpleSettableFuture;
|
import com.facebook.react.common.futures.SimpleSettableFuture;
|
||||||
import com.facebook.react.devsupport.interfaces.DevSupportManager;
|
import com.facebook.react.devsupport.interfaces.DevSupportManager;
|
||||||
import com.facebook.react.modules.core.Timing;
|
import com.facebook.react.modules.core.Timing;
|
||||||
|
import com.facebook.react.testing.idledetection.ReactBridgeIdleSignaler;
|
||||||
|
import com.facebook.react.testing.idledetection.ReactIdleDetectionUtil;
|
||||||
import com.facebook.soloader.SoLoader;
|
import com.facebook.soloader.SoLoader;
|
||||||
|
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import android.view.MotionEvent;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewConfiguration;
|
import android.view.ViewConfiguration;
|
||||||
|
|
||||||
|
import com.facebook.react.testing.idledetection.IdleWaiter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides methods for generating touch events and dispatching them directly to a given view.
|
* Provides methods for generating touch events and dispatching them directly to a given view.
|
||||||
* Events scenarios are based on {@link android.test.TouchUtils} but they get gets dispatched
|
* Events scenarios are based on {@link android.test.TouchUtils} but they get gets dispatched
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
include_defs("//ReactAndroid/DEFS")
|
||||||
|
|
||||||
|
android_library(
|
||||||
|
name = "idledetection",
|
||||||
|
srcs = glob(["**/*.java"]),
|
||||||
|
visibility = [
|
||||||
|
"PUBLIC",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
react_native_dep("third-party/java/testing-support-lib:runner"),
|
||||||
|
react_native_target("java/com/facebook/react/bridge:bridge"),
|
||||||
|
react_native_target("java/com/facebook/react/modules/core:core"),
|
||||||
|
],
|
||||||
|
)
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.facebook.react.testing;
|
package com.facebook.react.testing.idledetection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for something that knows how to wait for bridge and UI idle.
|
* Interface for something that knows how to wait for bridge and UI idle.
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.facebook.react.testing;
|
package com.facebook.react.testing.idledetection;
|
||||||
|
|
||||||
import java.util.concurrent.Semaphore;
|
import java.util.concurrent.Semaphore;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.facebook.react.testing;
|
package com.facebook.react.testing.idledetection;
|
||||||
|
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -5,6 +5,7 @@ deps = [
|
|||||||
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
||||||
react_native_dep("third-party/java/junit:junit"),
|
react_native_dep("third-party/java/junit:junit"),
|
||||||
react_native_integration_tests_target("java/com/facebook/react/testing:testing"),
|
react_native_integration_tests_target("java/com/facebook/react/testing:testing"),
|
||||||
|
react_native_integration_tests_target("java/com/facebook/react/testing/idledetection:idledetection"),
|
||||||
react_native_target("java/com/facebook/react:react"),
|
react_native_target("java/com/facebook/react:react"),
|
||||||
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/common:common"),
|
react_native_target("java/com/facebook/react/common:common"),
|
||||||
|
|||||||
Reference in New Issue
Block a user