mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
IDEA-354670: IndexingTestUtil.waitNow should wait for indexing even if it was submitted during EDT events pumping
GitOrigin-RevId: 96d306e82d1b6a79c5c6207daca427bfee0f6792
This commit is contained in:
committed by
intellij-monorepo-bot
parent
fb737d1fd4
commit
0fb89ef48e
@@ -64,8 +64,10 @@ class IndexingTestUtil(private val project: Project) {
|
||||
val scope = GlobalScope.childScope("Indexing waiter", Dispatchers.IO)
|
||||
val waiting = scope.launch { suspendUntilIndexesAreReady() }
|
||||
try {
|
||||
PlatformTestUtil.waitWithEventsDispatching("Indexing timeout", { !waiting.isActive }, 600)
|
||||
PlatformTestUtil.dispatchAllEventsInIdeEventQueue() // make sure that all the scheduled write actions are executed
|
||||
do {
|
||||
PlatformTestUtil.waitWithEventsDispatching("Indexing timeout", { !waiting.isActive }, 600)
|
||||
}
|
||||
while (dispatchAllEventsInIdeEventQueue()) // make sure that all the scheduled write actions are executed
|
||||
}
|
||||
finally {
|
||||
waiting.cancel()
|
||||
@@ -78,6 +80,14 @@ class IndexingTestUtil(private val project: Project) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun dispatchAllEventsInIdeEventQueue(): Boolean {
|
||||
var hasDispatchedEvents = false
|
||||
while (PlatformTestUtil.dispatchNextEventIfAny() != null) {
|
||||
hasDispatchedEvents = true
|
||||
}
|
||||
return hasDispatchedEvents
|
||||
}
|
||||
|
||||
private fun shouldWait(): Boolean {
|
||||
val dumbService = DumbServiceImpl.getInstance(project)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user