/*
 * Copyright 2000-2016 JetBrains s.r.o.
 *
 * 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.intellij.testFramework.fixtures;

import com.intellij.openapi.Disposable;
import com.intellij.testFramework.PlatformTestUtil;
import com.intellij.testFramework.SkipInHeadlessEnvironment;
import com.intellij.testFramework.SkipSlowTestLocally;
import org.jetbrains.annotations.NotNull;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.rules.TestName;

import static com.intellij.testFramework.PlatformTestUtil.SKIP_HEADLESS;
import static com.intellij.testFramework.PlatformTestUtil.SKIP_SLOW;
import static org.junit.Assume.assumeFalse;

public abstract class BareTestFixtureTestCase {
  @Rule public final TestName myNameRule = new TestName();

  private BareTestFixture myFixture;

  @Before
  public final void setupFixture() throws Exception {
    boolean headless = SKIP_HEADLESS && getClass().getAnnotation(SkipInHeadlessEnvironment.class) != null;
    assumeFalse("Class '" + getClass().getName() + "' is skipped because it requires working UI environment", headless);
    boolean slow = SKIP_SLOW && getClass().getAnnotation(SkipSlowTestLocally.class) != null;
    assumeFalse("Class '" + getClass().getName() + "' is skipped because it is dog slow", slow);

    myFixture = IdeaTestFixtureFactory.getFixtureFactory().createBareFixture();
    myFixture.setUp();
  }

  @After
  public final void tearDownFixture() throws Exception {
    if (myFixture != null) {
      myFixture.tearDown();
      myFixture = null;
    }
  }

  @NotNull
  protected final String getTestName(boolean lowercaseFirstLetter) {
    return PlatformTestUtil.getTestName(myNameRule.getMethodName(), lowercaseFirstLetter);
  }

  @NotNull
  public final Disposable getTestRootDisposable() {
    return myFixture.getTestRootDisposable();
  }
}
@@ -676,24 +676,133 @@
 Disposable;%0A
+import com.intellij.openapi.application.impl.ApplicationInfoImpl;%0Aimport com.intellij.openapi.util.Disposer;%0A
 import com.i
@@ -841,16 +841,16 @@
 stUtil;%0A
-
 import c
@@ -957,16 +957,66 @@
 ocally;%0A
+import com.intellij.testFramework.UsefulTestCase;%0A
 import o
@@ -1548,24 +1548,128 @@
 Exception %7B%0A
+    ApplicationInfoImpl.setInStressTest(UsefulTestCase.isPerformanceTest(null, getClass().getName()));%0A%0A
     boolean 
@@ -2151,24 +2151,24 @@
 eFixture();%0A
-
     myFixtur
@@ -2174,24 +2174,121 @@
 re.setUp();%0A
+    Disposer.register(getTestRootDisposable(), ()-%3E ApplicationInfoImpl.setInStressTest(false));%0A
   %7D%0A%0A  @Afte

set stress flag as early as possible before e.g. VirtualFileManagerImpl init which checks the flag to add all sorts of slow debug logging