use of com.android.tools.idea.profiling.capture.FileCaptureType in project android by JetBrains.
the class CapturesToolWindowFixture method openFile.
public void openFile(@NotNull final String fileName) throws IOException {
String pathName = null;
CaptureType[] captureTypes = CaptureTypeService.getInstance().getCaptureTypes();
for (CaptureType captureType : captureTypes) {
if (captureType instanceof FileCaptureType) {
FileCaptureType fileCaptureType = (FileCaptureType) captureType;
if (fileCaptureType.isValidCapture(fileName)) {
pathName = fileCaptureType.getName();
break;
}
}
}
if (pathName != null) {
final String finalPathName = pathName;
Wait.seconds(1).expecting("the file to be recognized").until(() -> {
try {
String fileToSelect = finalPathName + "/" + fileName;
myTreeFixture.selectPath(fileToSelect);
// TODO: Use mouse clicks instead of the keyboard when the fixture responds correctly to double clicks,
// as this will better model how users interact with the feature in practice.
myTreeFixture.pressAndReleaseKey(KeyPressInfo.keyCode(KeyEvent.VK_ENTER));
return true;
} catch (LocationUnavailableException e) {
return false;
}
});
}
}
Aggregations