| Index: android_webview/javatests/src/org/chromium/android_webview/test/TestAwContentsClient.java
|
| diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/TestAwContentsClient.java b/android_webview/javatests/src/org/chromium/android_webview/test/TestAwContentsClient.java
|
| index 97cb7f1ad457ee4969b75c1633d5e53a6c391682..ccd0da3ea105ff5f94668deac9938f8498320b0a 100644
|
| --- a/android_webview/javatests/src/org/chromium/android_webview/test/TestAwContentsClient.java
|
| +++ b/android_webview/javatests/src/org/chromium/android_webview/test/TestAwContentsClient.java
|
| @@ -19,6 +19,8 @@ class TestAwContentsClient extends NullContentsClient {
|
| private final OnPageStartedHelper mOnPageStartedHelper;
|
| private final OnPageFinishedHelper mOnPageFinishedHelper;
|
| private final OnReceivedErrorHelper mOnReceivedErrorHelper;
|
| + private final OnDownloadStartHelper mOnDownloadStartHelper;
|
| + private final OnReceivedLoginRequestHelper mOnReceivedLoginRequestHelper;
|
| private final OnEvaluateJavaScriptResultHelper mOnEvaluateJavaScriptResultHelper;
|
| private final AddMessageToConsoleHelper mAddMessageToConsoleHelper;
|
| private final OnScaleChangedHelper mOnScaleChangedHelper;
|
| @@ -30,6 +32,8 @@ class TestAwContentsClient extends NullContentsClient {
|
| mOnPageStartedHelper = new OnPageStartedHelper();
|
| mOnPageFinishedHelper = new OnPageFinishedHelper();
|
| mOnReceivedErrorHelper = new OnReceivedErrorHelper();
|
| + mOnDownloadStartHelper = new OnDownloadStartHelper();
|
| + mOnReceivedLoginRequestHelper = new OnReceivedLoginRequestHelper();
|
| mOnEvaluateJavaScriptResultHelper = new OnEvaluateJavaScriptResultHelper();
|
| mAddMessageToConsoleHelper = new AddMessageToConsoleHelper();
|
| mOnScaleChangedHelper = new OnScaleChangedHelper();
|
| @@ -49,6 +53,14 @@ class TestAwContentsClient extends NullContentsClient {
|
| return mOnReceivedErrorHelper;
|
| }
|
|
|
| + public OnDownloadStartHelper getOnDownloadStartHelper() {
|
| + return mOnDownloadStartHelper;
|
| + }
|
| +
|
| + public OnReceivedLoginRequestHelper getOnReceivedLoginRequestHelper() {
|
| + return mOnReceivedLoginRequestHelper;
|
| + }
|
| +
|
| public OnEvaluateJavaScriptResultHelper getOnEvaluateJavaScriptResultHelper() {
|
| return mOnEvaluateJavaScriptResultHelper;
|
| }
|
| @@ -69,6 +81,15 @@ class TestAwContentsClient extends NullContentsClient {
|
| mCurrentScale = newScale;
|
| super.notifyCalled();
|
| }
|
| +
|
| + public float getOldScale() {
|
| + return mPreviousScale;
|
| + }
|
| +
|
| + public float getNewScale() {
|
| + return mCurrentScale;
|
| + }
|
| +
|
| public float getLastScaleRatio() {
|
| assert getCallCount() > 0;
|
| return mCurrentScale / mPreviousScale;
|
| @@ -107,6 +128,98 @@ class TestAwContentsClient extends NullContentsClient {
|
| mOnReceivedErrorHelper.notifyCalled(errorCode, description, failingUrl);
|
| }
|
|
|
| + /**
|
| + * CallbackHelper for OnDownloadStart.
|
| + */
|
| + public static class OnDownloadStartHelper extends CallbackHelper {
|
| + private String mUrl;
|
| + private String mUserAgent;
|
| + private String mContentDisposition;
|
| + private String mMimeType;
|
| + long mContentLength;
|
| +
|
| + public String getUrl() {
|
| + assert getCallCount() > 0;
|
| + return mUrl;
|
| + }
|
| +
|
| + public String getUserAgent() {
|
| + assert getCallCount() > 0;
|
| + return mUserAgent;
|
| + }
|
| +
|
| + public String getContentDisposition() {
|
| + assert getCallCount() > 0;
|
| + return mContentDisposition;
|
| + }
|
| +
|
| + public String getMimeType() {
|
| + assert getCallCount() > 0;
|
| + return mMimeType;
|
| + }
|
| +
|
| + public long getContentLength() {
|
| + assert getCallCount() > 0;
|
| + return mContentLength;
|
| + }
|
| +
|
| + public void notifyCalled(String url, String userAgent, String contentDisposition,
|
| + String mimeType, long contentLength) {
|
| + mUrl = url;
|
| + mUserAgent = userAgent;
|
| + mContentDisposition = contentDisposition;
|
| + mMimeType = mimeType;
|
| + mContentLength = contentLength;
|
| + notifyCalled();
|
| + }
|
| + }
|
| +
|
| + @Override
|
| + public void onDownloadStart(String url,
|
| + String userAgent,
|
| + String contentDisposition,
|
| + String mimeType,
|
| + long contentLength) {
|
| + getOnDownloadStartHelper().notifyCalled(url, userAgent, contentDisposition, mimeType,
|
| + contentLength);
|
| + }
|
| +
|
| + /**
|
| + * CallbackHelper for OnReceivedLoginRequest.
|
| + */
|
| + public static class OnReceivedLoginRequestHelper extends CallbackHelper {
|
| + private String mRealm;
|
| + private String mAccount;
|
| + private String mArgs;
|
| +
|
| + public String getRealm() {
|
| + assert getCallCount() > 0;
|
| + return mRealm;
|
| + }
|
| +
|
| + public String getAccount() {
|
| + assert getCallCount() > 0;
|
| + return mAccount;
|
| + }
|
| +
|
| + public String getArgs() {
|
| + assert getCallCount() > 0;
|
| + return mArgs;
|
| + }
|
| +
|
| + public void notifyCalled(String realm, String account, String args) {
|
| + mRealm = realm;
|
| + mAccount = account;
|
| + mArgs = args;
|
| + notifyCalled();
|
| + }
|
| + }
|
| +
|
| + @Override
|
| + public void onReceivedLoginRequest(String realm, String account, String args) {
|
| + getOnReceivedLoginRequestHelper().notifyCalled(realm, account, args);
|
| + }
|
| +
|
| @Override
|
| public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
|
| mAddMessageToConsoleHelper.notifyCalled(consoleMessage.messageLevel().ordinal(),
|
|
|