Bug 737411 - Robocop: update reflection references; r=kats

This commit is contained in:
Geoff Brown 2012-03-22 13:35:19 -04:00
parent 97f4b320f3
commit 8dda642283
9 changed files with 45 additions and 11 deletions

View File

@ -100,9 +100,9 @@ public class FennecNativeActions implements Actions {
parameters[0] = mGe;
mSendGE = mGas.getMethod("sendEventToGecko", parameters);
mGetLayerClient = activity.getClass().getMethod("getSoftwareLayerClient");
Class gslc = mClassLoader.loadClass("org.mozilla.gecko.gfx.GeckoSoftwareLayerClient");
mDrawListener = mClassLoader.loadClass("org.mozilla.gecko.gfx.GeckoSoftwareLayerClient$DrawListener");
mGetLayerClient = activity.getClass().getMethod("getLayerClient");
Class gslc = mClassLoader.loadClass("org.mozilla.gecko.gfx.GeckoLayerClient");
mDrawListener = mClassLoader.loadClass("org.mozilla.gecko.gfx.GeckoLayerClient$DrawListener");
mSetDrawListener = gslc.getDeclaredMethod("setDrawListener", mDrawListener);
} catch (ClassNotFoundException e) {
e.printStackTrace();

View File

@ -284,17 +284,22 @@ public class FennecNativeDriver implements Driver {
return 0.0f;
}
private GLSurfaceView getSurfaceView() {
for (View v : mSolo.getCurrentViews()) {
if (v instanceof GLSurfaceView) {
return (GLSurfaceView)v;
private View getSurfaceView() {
try {
Class c = Class.forName("org.mozilla.gecko.gfx.LayerView");
for (View v : mSolo.getCurrentViews()) {
if (c.isInstance(v)) {
return v;
}
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return null;
}
public PaintedSurface getPaintedSurface() {
GLSurfaceView view = getSurfaceView();
View view = getSurfaceView();
if (view == null) {
return null;
}

View File

@ -2784,6 +2784,7 @@ abstract public class GeckoApp
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Tab:Add", args.toString()));
}
/* This method is referenced by Robocop via reflection. */
public GeckoLayerClient getLayerClient() { return mLayerClient; }
public LayerController getLayerController() { return mLayerController; }

View File

@ -372,6 +372,7 @@ public class GeckoAppShell
putLocaleEnv();
}
/* This method is referenced by Robocop via reflection. */
public static void loadSQLiteLibs(Context context, String apkName) {
if (sSQLiteLibsLoaded)
return;
@ -482,6 +483,7 @@ public class GeckoAppShell
} catch (NoSuchElementException e) {}
}
/* This method is referenced by Robocop via reflection. */
public static void sendEventToGecko(GeckoEvent e) {
if (GeckoApp.checkLaunchState(GeckoApp.LaunchState.GeckoRunning)) {
notifyGeckoOfEvent(e);
@ -1663,6 +1665,7 @@ public class GeckoAppShell
}
}
/* This method is referenced by Robocop via reflection. */
public static void registerGeckoEventListener(String event, GeckoEventListener listener) {
if (mEventListeners == null)
mEventListeners = new HashMap<String, ArrayList<GeckoEventListener>>();
@ -1692,6 +1695,7 @@ public class GeckoAppShell
}
}
/* This method is referenced by Robocop via reflection. */
public static void unregisterGeckoEventListener(String event, GeckoEventListener listener) {
if (mEventListeners == null)
return;

View File

@ -63,6 +63,9 @@ import android.util.Log;
* Fields have different meanings depending on the event type.
*/
/* This class is referenced by Robocop via reflection; use care when
* modifying the signature.
*/
public class GeckoEvent {
private static final String LOGTAG = "GeckoEvent";

View File

@ -39,6 +39,9 @@ package org.mozilla.gecko;
import org.json.JSONObject;
/* This class is referenced by Robocop via reflection; use care when
* modifying the signature.
*/
public interface GeckoEventListener {
public void handleMessage(String event, JSONObject message);
}

View File

@ -62,6 +62,8 @@ import java.util.LinkedList;
*
* This view delegates to LayerRenderer to actually do the drawing. Its role is largely that of a
* mediator between the LayerRenderer and the LayerController.
*
* Note that LayerView is accessed by Robocop via reflection.
*/
public class LayerView extends FlexibleGLSurfaceView {
private Context mContext;

View File

@ -113,6 +113,7 @@ public class SQLiteBridge {
return rawQuery(sb.toString(), selectionArgs);
}
/* This method is referenced by Robocop via reflection. */
public Cursor rawQuery(String sql, String[] selectionArgs)
throws SQLiteBridgeException {
return internalQuery(sql, selectionArgs);

View File

@ -10,12 +10,22 @@ class PixelTest extends BaseTest {
Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
loadUrl(url);
paintExpecter.blockUntilClear(PAINT_CLEAR_DELAY);
return mDriver.getPaintedSurface();
PaintedSurface p = mDriver.getPaintedSurface();
if (p == null) {
mAsserter.ok(p != null, "checking that painted surface loaded",
"painted surface loaded");
}
return p;
}
protected final PaintedSurface waitForPaint(Actions.RepeatedEventExpecter expecter) {
expecter.blockUntilClear(PAINT_CLEAR_DELAY);
return mDriver.getPaintedSurface();
PaintedSurface p = mDriver.getPaintedSurface();
if (p == null) {
mAsserter.ok(p != null, "checking that painted surface loaded",
"painted surface loaded");
}
return p;
}
protected final PaintedSurface waitWithNoPaint(Actions.RepeatedEventExpecter expecter) {
@ -25,7 +35,12 @@ class PixelTest extends BaseTest {
ie.printStackTrace();
}
mAsserter.is(expecter.eventReceived(), false, "Checking gecko didn't draw unnecessarily");
return mDriver.getPaintedSurface();
PaintedSurface p = mDriver.getPaintedSurface();
if (p == null) {
mAsserter.ok(p != null, "checking that painted surface loaded",
"painted surface loaded");
}
return p;
}
// this matches the algorithm in robocop_boxes.html