Search in sources :

Example 1 with BombedProgressIndicator

use of com.intellij.testFramework.BombedProgressIndicator in project intellij-community by JetBrains.

the class ProgressIndicatorTest method testBombedIndicator.

public void testBombedIndicator() {
    final int count = 10;
    new BombedProgressIndicator(count).runBombed(() -> {
        for (int i = 0; i < count * 2; i++) {
            TimeoutUtil.sleep(10);
            try {
                ProgressManager.checkCanceled();
                if (i >= count) {
                    ProgressManager.checkCanceled();
                    fail("PCE expected on " + i + "th check");
                }
            } catch (ProcessCanceledException e) {
                if (i < count) {
                    fail("Too early PCE");
                }
            }
        }
    });
}
Also used : BombedProgressIndicator(com.intellij.testFramework.BombedProgressIndicator)

Aggregations

BombedProgressIndicator (com.intellij.testFramework.BombedProgressIndicator)1