Package com.eclipsesource.tabris.device.ClientDevice

Examples of com.eclipsesource.tabris.device.ClientDevice.Platform


  @Test
  public void testObtainsPlatform() {
    TrackingInfo info = TrackingInfoFactory.createInfo( ui.getDisplay() );

    Platform platform = info.getPlatform();

    assertSame( Platform.ANDROID, platform );
  }
View Full Code Here


  public void testGetPlatformIsAndroid() {
    TabrisRequest request = environment.getRequest();
    request.setHeader( Constants.USER_AGENT, "com.eclipsesource.tabris.android" );
    ClientDevice device = new ClientDeviceImpl();

    Platform platform = device.getPlatform();

    assertSame( Platform.ANDROID, platform );
  }
View Full Code Here

  public void testGetPlatformIsIOS() {
    TabrisRequest request = environment.getRequest();
    request.setHeader( Constants.USER_AGENT, "com.eclipsesource.tabris.ios" );
    ClientDevice device = new ClientDeviceImpl();

    Platform platform = device.getPlatform();

    assertSame( Platform.IOS, platform );
  }
View Full Code Here

  public void testGetPlatformIsSWT() {
    TabrisRequest request = environment.getRequest();
    request.setHeader( Constants.USER_AGENT, "com.eclipsesource.tabris.swt" );
    ClientDevice device = new ClientDeviceImpl();

    Platform platform = device.getPlatform();

    assertSame( Platform.SWT, platform );
  }
View Full Code Here

  public void testGetPlatformIsWebByDefault() {
    TabrisRequest request = environment.getRequest();
    request.setHeader( Constants.USER_AGENT, "Mozilla/bla" );
    ClientDevice device = new ClientDeviceImpl();

    Platform platform = device.getPlatform();

    assertSame( Platform.WEB, platform );
  }
View Full Code Here

  @Test
  public void testDefaultPlatformIsNull() {
    TrackingInfo trackingInfo = new TrackingInfo();

    Platform platform = trackingInfo.getPlatform();

    assertNull( platform );
  }
View Full Code Here

  public void testCanSetPlatform() {
    TrackingInfo trackingInfo = new TrackingInfo();

    trackingInfo.setPlatform( Platform.ANDROID );

    Platform platform = trackingInfo.getPlatform();
    assertSame( Platform.ANDROID, platform );
  }
View Full Code Here

    }
  }

  @Override
  public boolean accept( HttpServletRequest request ) {
    Platform platform = DeviceUtil.getPlatform();
    boolean result = platform == ANDROID || platform == IOS;
    if( result ) {
      setPlatformTheme( platform );
      setServerId();
      validateVersion();
View Full Code Here

    }
  }

  @Override
  public boolean accept( HttpServletRequest request ) {
    Platform platform = DeviceUtil.getPlatform();
    boolean result = platform == ANDROID || platform == IOS;
    if( result ) {
      setPlatformTheme( platform );
      setServerId();
      validateVersion();
View Full Code Here

public class DeviceUtil {

  public static Platform getPlatform() {
    String userAgent = RWT.getRequest().getHeader( Constants.USER_AGENT );
    Platform result = Platform.WEB;
    if( userAgent != null && userAgent.contains( Constants.ID_IOS ) ) {
      result = Platform.IOS;
    } else if( userAgent != null && userAgent.contains( Constants.ID_ANDROID ) ) {
      result = Platform.ANDROID;
    } else if( userAgent != null && userAgent.contains( Constants.ID_SWT ) ) {
View Full Code Here

TOP

Related Classes of com.eclipsesource.tabris.device.ClientDevice.Platform

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.