Package com.google.gwt.ajaxloader.client

Source Code of com.google.gwt.ajaxloader.client.ClientLocationTest

package com.google.gwt.ajaxloader.client;

import com.google.gwt.ajaxloader.client.AjaxLoader.AjaxLoaderOptions;
import com.google.gwt.junit.client.GWTTestCase;

public class ClientLocationTest extends GWTTestCase {
  private static final int ASYNC_DELAY_MSEC = 10000;

  @Override
  public String getModuleName() {
    return "com.google.gwt.ajaxloader.AjaxLoader";
  }

  public void testClientLocation() {
    delayTestFinish(ASYNC_DELAY_MSEC);
    AjaxLoaderOptions options = AjaxLoaderOptions.newInstance();
    Runnable onLoad = new Runnable() {
      public void run() {
        ClientLocation clientLocation = AjaxLoader.getClientLocation();
        if (clientLocation == null) {
          fail("Client's location cannot be resolved.");
        }
        assertNotNull(clientLocation.getCity());
        assertNotNull(clientLocation.getCountry());
        assertNotNull(clientLocation.getCountryCode());
        assertNotNull(clientLocation.getLatitude());
        assertNotNull(clientLocation.getLongitude());
        assertNotNull(clientLocation.getRegion());
        finishTest();
      }
    };
    AjaxLoader.loadApi("search", "1", onLoad, options);
  }
}
TOP

Related Classes of com.google.gwt.ajaxloader.client.ClientLocationTest

TOP
Copyright © 2018 www.massapi.com. 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.