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); |
+ } |
} |