ExtendedClientDetails implements Serializable { public boolean isIOS() { return isIPad() || VaadinSession.getCurrent().getBrowser().isIPhone() || (navigatorPlatform != null && navigatorPlatform.startsWith("iPod")); } ExtendedClientDetails(String screenWidth, String screenHeight,
            String windowInnerWidth, String windowInnerHeight,
            String bodyClientWidth, String bodyClientHeight, String tzOffset,
            String rawTzOffset, String dstShift, String dstInEffect,
            String tzId, String curDate, String touchDevice,
            String devicePixelRatio, String windowName,
            String navigatorPlatform); int getScreenWidth(); int getScreenHeight(); int getWindowInnerHeight(); int getWindowInnerWidth(); int getBodyClientHeight(); int getBodyClientWidth(); int getTimezoneOffset(); String getTimeZoneId(); int getRawTimezoneOffset(); int getDSTSavings(); boolean isDSTInEffect(); Date getCurrentDate(); boolean isTouchDevice(); double getDevicePixelRatio(); String getWindowName(); boolean isIPad(); boolean isIOS();  }
@Test public void differentNavigatorPlatformDetails_Ipod_isIOSReturnsExpectedValue() { ExtendedClientDetails details = new ExtendBuilder() .setNavigatorPlatform("iPod ..").buildDetails(); VaadinSession session = Mockito.mock(VaadinSession.class); CurrentInstance.setCurrent(session); WebBrowser browser = Mockito.mock(WebBrowser.class); Mockito.when(session.getBrowser()).thenReturn(browser); Mockito.when(browser.isIPhone()).thenReturn(false); Assert.assertTrue(details.isIOS()); CurrentInstance.clearAll(); }
@Test public void isIOS_notIPadIsIPhone_returnsTrue() { ExtendedClientDetails details = Mockito .mock(ExtendedClientDetails.class); Mockito.doCallRealMethod().when(details).isIOS(); VaadinSession session = Mockito.mock(VaadinSession.class); VaadinSession.setCurrent(session); WebBrowser browser = Mockito.mock(WebBrowser.class); Mockito.when(session.getBrowser()).thenReturn(browser); Mockito.when(browser.isIPhone()).thenReturn(true); Assert.assertTrue(details.isIOS()); }
@Test public void isIOS_notIPad_deprecatedIsNotIOS_returnsFalse() { ExtendedClientDetails details = Mockito .mock(ExtendedClientDetails.class); Mockito.doCallRealMethod().when(details).isIOS(); VaadinSession session = Mockito.mock(VaadinSession.class); VaadinSession.setCurrent(session); WebBrowser browser = Mockito.mock(WebBrowser.class); Mockito.when(session.getBrowser()).thenReturn(browser); Assert.assertFalse(details.isIOS()); }