Committing missing test change from r911.
Patch by: rdayal
Review by: jgw
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@1000 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/test/com/google/gwt/user/client/ui/HistoryTest.java b/user/test/com/google/gwt/user/client/ui/HistoryTest.java
index a3aa1e6..769c242 100644
--- a/user/test/com/google/gwt/user/client/ui/HistoryTest.java
+++ b/user/test/com/google/gwt/user/client/ui/HistoryTest.java
@@ -85,4 +85,33 @@
History.newItem("foo bar");
}
+
+ /*
+ * Tests against issue #879: Ensure that empty history tokens do not add
+ * additional characters after the '#' symbol in the URL.
+ */
+ public void testEmptyHistoryTokens() {
+ delayTestFinish(5000);
+
+ History.addHistoryListener(new HistoryListener() {
+ public void onHistoryChanged(String historyToken) {
+
+ if (historyToken == null) {
+ fail("historyToken should not be null");
+ }
+
+ if (historyToken.equals("foobar")) {
+ History.newItem("");
+ } else {
+ assertEquals(0, historyToken.length());
+ finishTest();
+ }
+ }
+ });
+
+ // We must first start out with a non-blank history token. Adding a blank
+ // history token in the initial state will not cause an onHistoryChanged
+ // event to fire.
+ History.newItem("foobar");
+ }
}