Java 类com.facebook.react.common.build.ReactBuildConfig 实例源码

项目:RNLearn_Project1    文件:ReactWebViewManager.java   
public void linkBridge() {
  if (messagingEnabled) {
    if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      // See isNative in lodash
      String testPostMessageNative = "String(window.postMessage) === String(Object.hasOwnProperty).replace('hasOwnProperty', 'postMessage')";
      evaluateJavascript(testPostMessageNative, new ValueCallback<String>() {
        @Override
        public void onReceiveValue(String value) {
          if (value.equals("true")) {
            FLog.w(ReactConstants.TAG, "Setting onMessage on a WebView overrides existing values of window.postMessage, but a previous value was defined");
          }
        }
      });
    }

    loadUrl("javascript:(" +
      "window.originalPostMessage = window.postMessage," +
      "window.postMessage = function(data) {" +
        BRIDGE_NAME + ".postMessage(String(data));" +
      "}" +
    ")");
  }
}
项目:RNLearn_Project1    文件:CoreModulesPackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
  List<Class<? extends JavaScriptModule>> jsModules = new ArrayList<>(Arrays.asList(
      DeviceEventManagerModule.RCTDeviceEventEmitter.class,
      JSTimersExecution.class,
      RCTEventEmitter.class,
      RCTNativeAppEventEmitter.class,
      AppRegistry.class,
      com.facebook.react.bridge.Systrace.class,
      HMRClient.class));

  if (ReactBuildConfig.DEBUG) {
    jsModules.add(DebugComponentOwnershipModule.RCTDebugComponentOwnership.class);
    jsModules.add(JSCHeapCapture.HeapCapture.class);
    jsModules.add(JSCSamplingProfiler.SamplingProfiler.class);
  }

  return jsModules;
}
项目:RNLearn_Project1    文件:ReactWebViewManager.java   
public void linkBridge() {
  if (messagingEnabled) {
    if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      // See isNative in lodash
      String testPostMessageNative = "String(window.postMessage) === String(Object.hasOwnProperty).replace('hasOwnProperty', 'postMessage')";
      evaluateJavascript(testPostMessageNative, new ValueCallback<String>() {
        @Override
        public void onReceiveValue(String value) {
          if (value.equals("true")) {
            FLog.w(ReactConstants.TAG, "Setting onMessage on a WebView overrides existing values of window.postMessage, but a previous value was defined");
          }
        }
      });
    }

    loadUrl("javascript:(" +
      "window.originalPostMessage = window.postMessage," +
      "window.postMessage = function(data) {" +
        BRIDGE_NAME + ".postMessage(String(data));" +
      "}" +
    ")");
  }
}
项目:RNLearn_Project1    文件:CoreModulesPackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
  List<Class<? extends JavaScriptModule>> jsModules = new ArrayList<>(Arrays.asList(
      DeviceEventManagerModule.RCTDeviceEventEmitter.class,
      JSTimersExecution.class,
      RCTEventEmitter.class,
      RCTNativeAppEventEmitter.class,
      AppRegistry.class,
      com.facebook.react.bridge.Systrace.class,
      HMRClient.class));

  if (ReactBuildConfig.DEBUG) {
    jsModules.add(DebugComponentOwnershipModule.RCTDebugComponentOwnership.class);
    jsModules.add(JSCHeapCapture.HeapCapture.class);
    jsModules.add(JSCSamplingProfiler.SamplingProfiler.class);
  }

  return jsModules;
}
项目:ReactNativeSignatureExample    文件:WebWorkers.java   
/**
 * Utility method used to help develop web workers on debug builds. In release builds, worker
 * scripts need to be packaged with the app, but in dev mode we want to fetch/reload the worker
 * script on the fly from the packager. This method fetches the given URL *synchronously* and
 * writes it to the specified temp file.
 *
 * This is exposed from Java only because we don't want to add a C++ networking library dependency
 *
 * NB: The caller is responsible for deleting the file specified by outFileName when they're done
 * with it.
 * NB: We write to a temp file instead of returning a String because, depending on the size of the
 * worker script, allocating the full script string on the Java heap can cause an OOM.
 */
@DoNotStrip
public static void downloadScriptToFileSync(String url, String outFileName) {
  if (!ReactBuildConfig.DEBUG) {
    throw new RuntimeException(
        "For security reasons, downloading scripts is only allowed in debug builds.");
  }

  OkHttpClient client = new OkHttpClient();
  final File out = new File(outFileName);

  Request request = new Request.Builder()
      .url(url)
      .build();

  try {
    Response response = client.newCall(request).execute();

    Sink output = Okio.sink(out);
    Okio.buffer(response.body().source()).readAll(output);
  } catch (IOException e) {
    throw new RuntimeException("Exception downloading web worker script to file", e);
  }
}
项目:react-native-ibeacon-android    文件:WebWorkers.java   
/**
 * Utility method used to help develop web workers on debug builds. In release builds, worker
 * scripts need to be packaged with the app, but in dev mode we want to fetch/reload the worker
 * script on the fly from the packager. This method fetches the given URL *synchronously* and
 * writes it to the specified temp file.
 *
 * This is exposed from Java only because we don't want to add a C++ networking library dependency
 *
 * NB: The caller is responsible for deleting the file specified by outFileName when they're done
 * with it.
 * NB: We write to a temp file instead of returning a String because, depending on the size of the
 * worker script, allocating the full script string on the Java heap can cause an OOM.
 */
@DoNotStrip
public static void downloadScriptToFileSync(String url, String outFileName) {
  if (!ReactBuildConfig.DEBUG) {
    throw new RuntimeException(
        "For security reasons, downloading scripts is only allowed in debug builds.");
  }

  OkHttpClient client = new OkHttpClient();
  final File out = new File(outFileName);

  Request request = new Request.Builder()
      .url(url)
      .build();

  try {
    Response response = client.newCall(request).execute();

    Sink output = Okio.sink(out);
    Okio.buffer(response.body().source()).readAll(output);
  } catch (IOException e) {
    throw new RuntimeException("Exception downloading web worker script to file", e);
  }
}
项目:react-native-box-loaders    文件:WebWorkers.java   
/**
 * Utility method used to help develop web workers on debug builds. In release builds, worker
 * scripts need to be packaged with the app, but in dev mode we want to fetch/reload the worker
 * script on the fly from the packager. This method fetches the given URL *synchronously* and
 * writes it to the specified temp file.
 *
 * This is exposed from Java only because we don't want to add a C++ networking library dependency
 *
 * NB: The caller is responsible for deleting the file specified by outFileName when they're done
 * with it.
 * NB: We write to a temp file instead of returning a String because, depending on the size of the
 * worker script, allocating the full script string on the Java heap can cause an OOM.
 */
public static void downloadScriptToFileSync(String url, String outFileName) {
  if (!ReactBuildConfig.DEBUG) {
    throw new RuntimeException(
        "For security reasons, downloading scripts is only allowed in debug builds.");
  }

  OkHttpClient client = new OkHttpClient();
  final File out = new File(outFileName);

  Request request = new Request.Builder()
      .url(url)
      .build();

  try {
    Response response = client.newCall(request).execute();

    Sink output = Okio.sink(out);
    Okio.buffer(response.body().source()).readAll(output);
  } catch (IOException e) {
    throw new RuntimeException("Exception downloading web worker script to file", e);
  }
}
项目:Ironman    文件:ReactWebViewManager.java   
public void linkBridge() {
  if (messagingEnabled) {
    if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      // See isNative in lodash
      String testPostMessageNative = "String(window.postMessage) === String(Object.hasOwnProperty).replace('hasOwnProperty', 'postMessage')";
      evaluateJavascript(testPostMessageNative, new ValueCallback<String>() {
        @Override
        public void onReceiveValue(String value) {
          if (value.equals("true")) {
            FLog.w(ReactConstants.TAG, "Setting onMessage on a WebView overrides existing values of window.postMessage, but a previous value was defined");
          }
        }
      });
    }

    loadUrl("javascript:(" +
      "window.originalPostMessage = window.postMessage," +
      "window.postMessage = function(data) {" +
        BRIDGE_NAME + ".postMessage(String(data));" +
      "}" +
    ")");
  }
}
项目:Ironman    文件:ReactWebViewManager.java   
@Override
protected WebView createViewInstance(ThemedReactContext reactContext) {
  ReactWebView webView = new ReactWebView(reactContext);
  webView.setWebChromeClient(new WebChromeClient() {
    @Override
    public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
      callback.invoke(origin, true, false);
    }
  });
  reactContext.addLifecycleEventListener(webView);
  mWebViewConfig.configWebView(webView);
  webView.getSettings().setBuiltInZoomControls(true);
  webView.getSettings().setDisplayZoomControls(false);

  // Fixes broken full-screen modals/galleries due to body height being 0.
  webView.setLayoutParams(
          new LayoutParams(LayoutParams.MATCH_PARENT,
              LayoutParams.MATCH_PARENT));

  if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    WebView.setWebContentsDebuggingEnabled(true);
  }

  return webView;
}
项目:Ironman    文件:CoreModulesPackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
  List<Class<? extends JavaScriptModule>> jsModules = new ArrayList<>(Arrays.asList(
      DeviceEventManagerModule.RCTDeviceEventEmitter.class,
      JSTimersExecution.class,
      RCTEventEmitter.class,
      RCTNativeAppEventEmitter.class,
      AppRegistry.class,
      com.facebook.react.bridge.Systrace.class,
      HMRClient.class));

  if (ReactBuildConfig.DEBUG) {
    jsModules.add(DebugComponentOwnershipModule.RCTDebugComponentOwnership.class);
    jsModules.add(JSCHeapCapture.HeapCapture.class);
    jsModules.add(JSCSamplingProfiler.SamplingProfiler.class);
  }

  return jsModules;
}
项目:react-native-x5    文件:RNX5WebViewManager.java   
public void linkBridge() {
    if (messagingEnabled) {
        if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            // See isNative in lodash
            String testPostMessageNative = "String(window.postMessage) === String(Object.hasOwnProperty).replace('hasOwnProperty', 'postMessage')";
            evaluateJavascript(testPostMessageNative, new ValueCallback<String>() {
                @Override
                public void onReceiveValue(String value) {
                    if (value.equals("true")) {
                        FLog.w(ReactConstants.TAG, "Setting onMessage on a WebView overrides existing values of window.postMessage, but a previous value was defined");
                    }
                }
            });
        }

        loadUrl("javascript:(" +
                "window.originalPostMessage = window.postMessage," +
                "window.postMessage = function(data) {" +
                BRIDGE_NAME + ".postMessage(String(data));" +
                "}" +
                ")");
    }
}
项目:react-native-x5    文件:RNX5WebViewManager.java   
@Override
protected WebView createViewInstance(ThemedReactContext reactContext) {
    X5WeView webView = new X5WeView(reactContext);

    webView.setWebChromeClient(new WebChromeClient() {
        @Override
        public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissionsCallback callback) {
            callback.invoke(origin, true, false);
        }
    });
    reactContext.addLifecycleEventListener(webView);
    mWebViewConfig.configWebView(webView);
    webView.getSettings().setBuiltInZoomControls(true);
    webView.getSettings().setDisplayZoomControls(false);

    // Fixes broken full-screen modals/galleries due to body height being 0.
    webView.setLayoutParams(
            new LayoutParams(LayoutParams.MATCH_PARENT,
                    LayoutParams.MATCH_PARENT));

    if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        WebView.setWebContentsDebuggingEnabled(true);
    }

    return webView;
}
项目:RNLearn_Project1    文件:ReactWebViewManager.java   
@Override
protected WebView createViewInstance(ThemedReactContext reactContext) {
  ReactWebView webView = new ReactWebView(reactContext);
  webView.setWebChromeClient(new WebChromeClient() {
    @Override
    public boolean onConsoleMessage(ConsoleMessage message) {
      if (ReactBuildConfig.DEBUG) {
        return super.onConsoleMessage(message);
      }
      // Ignore console logs in non debug builds.
      return true;
    }

    @Override
    public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
      callback.invoke(origin, true, false);
    }
  });
  reactContext.addLifecycleEventListener(webView);
  mWebViewConfig.configWebView(webView);
  webView.getSettings().setBuiltInZoomControls(true);
  webView.getSettings().setDisplayZoomControls(false);
  webView.getSettings().setDomStorageEnabled(true);

  // Fixes broken full-screen modals/galleries due to body height being 0.
  webView.setLayoutParams(
          new LayoutParams(LayoutParams.MATCH_PARENT,
              LayoutParams.MATCH_PARENT));

  if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    WebView.setWebContentsDebuggingEnabled(true);
  }

  return webView;
}
项目:RNLearn_Project1    文件:ReactImageView.java   
private void warnImageSource(String uri) {
  if (ReactBuildConfig.DEBUG) {
    Toast.makeText(
      getContext(),
      "Warning: Image source \"" + uri + "\" doesn't exist",
      Toast.LENGTH_SHORT).show();
  }
}
项目:RNLearn_Project1    文件:ModuleSpec.java   
public ConstructorProvider(Class<? extends NativeModule> type, Class[] signature) {
  if (ReactBuildConfig.DEBUG) {
    try {
      mConstructor = getConstructor(type, signature);
    } catch (NoSuchMethodException e) {
      throw new IllegalArgumentException("No such constructor", e);
    }
  }
}
项目:RNLearn_Project1    文件:JavaScriptModuleRegistration.java   
public JavaScriptModuleRegistration(Class<? extends JavaScriptModule> moduleInterface) {
  mModuleInterface = moduleInterface;

  if (ReactBuildConfig.DEBUG) {
    Set<String> methodNames = new LinkedHashSet<>();
    for (Method method : mModuleInterface.getDeclaredMethods()) {
      if (!methodNames.add(method.getName())) {
        throw new AssertionError(
          "Method overloading is unsupported: " + mModuleInterface.getName() + "#" +
            method.getName());
      }
    }
  }
}
项目:RNLearn_Project1    文件:ReactTestAppShell.java   
@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);
}
项目:RNLearn_Project1    文件:ModuleSpecTest.java   
@Test
public void testSimpleContextConstructor() {
  Whitebox.setInternalState(ReactBuildConfig.class, "DEBUG", true);
  ReactApplicationContext context = mock(ReactApplicationContext.class);
  ModuleSpec spec = ModuleSpec.simple(SimpleContextModule.class, context);

  NativeModule module = spec.getProvider().get();
  assertThat(module).isInstanceOf(SimpleContextModule.class);
  SimpleContextModule contextModule = (SimpleContextModule) module;
  assertThat(contextModule.getReactApplicationContext()).isSameAs(context);
}
项目:RNLearn_Project1    文件:ReactWebViewManager.java   
@Override
protected WebView createViewInstance(ThemedReactContext reactContext) {
  ReactWebView webView = new ReactWebView(reactContext);
  webView.setWebChromeClient(new WebChromeClient() {
    @Override
    public boolean onConsoleMessage(ConsoleMessage message) {
      if (ReactBuildConfig.DEBUG) {
        return super.onConsoleMessage(message);
      }
      // Ignore console logs in non debug builds.
      return true;
    }

    @Override
    public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
      callback.invoke(origin, true, false);
    }
  });
  reactContext.addLifecycleEventListener(webView);
  mWebViewConfig.configWebView(webView);
  webView.getSettings().setBuiltInZoomControls(true);
  webView.getSettings().setDisplayZoomControls(false);
  webView.getSettings().setDomStorageEnabled(true);

  // Fixes broken full-screen modals/galleries due to body height being 0.
  webView.setLayoutParams(
          new LayoutParams(LayoutParams.MATCH_PARENT,
              LayoutParams.MATCH_PARENT));

  if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    WebView.setWebContentsDebuggingEnabled(true);
  }

  return webView;
}
项目:RNLearn_Project1    文件:ReactImageView.java   
private void warnImageSource(String uri) {
  if (ReactBuildConfig.DEBUG) {
    Toast.makeText(
      getContext(),
      "Warning: Image source \"" + uri + "\" doesn't exist",
      Toast.LENGTH_SHORT).show();
  }
}
项目:RNLearn_Project1    文件:ModuleSpec.java   
public ConstructorProvider(Class<? extends NativeModule> type, Class[] signature) {
  if (ReactBuildConfig.DEBUG) {
    try {
      mConstructor = getConstructor(type, signature);
    } catch (NoSuchMethodException e) {
      throw new IllegalArgumentException("No such constructor", e);
    }
  }
}
项目:RNLearn_Project1    文件:JavaScriptModuleRegistration.java   
public JavaScriptModuleRegistration(Class<? extends JavaScriptModule> moduleInterface) {
  mModuleInterface = moduleInterface;

  if (ReactBuildConfig.DEBUG) {
    Set<String> methodNames = new LinkedHashSet<>();
    for (Method method : mModuleInterface.getDeclaredMethods()) {
      if (!methodNames.add(method.getName())) {
        throw new AssertionError(
          "Method overloading is unsupported: " + mModuleInterface.getName() + "#" +
            method.getName());
      }
    }
  }
}
项目:RNLearn_Project1    文件:ReactTestAppShell.java   
@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);
}
项目:RNLearn_Project1    文件:ModuleSpecTest.java   
@Test
public void testSimpleContextConstructor() {
  Whitebox.setInternalState(ReactBuildConfig.class, "DEBUG", true);
  ReactApplicationContext context = mock(ReactApplicationContext.class);
  ModuleSpec spec = ModuleSpec.simple(SimpleContextModule.class, context);

  NativeModule module = spec.getProvider().get();
  assertThat(module).isInstanceOf(SimpleContextModule.class);
  SimpleContextModule contextModule = (SimpleContextModule) module;
  assertThat(contextModule.getReactApplicationContext()).isSameAs(context);
}
项目:ReactNativeSignatureExample    文件:ReactWebViewManager.java   
@Override
protected WebView createViewInstance(ThemedReactContext reactContext) {
  ReactWebView webView = new ReactWebView(reactContext);
  reactContext.addLifecycleEventListener(webView);
  mWebViewConfig.configWebView(webView);

  if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    WebView.setWebContentsDebuggingEnabled(true);
  }

  return webView;
}
项目:react-native-ibeacon-android    文件:ReactWebViewManager.java   
@Override
protected WebView createViewInstance(ThemedReactContext reactContext) {
  ReactWebView webView = new ReactWebView(reactContext);
  reactContext.addLifecycleEventListener(webView);
  mWebViewConfig.configWebView(webView);

  if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    WebView.setWebContentsDebuggingEnabled(true);
  }

  return webView;
}
项目:magnet-client    文件:MagnetWebViewManager.java   
@Override
protected WebView createViewInstance(ThemedReactContext reactContext) {
    MagnetWebView magnetWebView = new MagnetWebView(mContext);
    reactContext.addLifecycleEventListener(magnetWebView);

    if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        WebView.setWebContentsDebuggingEnabled(true);
    }

    return magnetWebView;
}
项目:react-native-box-loaders    文件:ReactWebViewManager.java   
@Override
protected WebView createViewInstance(ThemedReactContext reactContext) {
  ReactWebView webView = new ReactWebView(reactContext);
  webView.setWebChromeClient(new WebChromeClient());
  reactContext.addLifecycleEventListener(webView);
  mWebViewConfig.configWebView(webView);

  if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    WebView.setWebContentsDebuggingEnabled(true);
  }

  return webView;
}
项目:Ironman    文件:ModuleSpec.java   
public ConstructorProvider(Class<? extends NativeModule> type, Class[] signature) {
  if (ReactBuildConfig.DEBUG) {
    try {
      mConstructor = getConstructor(type, signature);
    } catch (NoSuchMethodException e) {
      throw new IllegalArgumentException("No such constructor", e);
    }
  }
}
项目:Ironman    文件:JavaScriptModuleRegistration.java   
public JavaScriptModuleRegistration(Class<? extends JavaScriptModule> moduleInterface) {
  mModuleInterface = moduleInterface;

  if (ReactBuildConfig.DEBUG) {
    Set<String> methodNames = new LinkedHashSet<>();
    for (Method method : mModuleInterface.getDeclaredMethods()) {
      if (!methodNames.add(method.getName())) {
        throw new AssertionError(
          "Method overloading is unsupported: " + mModuleInterface.getName() + "#" +
            method.getName());
      }
    }
  }
}
项目:Ironman    文件:ReactTestAppShell.java   
@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);
}
项目:Ironman    文件:ModuleSpecTest.java   
@Test
public void testSimpleContextConstructor() {
  Whitebox.setInternalState(ReactBuildConfig.class, "DEBUG", true);
  ReactApplicationContext context = mock(ReactApplicationContext.class);
  ModuleSpec spec = ModuleSpec.simple(SimpleContextModule.class, context);

  NativeModule module = spec.getProvider().get();
  assertThat(module).isInstanceOf(SimpleContextModule.class);
  SimpleContextModule contextModule = (SimpleContextModule) module;
  assertThat(contextModule.getReactApplicationContext()).isSameAs(context);
}
项目:RNLearn_Project1    文件:ReactTestAppShell.java   
public ReactTestAppShell() {
  super("com.facebook.react.testing.ReactTestApplicationImpl", ReactBuildConfig.EXOPACKAGE_FLAGS);
}
项目:RNLearn_Project1    文件:ModuleSpecTest.java   
@Test(expected = IllegalArgumentException.class)
public void testSimpleFailFast() {
  Whitebox.setInternalState(ReactBuildConfig.class, "DEBUG", true);
  ModuleSpec.simple(ComplexModule.class, mock(ReactApplicationContext.class));
}
项目:RNLearn_Project1    文件:ModuleSpecTest.java   
@Test(expected = IllegalArgumentException.class)
public void testSimpleFailFastDefault() {
  Whitebox.setInternalState(ReactBuildConfig.class, "DEBUG", true);
  ModuleSpec.simple(ComplexModule.class);
}
项目:RNLearn_Project1    文件:ModuleSpecTest.java   
@Test
public void testSimpleNoFailFastRelease() {
  Whitebox.setInternalState(ReactBuildConfig.class, "DEBUG", false);
  ModuleSpec.simple(ComplexModule.class, mock(ReactApplicationContext.class));
}
项目:RNLearn_Project1    文件:ModuleSpecTest.java   
@Test(expected = RuntimeException.class)
public void testSimpleFailLateRelease() {
  Whitebox.setInternalState(ReactBuildConfig.class, "DEBUG", false);
  ModuleSpec spec = ModuleSpec.simple(ComplexModule.class, mock(ReactApplicationContext.class));
  spec.getProvider().get();
}
项目:RNLearn_Project1    文件:ModuleSpecTest.java   
@Test
public void testSimpleDefaultConstructor() {
  Whitebox.setInternalState(ReactBuildConfig.class, "DEBUG", true);
  ModuleSpec spec = ModuleSpec.simple(SimpleModule.class);
  assertThat(spec.getProvider().get()).isInstanceOf(SimpleModule.class);
}
项目:RNLearn_Project1    文件:ReactTestAppShell.java   
public ReactTestAppShell() {
  super("com.facebook.react.testing.ReactTestApplicationImpl", ReactBuildConfig.EXOPACKAGE_FLAGS);
}
项目:RNLearn_Project1    文件:ModuleSpecTest.java   
@Test(expected = IllegalArgumentException.class)
public void testSimpleFailFast() {
  Whitebox.setInternalState(ReactBuildConfig.class, "DEBUG", true);
  ModuleSpec.simple(ComplexModule.class, mock(ReactApplicationContext.class));
}