Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1696)

Unified Diff: android_webview/javatests/src/org/chromium/android_webview/test/TestAwContentsClient.java

Issue 12217134: [Android WebView] Implement WebSettings.{get|set}LoadWithOverviewMode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added comment for the message Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 8e113d9fefd67e604ddbfc5f0725b53b771dd3f2..2f81b57bbe9c02e62a77b66f4d37b91500507df0 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,7 @@ class TestAwContentsClient extends NullContentsClient {
private OnReceivedErrorHelper mOnReceivedErrorHelper;
private OnEvaluateJavaScriptResultHelper mOnEvaluateJavaScriptResultHelper;
private AddMessageToConsoleHelper mAddMessageToConsoleHelper;
+ private OnScaleChangedHelper mOnScaleChangedHelper;
public TestAwContentsClient() {
mOnPageStartedHelper = new OnPageStartedHelper();
@@ -26,6 +27,7 @@ class TestAwContentsClient extends NullContentsClient {
mOnReceivedErrorHelper = new OnReceivedErrorHelper();
mOnEvaluateJavaScriptResultHelper = new OnEvaluateJavaScriptResultHelper();
mAddMessageToConsoleHelper = new AddMessageToConsoleHelper();
+ mOnScaleChangedHelper = new OnScaleChangedHelper();
}
public OnPageStartedHelper getOnPageStartedHelper() {
@@ -48,6 +50,24 @@ class TestAwContentsClient extends NullContentsClient {
return mAddMessageToConsoleHelper;
}
+ public static class OnScaleChangedHelper extends CallbackHelper {
+ private float mPreviousScale;
+ private float mCurrentScale;
+ public void notifyCalled(float oldScale, float newScale) {
+ mPreviousScale = oldScale;
+ mCurrentScale = newScale;
+ super.notifyCalled();
+ }
+ public float getLastScaleRatio() {
+ assert getCallCount() > 0;
+ return mCurrentScale / mPreviousScale;
+ }
+ }
+
+ public OnScaleChangedHelper getOnScaleChangedHelper() {
+ return mOnScaleChangedHelper;
+ }
+
@Override
public void onUpdateTitle(String title) {
mUpdatedTitle = title;
@@ -113,4 +133,9 @@ class TestAwContentsClient extends NullContentsClient {
notifyCalled();
}
}
+
+ @Override
+ public void onScaleChanged(float oldScale, float newScale) {
+ mOnScaleChangedHelper.notifyCalled(oldScale, newScale);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698