Skip to content

Commit d9f4f95

Browse files
authored
OpenFromClipboardTests: wait for job families instead of excluding #442 (#574)
#442
1 parent b099c1a commit d9f4f95

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/TestUtil.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,14 @@ public static boolean waitForJobs(String owner, long minTimeMs, long maxTimeMs)
133133
* @return true if the method timed out, false if all the jobs terminated before the timeout
134134
*/
135135
public static boolean waitForJobs(String owner, long minTimeMs, long maxTimeMs, Object... excludedFamilies) {
136+
return waitForJobs(owner, null, minTimeMs, maxTimeMs, excludedFamilies);
137+
}
138+
139+
public static boolean waitForJobs(String owner, Object jobFamily, long minTimeMs, long maxTimeMs, Object... excludedFamilies) {
136140
if (maxTimeMs < minTimeMs) {
137141
throw new IllegalArgumentException("Max time is smaller as min time!");
138142
}
139-
wakeUpSleepingJobs(null);
143+
wakeUpSleepingJobs(jobFamily);
140144
final long startNanos = System.nanoTime();
141145
while (System.nanoTime() - startNanos < minTimeMs * 1_000_000L) {
142146
runEventLoop();
@@ -153,7 +157,7 @@ public static boolean waitForJobs(String owner, long minTimeMs, long maxTimeMs,
153157
} catch (InterruptedException e) {
154158
// Uninterruptable
155159
}
156-
List<Job> jobs = getRunningOrWaitingJobs(null, excludedFamilies);
160+
List<Job> jobs = getRunningOrWaitingJobs(jobFamily, excludedFamilies);
157161
if (jobs.isEmpty()) {
158162
// only uninteresting jobs running
159163
break;
@@ -169,7 +173,7 @@ public static boolean waitForJobs(String owner, long minTimeMs, long maxTimeMs,
169173
dumpRunningOrWaitingJobs(owner, jobs);
170174
return true;
171175
}
172-
wakeUpSleepingJobs(null);
176+
wakeUpSleepingJobs(jobFamily);
173177
}
174178
runningJobs.clear();
175179
return false;

org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/OpenFromClipboardTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ public static void tearDownClass() throws CoreException {
9797
}
9898

9999
private static void waitForEncodingRelatedJobs() {
100-
TestUtil.waitForJobs("OpenFromClipboardTests", 10, 5_000, ValidateProjectEncoding.class);
101-
TestUtil.waitForJobs("OpenFromClipboardTests", 10, 5_000, CharsetDeltaJob.FAMILY_CHARSET_DELTA);
100+
TestUtil.waitForJobs("OpenFromClipboardTests", ValidateProjectEncoding.class, 0, 5_000);
101+
TestUtil.waitForJobs("OpenFromClipboardTests", CharsetDeltaJob.FAMILY_CHARSET_DELTA, 0, 5_000);
102102
}
103103

104104
private static IJavaProject createProject(String name) throws CoreException {

0 commit comments

Comments
 (0)