/*
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.facebook.litho.testing.testrunner;

import com.facebook.litho.config.ComponentsConfiguration;
import org.junit.runners.model.FrameworkMethod;

public class SplitBuildAndLayoutTestRunConfiguration implements LithoTestRunConfiguration {

  private final boolean defaultApplyStateUpdateEarly =
      ComponentsConfiguration.applyStateUpdateEarly;
  private final boolean defaultIsBuildAndLayoutSplitEnabled =
      ComponentsConfiguration.isBuildAndLayoutSplitEnabled;

  @Override
  public void beforeTest(FrameworkMethod method) {
    ComponentsConfiguration.isBuildAndLayoutSplitEnabled = true;
    ComponentsConfiguration.applyStateUpdateEarly = true;
  }

  @Override
  public void afterTest(FrameworkMethod method) {
    ComponentsConfiguration.isBuildAndLayoutSplitEnabled = defaultIsBuildAndLayoutSplitEnabled;
    ComponentsConfiguration.applyStateUpdateEarly = defaultApplyStateUpdateEarly;
  }
}

/*
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.facebook.litho.testing.testrunner;

import com.facebook.litho.config.ComponentsConfiguration;
import org.junit.runners.model.FrameworkMethod;

public class SplitBuildAndLayoutTestRunConfiguration implements LithoTestRunConfiguration {

  private final boolean defaultApplyStateUpdateEarly =
      ComponentsConfiguration.applyStateUpdateEarly;
  private final boolean defaultIsBuildAndLayoutSplitEnabled =
      ComponentsConfiguration.isBuildAndLayoutSplitEnabled;
  private final boolean defaultUseResolvedTree = ComponentsConfiguration.useResolvedTree;

  @Override
  public void beforeTest(FrameworkMethod method) {
    ComponentsConfiguration.isBuildAndLayoutSplitEnabled = true;
    ComponentsConfiguration.applyStateUpdateEarly = true;
    ComponentsConfiguration.useResolvedTree = true;
  }

  @Override
  public void afterTest(FrameworkMethod method) {
    ComponentsConfiguration.isBuildAndLayoutSplitEnabled = defaultIsBuildAndLayoutSplitEnabled;
    ComponentsConfiguration.applyStateUpdateEarly = defaultApplyStateUpdateEarly;
    ComponentsConfiguration.useResolvedTree = defaultUseResolvedTree;
  }
}

Add useResolvedTree flag to SplitBuildAndLayoutTestConfiguration
Add useResolvedTree flag to SplitBuildAndLayoutTestConfiguration

Reviewed By: pentiumao

Differential Revision: D36164793

fbshipit-source-id: 2d20899587d177c8dd657a7d3f32d623c629ec7c
