Merge m-c to fx-team a=merge
authorWes Kocher <wkocher@mozilla.com>
Fri, 13 Feb 2015 13:52:03 -0800
changeset 229036 0f829e7ccd2ff21fa02a9feb521ab5b61fef0ef1
parent 229035 2439c229cacea574a5b398c8c766df447732b90b (current diff)
parent 229008 992cf3981ca81ea65fb13cfca3f1906b7857b922 (diff)
child 229037 6229b91659cf6047741f48504f90b1a70c0b8a35
push id28280
push usercbook@mozilla.com
push dateMon, 16 Feb 2015 14:48:41 +0000
treeherdermozilla-central@2a6a0c025c7b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge m-c to fx-team a=merge
mobile/android/base/tests/testFindInPage.java
--- a/mobile/android/base/tests/testFindInPage.java
+++ b/mobile/android/base/tests/testFindInPage.java
@@ -6,51 +6,47 @@ package org.mozilla.gecko.tests;
 
 import static org.mozilla.gecko.tests.helpers.AssertionHelper.fFail;
 
 import org.mozilla.gecko.Actions;
 import org.mozilla.gecko.Element;
 import org.mozilla.gecko.R;
 
 import org.mozilla.gecko.EventDispatcher;
+import org.mozilla.gecko.util.GeckoEventListener;
 
-import org.mozilla.gecko.util.EventCallback;
-import org.mozilla.gecko.util.NativeEventListener;
-import org.mozilla.gecko.util.NativeJSObject;
+import org.json.JSONObject;
 
-public class testFindInPage extends JavascriptTest implements NativeEventListener {
+public class testFindInPage extends JavascriptTest implements GeckoEventListener {
     private static final int WAIT_FOR_TEST = 3000;
     protected Element next, close;
 
     public testFindInPage() {
         super("testFindInPage.js");
     }
 
     @Override
-    public void handleMessage(final String event, final NativeJSObject message,
-                              final EventCallback callback) {
+    public void handleMessage(String event, final JSONObject message) {
         if (event.equals("Test:FindInPage")) {
             try {
                 final String text = message.getString("text");
-                final int nrOfMatches = message.getInt("nrOfMatches");
+                final int nrOfMatches = Integer.parseInt(message.getString("nrOfMatches"));
                 findText(text, nrOfMatches);
             } catch (Exception e) {
-                callback.sendError("Can't extract find query from JSON :" + e.toString());
+                fFail("Can't extract find query from JSON");
             }
         }
 
         if (event.equals("Test:CloseFindInPage")) {
             try {
                 close.click();
             } catch (Exception e) {
-                callback.sendError("FindInPage prompt not opened");
+                fFail("FindInPage prompt not opened");
             }
         }
-
-        callback.sendSuccess("done");
     }
 
     @Override
     public void setUp() throws Exception {
         super.setUp();
 
         EventDispatcher.getInstance().registerGeckoThreadListener(this,
                 "Test:FindInPage",
--- a/mobile/android/base/tests/testFindInPage.js
+++ b/mobile/android/base/tests/testFindInPage.js
@@ -30,31 +30,27 @@ function openTabWithUrl(url) {
   let browserApp = Services.wm.getMostRecentWindow("navigator:browser").BrowserApp;
   let browser = browserApp.addTab(url, { selected: true, parentId: browserApp.selectedTab.id }).browser;
 
   return promiseBrowserEvent(browser, "load")
     .then(() => { return browser; });
 }
 
 function findInPage(browser, text, nrOfMatches) {
+  let repaintPromise = promiseBrowserEvent(browser, "MozAfterPaint");
   do_print("Send findInPageMessage: " + text + " nth: " + nrOfMatches);
-  let messagePromise = Messaging.sendRequestForResult({
-    type: "Test:FindInPage",
-    text: text,
-    nrOfMatches: nrOfMatches
-  });
-  let repaintPromise = promiseBrowserEvent(browser, "MozAfterPaint");
-  return Promise.all([messagePromise, repaintPromise]);
+  Messaging.sendRequest({ type: "Test:FindInPage", text: text, nrOfMatches: nrOfMatches });
+  return repaintPromise;
 }
 
 function closeFindInPage(browser) {
+  let repaintPromise = promiseBrowserEvent(browser, "MozAfterPaint");
   do_print("Send closeFindInPageMessage");
-  let messagePromise = Messaging.sendRequestForResult({ type: "Test:CloseFindInPage" });
-  let repaintPromise = promiseBrowserEvent(browser, "MozAfterPaint");
-  return Promise.all([messagePromise, repaintPromise]);
+  Messaging.sendRequest({ type: "Test:CloseFindInPage" });
+  return repaintPromise;
 }
 
 function assertSelection(document, expectedSelection = false, expectedAnchorText = false) {
   let sel = document.getSelection();
   if (!expectedSelection) {
     do_print("Assert empty selection");
     do_check_eq(sel.toString(), "");
   } else {