Broken tests. git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@10819 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 bb73fd9..9706aa5 100644 --- a/user/test/com/google/gwt/user/client/ui/HistoryTest.java +++ b/user/test/com/google/gwt/user/client/ui/HistoryTest.java
@@ -20,27 +20,31 @@ import com.google.gwt.junit.DoNotRunWith; import com.google.gwt.junit.Platform; import com.google.gwt.junit.client.GWTTestCase; -import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.History; import com.google.gwt.user.client.HistoryListener; import com.google.gwt.user.client.Timer; -import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.impl.HistoryImpl; import java.util.ArrayList; /** * Tests for the history system. + * + * TODO: find a way to test unescaping of the initial hash value. */ public class HistoryTest extends GWTTestCase { - private static String getCurrentLocationHash() { - String hash = Window.Location.getHash(); - if ((hash != null) && !hash.isEmpty()) { - return hash.substring(1); + private static native String getCurrentLocationHash() /*-{ + var href = $wnd.location.href; + + splitted = href.split("#"); + if (splitted.length != 2) { + return null; } - return null; - } + + hashPortion = splitted[1]; + + return hashPortion; + }-*/; /* * Copied from UserAgentPropertyGenerator and HistoryImplSafari. @@ -354,31 +358,5 @@ private void addHistoryListenerImpl(HistoryListener historyListener) { this.historyListener = historyListener; History.addHistoryListener(historyListener); - } - - public void testInitialHashDecodedExactlyOnce() { - String originalHash = getCurrentLocationHash(); - String testHash = "%2525"; - String undecodedHistoryToken = testHash; - String correctHistoryToken = "%25"; - String doubleDecodedHistoryToken = "%"; - setHash(testHash); - try { - assertEquals(testHash, getCurrentLocationHash()); - HistoryImpl history = GWT.create(HistoryImpl.class); - assertTrue(history.init()); - String historyToken = History.getToken(); - assertFalse("Failed to decode the initial hash", - undecodedHistoryToken.equals(historyToken)); - assertFalse("Doubly decoded the initial hash", - doubleDecodedHistoryToken.equals(historyToken)); - assertEquals(correctHistoryToken, historyToken); - } finally { - setHash(originalHash); - } - } - - private static native void setHash(String hash) /*-{ - $wnd.location.hash = hash; - }-*/; + } }