use of io.flutter.view.FlutterView in project flutter-intellij by flutter.
the class FlutterViewTest method testWaitForJxBrowserInstallationWithoutTimeout.
@Test
public void testWaitForJxBrowserInstallationWithoutTimeout() throws TimeoutException {
when(mockJxBrowserManager.getStatus()).thenReturn(JxBrowserStatus.INSTALLATION_IN_PROGRESS);
when(mockJxBrowserManager.waitForInstallation(INSTALLATION_WAIT_LIMIT_SECONDS)).thenReturn(JxBrowserStatus.INSTALLATION_FAILED);
// If waiting for JxBrowser installation completes without timing out, then we should return to event thread.
final FlutterView flutterView = new FlutterView(mockProject, mockJxBrowserManager, mockUtils, mockInspectorGroupManagerService, mockBusConnection);
final FlutterView spy = spy(flutterView);
doNothing().when(spy).handleUpdatedJxBrowserStatusOnEventThread(any(), any(), any(), any());
spy.waitForJxBrowserInstallation(mockApp, mockInspectorService, mockToolWindow);
verify(spy, times(1)).handleUpdatedJxBrowserStatusOnEventThread(mockApp, mockInspectorService, mockToolWindow, JxBrowserStatus.INSTALLATION_FAILED);
}
use of io.flutter.view.FlutterView in project flutter-intellij by flutter.
the class FlutterViewTest method testHandleJxBrowserInstallationInProgressWaiting.
@Test
public void testHandleJxBrowserInstallationInProgressWaiting() {
when(mockJxBrowserManager.getStatus()).thenReturn(JxBrowserStatus.INSTALLATION_IN_PROGRESS);
// If the JxBrowser installation is in progress and is not finished on the first re-check, we should start a thread to wait for the
// installation to finish.
final FlutterView flutterView = new FlutterView(mockProject, mockJxBrowserManager, mockUtils, mockInspectorGroupManagerService, mockBusConnection);
final FlutterView spy = spy(flutterView);
doNothing().when(spy).presentOpenDevToolsOptionWithMessage(any(), any(), any(), any());
doNothing().when(spy).startJxBrowserInstallationWaitingThread(any(), any(), any());
spy.handleJxBrowserInstallationInProgress(mockApp, mockInspectorService, mockToolWindow);
verify(spy, times(1)).presentOpenDevToolsOptionWithMessage(mockApp, mockInspectorService, mockToolWindow, INSTALLATION_IN_PROGRESS_LABEL);
verify(spy, times(1)).startJxBrowserInstallationWaitingThread(mockApp, mockInspectorService, mockToolWindow);
}
use of io.flutter.view.FlutterView in project flutter-intellij by flutter.
the class FlutterViewTest method testHandleUpdatedJxBrowserStatusWithSuccess.
@Test
public void testHandleUpdatedJxBrowserStatusWithSuccess() {
// If waiting for JxBrowser installation completes with failure, then we should redirect to the function that handles failure.
final FlutterView partialMockFlutterView = mock(FlutterView.class);
doCallRealMethod().when(partialMockFlutterView).handleUpdatedJxBrowserStatus(mockApp, mockInspectorService, mockToolWindow, JxBrowserStatus.INSTALLED);
partialMockFlutterView.handleUpdatedJxBrowserStatus(mockApp, mockInspectorService, mockToolWindow, JxBrowserStatus.INSTALLED);
verify(partialMockFlutterView, times(1)).handleJxBrowserInstalled(mockApp, mockInspectorService, mockToolWindow);
}
use of io.flutter.view.FlutterView in project flutter-intellij by flutter.
the class FlutterViewTest method testHandleUpdatedJxBrowserStatusWithOtherstatus.
@Test
public void testHandleUpdatedJxBrowserStatusWithOtherstatus() {
// If waiting for JxBrowser installation completes with any other status, then we should recommend opening non-embedded DevTools.
final FlutterView partialMockFlutterView = mock(FlutterView.class);
doCallRealMethod().when(partialMockFlutterView).handleUpdatedJxBrowserStatus(mockApp, mockInspectorService, mockToolWindow, JxBrowserStatus.NOT_INSTALLED);
partialMockFlutterView.handleUpdatedJxBrowserStatus(mockApp, mockInspectorService, mockToolWindow, JxBrowserStatus.NOT_INSTALLED);
verify(partialMockFlutterView, times(1)).presentOpenDevToolsOptionWithMessage(mockApp, mockInspectorService, mockToolWindow, INSTALLATION_WAIT_FAILED);
}
Aggregations