From f618c74db157752d9500bbbd114490ab1dcb0837 Mon Sep 17 00:00:00 2001 From: Sergey Karashevich Date: Wed, 31 Jan 2018 14:48:55 +0300 Subject: [PATCH] [gui-test] GoToClassFocusTest with high CPU load on parallel thread --- .../tests/community/GoToClassFocusTest.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/community-guitests/testSrc/com/intellij/testGuiFramework/tests/community/GoToClassFocusTest.kt b/community-guitests/testSrc/com/intellij/testGuiFramework/tests/community/GoToClassFocusTest.kt index fbb276738bf3..54f9abdb1aaa 100644 --- a/community-guitests/testSrc/com/intellij/testGuiFramework/tests/community/GoToClassFocusTest.kt +++ b/community-guitests/testSrc/com/intellij/testGuiFramework/tests/community/GoToClassFocusTest.kt @@ -7,6 +7,7 @@ import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.wm.ex.WindowManagerEx import com.intellij.testGuiFramework.fixtures.IdeFrameFixture +import com.intellij.testGuiFramework.framework.GuiTestUtil import com.intellij.testGuiFramework.impl.GuiTestCase import com.intellij.testGuiFramework.impl.GuiTestUtilKt import com.intellij.testGuiFramework.util.Key @@ -29,10 +30,10 @@ class GoToClassFocusTest: GuiTestCase() { CommunityProjectCreator.createCommandLineProject() Pause.pause(1000) ideFrame { - for(i in 0..30) { - focusOnEditor() - startIntensiveCalcOnEdt() + for(i in 0..10) { + startIntensiveCalcOnParallel() openGoToClassSearchAndType(this@GoToClassFocusTest) + focusOnEditor() } } } @@ -41,6 +42,10 @@ class GoToClassFocusTest: GuiTestCase() { for (i in 0..1000) ApplicationManager.getApplication().invokeLater{ println(intensiveCpuCalc().toString()) } } + private fun startIntensiveCalcOnParallel() { + ApplicationManager.getApplication().executeOnPooledThread{ for (i in 0..100) ApplicationManager.getApplication().executeOnPooledThread { for(k in 0..1000) println (intensiveCpuCalc().toString()) } } + } + private fun intensiveCpuCalc(): Double { val rand = Random() val salt = rand.nextDouble() @@ -61,7 +66,7 @@ class GoToClassFocusTest: GuiTestCase() { private fun openGoToClassSearchAndType(guiTestCase: GuiTestCase) { invokeAction("GotoClass") - typeText(typedString) + GuiTestUtil.typeText(typedString, guiTestRule.robot(),0) checkSearchWindow(guiTestCase) shortcut(Key.ESCAPE) }