Package com.eclipsesource.tabris.geolocation

Examples of com.eclipsesource.tabris.geolocation.GeolocationOptions


  @Test
  public void testSetsOptionsWhenGetLocation() {
    RemoteObject remoteObject = environment.getServiceObject();
    GeolocationImpl geolocation = new GeolocationImpl();
    GeolocationOptions options = new GeolocationOptions();
    GeolocationListener listener = mock( GeolocationListener.class );
    geolocation.addGeolocationListener( listener );

    geolocation.determineCurrentPosition( options );

    verify( remoteObject ).set( "needsPosition", "ONCE" );
    verify( remoteObject ).set( "frequency", options.getFrequency() );
    verify( remoteObject ).set( "maximumAge", options.getMaximumAge() );
    verify( remoteObject ).set( "highAccuracy", options.isHighAccuracyEnabled() );
  }
View Full Code Here


  @Test
  public void testSetsOptionsWhenWatch() {
    RemoteObject remoteObject = environment.getServiceObject();
    GeolocationImpl geolocation = new GeolocationImpl();
    GeolocationOptions options = new GeolocationOptions();
    GeolocationListener listener = mock( GeolocationListener.class );
    geolocation.addGeolocationListener( listener );

    geolocation.watchPosition( options );

    verify( remoteObject ).set( "needsPosition", "CONTINUOUS" );
    verify( remoteObject ).set( "frequency", options.getFrequency() );
    verify( remoteObject ).set( "maximumAge", options.getMaximumAge() );
    verify( remoteObject ).set( "highAccuracy", options.isHighAccuracyEnabled() );
  }
View Full Code Here

  @Test
  public void testDelegatesPositionWhenGetPosition() throws ParseException {
    GeolocationListener listener = mock( GeolocationListener.class );
    GeolocationImpl geolocation = new GeolocationImpl();
    geolocation.addGeolocationListener( listener );
    geolocation.determineCurrentPosition( new GeolocationOptions() );
    JsonObject properties = createPositionData();

    environment.dispatchNotifyOnServiceObject( "LocationUpdate", properties );

    ArgumentCaptor<Position> captor = ArgumentCaptor.forClass( Position.class );
View Full Code Here

    GeolocationListener listener1 = mock( GeolocationListener.class );
    GeolocationListener listener2 = mock( GeolocationListener.class );
    GeolocationImpl geolocation = new GeolocationImpl();
    geolocation.addGeolocationListener( listener1 );
    geolocation.addGeolocationListener( listener2 );
    geolocation.determineCurrentPosition( new GeolocationOptions() );
    JsonObject properties = createPositionData();

    environment.dispatchNotifyOnServiceObject( "LocationUpdate", properties );

    ArgumentCaptor<Position> captor = ArgumentCaptor.forClass( Position.class );
View Full Code Here

  @Test
  public void testDelegatesPositionWhenWatch() throws ParseException {
    GeolocationListener listener = mock( GeolocationListener.class );
    GeolocationImpl geolocation = new GeolocationImpl();
    geolocation.addGeolocationListener( listener );
    geolocation.watchPosition( new GeolocationOptions() );
    JsonObject properties = createPositionData();

    environment.dispatchNotifyOnServiceObject( "LocationUpdate", properties );

    ArgumentCaptor<Position> captor = ArgumentCaptor.forClass( Position.class );
View Full Code Here

    GeolocationListener listener1 = mock( GeolocationListener.class );
    GeolocationListener listener2 = mock( GeolocationListener.class );
    GeolocationImpl geolocation = new GeolocationImpl();
    geolocation.addGeolocationListener( listener1 );
    geolocation.addGeolocationListener( listener2 );
    geolocation.watchPosition( new GeolocationOptions() );
    JsonObject properties = createPositionData();

    environment.dispatchNotifyOnServiceObject( "LocationUpdate", properties );

    ArgumentCaptor<Position> captor = ArgumentCaptor.forClass( Position.class );
View Full Code Here

  @Test
  public void testDelegatesPositionErrorWhenGetPosition() {
    GeolocationListener listener = mock( GeolocationListener.class );
    GeolocationImpl geolocation = new GeolocationImpl();
    geolocation.addGeolocationListener( listener );
    geolocation.determineCurrentPosition( new GeolocationOptions() );
    JsonObject properties = new JsonObject();
    properties.add( "errorCode", "UNKNOWN" );
    properties.add( "errorMessage", "A Message" );

    environment.dispatchNotifyOnServiceObject( "LocationUpdateError", properties );
View Full Code Here

  @Test
  public void testDelegatesPositionErrorWhenWatch() {
    GeolocationListener listener = mock( GeolocationListener.class );
    GeolocationImpl geolocation = new GeolocationImpl();
    geolocation.addGeolocationListener( listener );
    geolocation.watchPosition( new GeolocationOptions() );
    JsonObject properties = new JsonObject();
    properties.add( "errorCode", "UNKNOWN" );
    properties.add( "errorMessage", "A Message" );

    environment.dispatchNotifyOnServiceObject( "LocationUpdateError", properties );
View Full Code Here

    getLocationButton.addSelectionListener( new SelectionAdapter() {

      @Override
      public void widgetSelected( SelectionEvent e ) {
        geolocation.addGeolocationListener( listener );
        geolocation.determineCurrentPosition( new GeolocationOptions().enableHighAccuracy() );
      }
    } );
    return getLocationButton;
  }
View Full Code Here

    button.addSelectionListener( new SelectionAdapter() {

      @Override
      public void widgetSelected( SelectionEvent e ) {
        geolocation.addGeolocationListener( listener );
        geolocation.determineCurrentPosition( new GeolocationOptions().enableHighAccuracy() );
      }
    } );
    return button;
  }
View Full Code Here

TOP

Related Classes of com.eclipsesource.tabris.geolocation.GeolocationOptions

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.