diff options
author | Guang Zhu <guangzhu@google.com> | 2012-03-05 15:31:04 -0800 |
---|---|---|
committer | Guang Zhu <guangzhu@google.com> | 2012-03-05 15:33:17 -0800 |
commit | 3ae8c42152d890ab771053fa6b16b038ee44326d (patch) | |
tree | 5a4dab5c9ccc09a7763726299b7b2a60d0c6405a /tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java | |
parent | d55191d0866550f245907dba9152753744c2935c (diff) |
Update to DumpRenderTree test harness
* removed some unused parameters
* removed obsolete live website test harness
* updated test class so that mean suite time for page cycler
is emmitted via instrumentation status
Change-Id: Iccb40f70a62a4ac9b8d5bceab9a6a715c611c573
Diffstat (limited to 'tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java')
-rw-r--r-- | tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java | 58 |
1 files changed, 4 insertions, 54 deletions
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java index 856ebcc7dfb4..d151d9e2dbdb 100644 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java @@ -25,9 +25,6 @@ import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.graphics.Bitmap; -import android.graphics.Bitmap.CompressFormat; -import android.graphics.Bitmap.Config; -import android.graphics.Canvas; import android.net.http.SslError; import android.os.Bundle; import android.os.Environment; @@ -200,8 +197,6 @@ public class TestShellActivity extends Activity implements LayoutTestController mResultFile = intent.getStringExtra(RESULT_FILE); mTimeoutInMillis = intent.getIntExtra(TIMEOUT_IN_MILLIS, 0); - mGetDrawtime = intent.getBooleanExtra(GET_DRAW_TIME, false); - mSaveImagePath = intent.getStringExtra(SAVE_IMAGE); mStopOnRefError = intent.getBooleanExtra(STOP_ON_REF_ERROR, false); setTitle("Test " + mCurrentTestNumber + " of " + mTotalTestCount); float ratio = (float)mCurrentTestNumber / mTotalTestCount; @@ -311,6 +306,10 @@ public class TestShellActivity extends Activity implements LayoutTestController return; } + if (mCallback != null) { + mCallback.dumpResult(webkitData); + } + try { File parentDir = new File(mResultFile).getParentFile(); if (!parentDir.exists()) { @@ -564,18 +563,6 @@ public class TestShellActivity extends Activity implements LayoutTestController public void onPageFinished(WebView view, String url) { Log.v(LOGTAG, "onPageFinished, url=" + url); mPageFinished = true; - // get page draw time - if (FsUtils.isTestPageUrl(url)) { - if (mGetDrawtime) { - long[] times = new long[DRAW_RUNS]; - times = getDrawWebViewTime(mWebView, DRAW_RUNS); - FsUtils.writeDrawTime(DRAW_TIME_LOG, url, times); - } - if (mSaveImagePath != null) { - String name = FsUtils.getLastSegmentInPath(url); - drawPageToFile(mSaveImagePath + "/" + name + ".png", mWebView); - } - } // Calling finished() will check if we've met all the conditions for completing // this test and move to the next one if we are ready. Otherwise we ask WebCore to @@ -830,47 +817,12 @@ public class TestShellActivity extends Activity implements LayoutTestController mEventSender.clearTouchMetaState(); mPageFinished = false; mDumpWebKitData = false; - mGetDrawtime = false; - mSaveImagePath = null; setDefaultWebSettings(mWebView); mIsGeolocationPermissionSet = false; mPendingGeolocationPermissionCallbacks = null; CookieManager.getInstance().removeAllCookie(); } - private long[] getDrawWebViewTime(WebView view, int count) { - if (count == 0) - return null; - long[] ret = new long[count]; - long start; - Canvas canvas = new Canvas(); - Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Config.ARGB_8888); - canvas.setBitmap(bitmap); - for (int i = 0; i < count; i++) { - start = System.currentTimeMillis(); - view.draw(canvas); - ret[i] = System.currentTimeMillis() - start; - } - return ret; - } - - private void drawPageToFile(String fileName, WebView view) { - Canvas canvas = new Canvas(); - Bitmap bitmap = Bitmap.createBitmap(view.getContentWidth(), view.getContentHeight(), - Config.ARGB_8888); - canvas.setBitmap(bitmap); - WebViewClassic.fromWebView(view).drawPage(canvas); - try { - FileOutputStream fos = new FileOutputStream(fileName); - if(!bitmap.compress(CompressFormat.PNG, 90, fos)) { - Log.w(LOGTAG, "Failed to compress and save image."); - } - } catch (IOException ioe) { - Log.e(LOGTAG, "", ioe); - } - bitmap.recycle(); - } - private boolean canMoveToNextTest() { return (mDumpWebKitData && mPageFinished && !mWaitUntilDone) || mTimedOut; } @@ -922,9 +874,7 @@ public class TestShellActivity extends Activity implements LayoutTestController private String mResultFile; private int mTimeoutInMillis; private String mUiAutoTestPath; - private String mSaveImagePath; private BufferedReader mTestListReader; - private boolean mGetDrawtime; private int mTotalTestCount; private int mCurrentTestNumber; private boolean mStopOnRefError; |