Search in sources :

Example 6 with JxBrowserUtils

use of io.flutter.utils.JxBrowserUtils in project flutter-intellij by flutter.

the class FlutterViewTest method testHandleJxBrowserInstallationFailed.

@Test
public void testHandleJxBrowserInstallationFailed() {
    final JxBrowserUtils mockJxBrowserUtils = mock(JxBrowserUtils.class);
    when(mockJxBrowserUtils.licenseIsSet()).thenReturn(true);
    when(mockJxBrowserManager.getLatestFailureReason()).thenReturn(new InstallationFailedReason(FailureType.FILE_DOWNLOAD_FAILED));
    // If JxBrowser failed to install, we should show a failure message that allows the user to manually retry.
    final FlutterView flutterView = new FlutterView(mockProject, mockJxBrowserManager, mockJxBrowserUtils, mockInspectorGroupManagerService, mockBusConnection);
    final FlutterView spy = spy(flutterView);
    doNothing().when(spy).presentClickableLabel(eq(mockToolWindow), anyList());
    spy.handleJxBrowserInstallationFailed(mockApp, mockInspectorService, mockToolWindow);
    verify(spy, times(1)).presentClickableLabel(eq(mockToolWindow), anyList());
}
Also used : JxBrowserUtils(io.flutter.utils.JxBrowserUtils) InstallationFailedReason(io.flutter.jxbrowser.InstallationFailedReason) FlutterView(io.flutter.view.FlutterView) Test(org.junit.Test)

Aggregations

JxBrowserUtils (io.flutter.utils.JxBrowserUtils)6 Test (org.junit.Test)6 FileUtils (io.flutter.utils.FileUtils)5 FileNotFoundException (java.io.FileNotFoundException)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 InstallationFailedReason (io.flutter.jxbrowser.InstallationFailedReason)1 FlutterView (io.flutter.view.FlutterView)1