aboutsummaryrefslogtreecommitdiffstats
path: root/devtest
diff options
context:
space:
mode:
Diffstat (limited to 'devtest')
-rw-r--r--devtest/pom.xml29
-rw-r--r--devtest/src/main/java/com/google/gwt/query/DevTestRunner.gwt.xml1
-rw-r--r--devtest/src/main/java/com/google/gwt/query/client/DevTestRunner.java89
3 files changed, 118 insertions, 1 deletions
diff --git a/devtest/pom.xml b/devtest/pom.xml
index 3f73740f..42e25b56 100644
--- a/devtest/pom.xml
+++ b/devtest/pom.xml
@@ -31,6 +31,11 @@
<version>${gwtversion}</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-codeserver</artifactId>
+ <version>${gwtversion}</version>
+ </dependency>
</dependencies>
<build>
<resources>
@@ -89,6 +94,30 @@
</additionalProjectnatures>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.2.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <mainClass>com.google.gwt.dev.codeserver.CodeServer</mainClass>
+ <arguments>
+ <argument>-src</argument>
+ <argument>src/main/java</argument>
+ <argument>-bindAddress</argument>
+ <argument>0.0.0.0</argument>
+ <argument>com.google.gwt.query.DevTestRunner</argument>
+ </arguments>
+ <classpathScope>compile</classpathScope>
+ </configuration>
+ </plugin>
+
</plugins>
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
</build>
diff --git a/devtest/src/main/java/com/google/gwt/query/DevTestRunner.gwt.xml b/devtest/src/main/java/com/google/gwt/query/DevTestRunner.gwt.xml
index 401fde05..b3ce809f 100644
--- a/devtest/src/main/java/com/google/gwt/query/DevTestRunner.gwt.xml
+++ b/devtest/src/main/java/com/google/gwt/query/DevTestRunner.gwt.xml
@@ -1,5 +1,6 @@
<module rename-to="test">
<inherits name='com.google.gwt.query.Query'/>
<entry-point class='com.google.gwt.query.client.DevTestRunner'/>
+ <set-property name="compiler.useSourceMaps" value="false"/>
</module>
diff --git a/devtest/src/main/java/com/google/gwt/query/client/DevTestRunner.java b/devtest/src/main/java/com/google/gwt/query/client/DevTestRunner.java
index 53ef8e18..18de0c87 100644
--- a/devtest/src/main/java/com/google/gwt/query/client/DevTestRunner.java
+++ b/devtest/src/main/java/com/google/gwt/query/client/DevTestRunner.java
@@ -22,6 +22,9 @@ import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.RepeatingCommand;
import com.google.gwt.query.client.js.JsUtils;
+import com.google.gwt.query.client.plugins.ajax.Ajax;
+import com.google.gwt.query.client.plugins.ajax.Ajax.Settings;
+import com.google.gwt.user.client.Window;
/**
* This module is thought to emulate a test environment similar to
@@ -45,8 +48,92 @@ public class DevTestRunner extends MyTestCase implements EntryPoint {
$(e).html("").after("<div>ERROR: " + ex.getMessage() + "</div>");
}
}
-
+
public void testSomething() {
+ System.out.println("com");
+
+ delayTestFinish(5000);
+ String nonJsonpUrl = "http://127.0.0.1/nopage";
+
+ Settings s = Ajax.createSettings();
+ s.setTimeout(1000);
+ s.setSuccess(new Function(){
+ public void f() {
+ fail();
+ }
+ });
+ s.setError(new Function(){
+ public void f() {
+ finishTest();
+ }
+ });
+ s.setDataType("jsonp");
+ s.setUrl(nonJsonpUrl);
+
+ Ajax.ajax(s);
+
+// GQuery.ajax(Ajax.createSettings()
+// .setUrl("test.html")
+// .setDataType("txt") // txt, json, jsonp, xml
+// .setType("get") // post, get
+// .setData(GQuery.$$("param1: 1, param2: 2")) // parameters for the query-string
+// .setTimeout(3000)
+// .setSuccess(new Function(){ // callback to be run if the request success
+// public void f() {
+// // The response when dataType=xml, is a dom tree which we can traverse using gquery
+// Window.alert("ok");
+// }
+// })
+//// .setError(new Function(){ // callback to be run if the request fails
+//// public void f() {
+//// Window.alert("There was an error" + getDataObject());
+//// }
+//// })
+// ).done(new Function(){
+// public void f() {
+// System.out.println("Aqui");
+// }
+// }, new Function(){
+// public void f() {
+// System.out.println("Aqui2");
+// }
+// }
+// );
+//
+
+
+// Settings set = Ajax.createSettings();
+//
+// $(window).delay(1000, new Function(){
+// public void f() {
+// System.out.println("Run 1");
+// }
+// });
+// $(window).delay(3000, new Function(){
+// public void f() {
+// System.out.println("Run 3");
+// }
+// });
+ }
+
+
+ private native void setWindowVars() /*-{
+ $wnd._boolean = true;
+ $wnd._number = 0.56;
+ $wnd._string = "string";
+ $wnd._element = $doc.body;
+ $wnd._object = $wnd.console;
+ }-*/;
+
+ public void testSomething2() {
+ setWindowVars();
+ System.out.println($(window).prop("_boolean"));
+ System.out.println($(window).propString("_string"));
+ System.out.println($(window).propDouble("_number"));
+ System.out.println($(window).propObject("_boolean"));
+ System.out.println($(window).propJSO("_element"));
+ Object o = window.getPropertyObject("_element");
+ System.out.println(o);
// Copy and paste any test from the gquery suite
}