< prev index next >
tests/system/src/test/java/test/robot/com/sun/glass/ui/monocle/MonocleUInput.java
Print this page
rev 9491 : 8145203: Refactor systemTests for clear separation of tests
Reviewed-by: kcr
*** 21,51 ****
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
! package com.sun.glass.ui.monocle;
import com.sun.glass.ui.Application;
import javafx.application.Platform;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.Pipe;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicReference;
class MonocleUInput extends NativeUInput {
private Pipe pipe;
! private LinuxInputDevice device;
! private final LinuxInputDeviceRegistry registry;
MonocleUInput() {
super();
- registry = (LinuxInputDeviceRegistry)
- NativePlatformFactory.getNativePlatform().getInputDeviceRegistry();
}
@Override
protected void createDevice() {
try {
--- 21,51 ----
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
! package test.robot.com.sun.glass.ui.monocle;
+ import test.robot.com.sun.glass.ui.monocle.TestApplication;
import com.sun.glass.ui.Application;
+ import com.sun.glass.ui.monocle.LinuxInputDeviceRegistryShim;
import javafx.application.Platform;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.Pipe;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicReference;
+ import test.com.sun.glass.ui.monocle.NativeUInput;
class MonocleUInput extends NativeUInput {
private Pipe pipe;
! private LinuxInputDeviceRegistryShim.LinuxInputDeviceShim device;
MonocleUInput() {
super();
}
@Override
protected void createDevice() {
try {
*** 56,71 ****
uevent.put("PRODUCT",
Integer.toHexString(bus) + "/"
+ Integer.toHexString(vendor) + "/"
+ Integer.toHexString(product) + "/"
+ Integer.toHexString(version));
! Application.invokeAndWait(() -> device = registry.addDevice(
! new LinuxInputDevice(capabilities,
! createAbsCapsMap(),
pipe.source(),
udevManifest,
! uevent),
"Simulated Linux Input Device"));
}
protected void openConnection() {
}
--- 56,71 ----
uevent.put("PRODUCT",
Integer.toHexString(bus) + "/"
+ Integer.toHexString(vendor) + "/"
+ Integer.toHexString(product) + "/"
+ Integer.toHexString(version));
! Application.invokeAndWait(() -> device
! = LinuxInputDeviceRegistryShim.addDevice(capabilities,
! absCaps,
pipe.source(),
udevManifest,
! uevent,
"Simulated Linux Input Device"));
}
protected void openConnection() {
}
*** 84,100 ****
} catch (IOException e) {
e.printStackTrace();
}
pipe = null;
if (device != null) {
! final LinuxInputDevice d = device;
if (Platform.isFxApplicationThread()) {
! registry.removeDevice(d);
} else {
CountDownLatch latch = new CountDownLatch(1);
Platform.runLater(() -> {
! registry.removeDevice(d);
latch.countDown();
});
try {
latch.await();
} catch (InterruptedException e) {
--- 84,100 ----
} catch (IOException e) {
e.printStackTrace();
}
pipe = null;
if (device != null) {
! final LinuxInputDeviceRegistryShim.LinuxInputDeviceShim d = device;
if (Platform.isFxApplicationThread()) {
! LinuxInputDeviceRegistryShim.removeDevice(d);
} else {
CountDownLatch latch = new CountDownLatch(1);
Platform.runLater(() -> {
! LinuxInputDeviceRegistryShim.removeDevice(d);
latch.countDown();
});
try {
latch.await();
} catch (InterruptedException e) {
< prev index next >