Esempio n. 1
0
  /*
   * 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);
 }
Esempio n. 3
0
 private static void fireOnMessagesDeleted(String payload) {
   webView.sendJavascript("chrome.gcm.onMessagesDeleted.fire()");
 }
Esempio n. 4
0
 private static void fireOnSendError(String payload) {
   String mid = "1";
   String mtext = payload;
   webView.sendJavascript(
       "chrome.gcm.onSendError.fire({messageId:'" + mid + "', errorMessage:'" + mtext + "'})");
 }
Esempio n. 5
0
 private static void fireOnMessage(String payload) {
   webView.sendJavascript("chrome.gcm.onMessage.fire({data:" + payload + "})");
 }