Merge "Add dumpChildFramesAsText function support in LayoutTestController."
This commit is contained in:
committed by
Android (Google) Code Review
commit
fedffeedb4
@@ -517,12 +517,21 @@ class BrowserFrame extends Handler {
|
||||
private native String externalRepresentation();
|
||||
|
||||
/**
|
||||
* Retrieves the visual text of the current frame, puts it as the object for
|
||||
* Retrieves the visual text of the frames, puts it as the object for
|
||||
* the message and sends the message.
|
||||
* @param callback the message to use to send the visual text
|
||||
*/
|
||||
public void documentAsText(Message callback) {
|
||||
callback.obj = documentAsText();;
|
||||
StringBuilder text = new StringBuilder();
|
||||
if (callback.arg1 != 0) {
|
||||
// Dump top frame as text.
|
||||
text.append(documentAsText());
|
||||
}
|
||||
if (callback.arg2 != 0) {
|
||||
// Dump child frames as text.
|
||||
text.append(childFramesAsText());
|
||||
}
|
||||
callback.obj = text.toString();
|
||||
callback.sendToTarget();
|
||||
}
|
||||
|
||||
@@ -531,6 +540,11 @@ class BrowserFrame extends Handler {
|
||||
*/
|
||||
private native String documentAsText();
|
||||
|
||||
/**
|
||||
* Return the text drawn on the child frames as a string
|
||||
*/
|
||||
private native String childFramesAsText();
|
||||
|
||||
/*
|
||||
* This method is called by WebCore to inform the frame that
|
||||
* the Javascript window object has been cleared.
|
||||
|
||||
@@ -74,6 +74,7 @@ public class CallbackProxy extends Handler implements EventSender, LayoutTestCon
|
||||
private static final int LAYOUT_SET_CAN_OPEN_WINDOWS = 42;
|
||||
private static final int SET_GEOLOCATION_PERMISSION = 43;
|
||||
private static final int OVERRIDE_PREFERENCE = 44;
|
||||
private static final int LAYOUT_DUMP_CHILD_FRAMES_TEXT = 45;
|
||||
|
||||
CallbackProxy(EventSender eventSender,
|
||||
LayoutTestController layoutTestController) {
|
||||
@@ -178,6 +179,10 @@ public class CallbackProxy extends Handler implements EventSender, LayoutTestCon
|
||||
mLayoutTestController.dumpAsText();
|
||||
break;
|
||||
|
||||
case LAYOUT_DUMP_CHILD_FRAMES_TEXT:
|
||||
mLayoutTestController.dumpChildFramesAsText();
|
||||
break;
|
||||
|
||||
case LAYOUT_DUMP_HISTORY:
|
||||
mLayoutTestController.dumpBackForwardList();
|
||||
break;
|
||||
@@ -380,6 +385,10 @@ public class CallbackProxy extends Handler implements EventSender, LayoutTestCon
|
||||
obtainMessage(LAYOUT_DUMP_TEXT).sendToTarget();
|
||||
}
|
||||
|
||||
public void dumpChildFramesAsText() {
|
||||
obtainMessage(LAYOUT_DUMP_CHILD_FRAMES_TEXT).sendToTarget();
|
||||
}
|
||||
|
||||
public void dumpBackForwardList() {
|
||||
obtainMessage(LAYOUT_DUMP_HISTORY).sendToTarget();
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.android.dumprendertree;
|
||||
public interface LayoutTestController {
|
||||
|
||||
public void dumpAsText();
|
||||
public void dumpChildFramesAsText();
|
||||
public void waitUntilDone();
|
||||
public void notifyDone();
|
||||
|
||||
|
||||
@@ -100,6 +100,8 @@ public class TestShellActivity extends Activity implements LayoutTestController
|
||||
Log.v(LOGTAG, "message sent to WebView to dump text.");
|
||||
switch (mDumpDataType) {
|
||||
case DUMP_AS_TEXT:
|
||||
callback.arg1 = mDumpTopFrameAsText ? 1 : 0;
|
||||
callback.arg2 = mDumpChildFramesAsText ? 1 : 0;
|
||||
mWebView.documentAsText(callback);
|
||||
break;
|
||||
case EXT_REPR:
|
||||
@@ -341,12 +343,22 @@ public class TestShellActivity extends Activity implements LayoutTestController
|
||||
// LayoutTestController Functions
|
||||
public void dumpAsText() {
|
||||
mDumpDataType = DumpDataType.DUMP_AS_TEXT;
|
||||
mDumpTopFrameAsText = true;
|
||||
if (mWebView != null) {
|
||||
String url = mWebView.getUrl();
|
||||
Log.v(LOGTAG, "dumpAsText called: "+url);
|
||||
}
|
||||
}
|
||||
|
||||
public void dumpChildFramesAsText() {
|
||||
mDumpDataType = DumpDataType.DUMP_AS_TEXT;
|
||||
mDumpChildFramesAsText = true;
|
||||
if (mWebView != null) {
|
||||
String url = mWebView.getUrl();
|
||||
Log.v(LOGTAG, "dumpChildFramesAsText called: "+url);
|
||||
}
|
||||
}
|
||||
|
||||
public void waitUntilDone() {
|
||||
mWaitUntilDone = true;
|
||||
String url = mWebView.getUrl();
|
||||
@@ -738,6 +750,8 @@ public class TestShellActivity extends Activity implements LayoutTestController
|
||||
private void resetTestStatus() {
|
||||
mWaitUntilDone = false;
|
||||
mDumpDataType = mDefaultDumpDataType;
|
||||
mDumpTopFrameAsText = false;
|
||||
mDumpChildFramesAsText = false;
|
||||
mTimedOut = false;
|
||||
mDumpTitleChanges = false;
|
||||
mRequestedWebKitData = false;
|
||||
@@ -847,6 +861,8 @@ public class TestShellActivity extends Activity implements LayoutTestController
|
||||
// Layout test controller variables.
|
||||
private DumpDataType mDumpDataType;
|
||||
private DumpDataType mDefaultDumpDataType = DumpDataType.EXT_REPR;
|
||||
private boolean mDumpTopFrameAsText;
|
||||
private boolean mDumpChildFramesAsText;
|
||||
private boolean mWaitUntilDone;
|
||||
private boolean mDumpTitleChanges;
|
||||
private StringBuffer mTitleChanges;
|
||||
|
||||
Reference in New Issue
Block a user