Bug 967325 - Implement GeckoRequest tests. r=jchen,mcomella

This commit is contained in:
Brian Nicholson
2014-08-11 19:37:39 -07:00
parent b5d6c07f19
commit 3fa361efe3
4 changed files with 181 additions and 0 deletions

View File

@@ -5,6 +5,8 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.json.JSONException;
import org.json.JSONObject;
import org.mozilla.gecko.mozglue.RobocopTarget;
import android.util.Log;
public abstract class GeckoRequest {
@@ -24,6 +26,7 @@ public abstract class GeckoRequest {
* @param data Data to send with this request, which can be any object serializeable by
* {@link JSONObject#put(String, Object)}.
*/
@RobocopTarget
public GeckoRequest(String name, Object data) {
this.name = name;
final JSONObject message = new JSONObject();
@@ -68,6 +71,7 @@ public abstract class GeckoRequest {
*
* @param nativeJSObject The response data from Gecko
*/
@RobocopTarget
public abstract void onResponse(NativeJSObject nativeJSObject);
/**
@@ -80,6 +84,7 @@ public abstract class GeckoRequest {
*
* @throws RuntimeException
*/
@RobocopTarget
public void onError() {
throw new RuntimeException("Unhandled error for GeckoRequest: " + name);
}