summaryrefslogtreecommitdiffstats
path: root/android_webview/test
diff options
context:
space:
mode:
authorboliu <boliu@chromium.org>2014-11-04 14:38:30 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-04 22:39:28 +0000
commit8aa9b775556f58cfddb77dcafc28e28e22de6732 (patch)
treef5821cfdc21c2340726d1070f834b13275245605 /android_webview/test
parentac1db38b82e5dfdddced45bc77e126a85ef01ce0 (diff)
downloadchromium_src-8aa9b775556f58cfddb77dcafc28e28e22de6732.zip
chromium_src-8aa9b775556f58cfddb77dcafc28e28e22de6732.tar.gz
chromium_src-8aa9b775556f58cfddb77dcafc28e28e22de6732.tar.bz2
aw: Add test to ensure hardware mode works
We might accidentally turn off hardware acceleration in instrumentation tests without knowing since tests are supposed to work in software mode as well. So add a meta test to check this. BUG= Review URL: https://codereview.chromium.org/687803009 Cr-Commit-Position: refs/heads/master@{#302690}
Diffstat (limited to 'android_webview/test')
-rw-r--r--android_webview/test/shell/src/org/chromium/android_webview/test/AwTestContainerView.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/android_webview/test/shell/src/org/chromium/android_webview/test/AwTestContainerView.java b/android_webview/test/shell/src/org/chromium/android_webview/test/AwTestContainerView.java
index 3f99e9b..9d40ddc 100644
--- a/android_webview/test/shell/src/org/chromium/android_webview/test/AwTestContainerView.java
+++ b/android_webview/test/shell/src/org/chromium/android_webview/test/AwTestContainerView.java
@@ -39,7 +39,7 @@ public class AwTestContainerView extends FrameLayout {
private AwContents.NativeGLDelegate mNativeGLDelegate;
private AwContents.InternalAccessDelegate mInternalAccessDelegate;
- HardwareView mHardwareView = null;
+ private HardwareView mHardwareView = null;
private boolean mAttachedContents = false;
private class HardwareView extends GLSurfaceView {
@@ -232,7 +232,7 @@ public class AwTestContainerView extends FrameLayout {
if (allowHardwareAcceleration) {
mHardwareView = createHardwareViewOnlyOnce(context);
}
- if (mHardwareView != null) {
+ if (isBackedByHardwareView()) {
addView(mHardwareView,
new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT,
@@ -249,12 +249,16 @@ public class AwTestContainerView extends FrameLayout {
public void initialize(AwContents awContents) {
mAwContents = awContents;
- if (mHardwareView != null) {
+ if (isBackedByHardwareView()) {
mHardwareView.initialize(
mAwContents.getAwDrawGLFunction(), mAwContents.getAwDrawGLViewContext());
}
}
+ public boolean isBackedByHardwareView() {
+ return mHardwareView != null;
+ }
+
public ContentViewCore getContentViewCore() {
return mAwContents.getContentViewCore();
}
@@ -380,7 +384,7 @@ public class AwTestContainerView extends FrameLayout {
@Override
public void onDraw(Canvas canvas) {
- if (mHardwareView != null) {
+ if (isBackedByHardwareView()) {
mHardwareView.updateScroll(getScrollX(), getScrollY());
}
mAwContents.onDraw(canvas);
@@ -417,14 +421,14 @@ public class AwTestContainerView extends FrameLayout {
@Override
public boolean requestDrawGL(Canvas canvas, boolean waitForCompletion,
View containerview) {
- if (mHardwareView == null) return false;
+ if (!isBackedByHardwareView()) return false;
mHardwareView.requestRender(canvas, waitForCompletion);
return true;
}
@Override
public void detachGLFunctor() {
- if (mHardwareView != null) mHardwareView.detachGLFunctor();
+ if (isBackedByHardwareView()) mHardwareView.detachGLFunctor();
}
}
@@ -466,7 +470,7 @@ public class AwTestContainerView extends FrameLayout {
public void super_scrollTo(int scrollX, int scrollY) {
// We're intentionally not calling super.scrollTo here to make testing easier.
AwTestContainerView.this.scrollTo(scrollX, scrollY);
- if (mHardwareView != null) {
+ if (isBackedByHardwareView()) {
// Undo the scroll that will be applied because of mHardwareView
// being a child of |this|.
mHardwareView.setTranslationX(scrollX);