mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-02 22:41:18 +08:00
Remove dependency on launcher from instrumentation tests
Reviewed By: bestander Differential Revision: D3736847 fbshipit-source-id: d39a227fe8753f3766521fd23440933adba9e8c7
This commit is contained in:
committed by
Facebook Github Bot 3
parent
af14a5b489
commit
37ab1c8844
@@ -6,6 +6,7 @@ android_library(
|
||||
deps = [
|
||||
react_native_dep('libraries/soloader/java/com/facebook/soloader:soloader'),
|
||||
react_native_dep('third-party/android/support/v4:lib-support-v4'),
|
||||
react_native_dep('third-party/java/buck-android-support:buck-android-support'),
|
||||
react_native_dep('third-party/java/infer-annotations:infer-annotations'),
|
||||
react_native_dep('third-party/java/jsr-305:jsr-305'),
|
||||
react_native_dep('third-party/java/junit:junit'),
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package com.facebook.react.testing;
|
||||
|
||||
import com.facebook.buck.android.support.exopackage.ApplicationLike;
|
||||
import com.facebook.buck.android.support.exopackage.ExopackageApplication;
|
||||
import com.facebook.react.common.build.ReactBuildConfig;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
|
||||
/**
|
||||
* Application class for the Catalyst Launcher to allow it to work as an exopackage.
|
||||
*
|
||||
* Any app-specific code that should run before secondary dex files are loaded
|
||||
* (like setting up crash reporting) should go in onBaseContextAttached.
|
||||
* Anything that should run after secondary dex should go in CatalystApplicationImpl.onCreate.
|
||||
*/
|
||||
public class ReactTestAppShell extends ExopackageApplication<ApplicationLike> {
|
||||
|
||||
public ReactTestAppShell() {
|
||||
super("com.facebook.react.testing.ReactTestApplicationImpl", ReactBuildConfig.EXOPACKAGE_FLAGS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBaseContextAttached() {
|
||||
// This is a terrible hack. Don't copy it.
|
||||
// It's unfortunate that Instagram does the same thing.
|
||||
// We need to do this here because internal apps use SoLoader,
|
||||
// and Open Source Buck uses ExopackageSoLoader.
|
||||
// If you feel the need to copy this, we should refactor it
|
||||
// into an FB-specific subclass of ExopackageApplication.
|
||||
SoLoader.init(this, (ReactBuildConfig.EXOPACKAGE_FLAGS & 2) != 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package com.facebook.react.testing;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import com.facebook.buck.android.support.exopackage.DefaultApplicationLike;
|
||||
|
||||
public class ReactTestApplicationImpl extends DefaultApplicationLike {
|
||||
|
||||
public ReactTestApplicationImpl() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ReactTestApplicationImpl(Application application) {
|
||||
super(application);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user