/* * Sends a json object to the client as parameter to a method which is defined in gECB. */ public static void sendJavascript(JSONObject _json) { String _d = "javascript:" + gECB + "(" + _json.toString() + ")"; Log.v(TAG, "sendJavascript: " + _d); if (gECB != null && gWebView != null) { gWebView.sendJavascript(_d); } }
public void testViaHref() { testView.sendJavascript("window.location = 'sample2.html';"); sleep(); String url = mUiThread.getUrl(); assertTrue(url.endsWith("sample2.html")); testView.sendJavascript("window.location = 'sample3.html';"); sleep(); url = mUiThread.getUrl(); assertTrue(url.endsWith("sample3.html")); boolean didGoBack = mUiThread.backHistory(); sleep(); url = mUiThread.getUrl(); assertTrue(url.endsWith("sample2.html")); assertTrue(didGoBack); didGoBack = mUiThread.backHistory(); sleep(); url = mUiThread.getUrl(); assertTrue(url.endsWith("index.html")); assertTrue(didGoBack); }
private static void fireOnMessagesDeleted(String payload) { webView.sendJavascript("chrome.gcm.onMessagesDeleted.fire()"); }
private static void fireOnSendError(String payload) { String mid = "1"; String mtext = payload; webView.sendJavascript( "chrome.gcm.onSendError.fire({messageId:'" + mid + "', errorMessage:'" + mtext + "'})"); }
private static void fireOnMessage(String payload) { webView.sendJavascript("chrome.gcm.onMessage.fire({data:" + payload + "})"); }