summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjaekyun <jaekyun@chromium.org>2015-02-24 21:01:38 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-25 05:02:05 +0000
commit6f5632dd60a95005f7902a1ca24022d64ac2134c (patch)
tree0fc40b2b1ea249fa78a04412912f51d571d49b7e
parent996d331659456cfd796506a542e741697ec50400 (diff)
downloadchromium_src-6f5632dd60a95005f7902a1ca24022d64ac2134c.zip
chromium_src-6f5632dd60a95005f7902a1ca24022d64ac2134c.tar.gz
chromium_src-6f5632dd60a95005f7902a1ca24022d64ac2134c.tar.bz2
Make content_browsertests for Chrome on Android running with valid Views
- adds test activity layout into real view hierarchy. - runs tests after Activity.onCreate() is done. - doesn't load a default URL when testing. - enables TouchInputBrowserTest by setting initial scale for Android. - disables ScreenOrientationBrowserTest because it uses --disable-gpu - updates expected results of DumpAccessibilityTreeTest BUG=338011 Review URL: https://codereview.chromium.org/888793002 Cr-Commit-Position: refs/heads/master@{#317979}
-rw-r--r--build/android/pylib/gtest/filter/content_browsertests_disabled11
-rw-r--r--content/browser/renderer_host/input/touch_input_browsertest.cc5
-rw-r--r--content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java12
-rw-r--r--content/shell/android/browsertests_apk/src/org/chromium/content_browsertests_apk/ContentBrowserTestsActivity.java31
-rw-r--r--content/shell/android/java/src/org/chromium/content_shell/ShellManager.java12
-rw-r--r--content/test/data/accessibility/html/a-with-img-expected-android.txt8
-rw-r--r--content/test/data/accessibility/html/abbr-expected-android.txt4
-rw-r--r--content/test/data/accessibility/html/bdo-expected-android.txt2
-rw-r--r--content/test/data/accessibility/html/br-expected-android.txt2
-rw-r--r--content/test/data/accessibility/html/cite-expected-android.txt2
-rw-r--r--content/test/data/accessibility/html/del-expected-android.txt2
-rw-r--r--content/test/data/accessibility/html/dfn-expected-android.txt2
-rw-r--r--content/test/data/accessibility/html/i-expected-android.txt2
-rw-r--r--content/test/data/accessibility/html/legend-expected-android.txt4
-rw-r--r--content/test/data/accessibility/html/modal-dialog-in-iframe-closed-expected-android.txt2
-rw-r--r--content/test/data/accessibility/html/modal-dialog-stack-expected-android.txt2
-rw-r--r--content/test/data/accessibility/html/q-expected-android.txt2
-rw-r--r--content/test/data/accessibility/html/sub-expected-android.txt2
18 files changed, 70 insertions, 37 deletions
diff --git a/build/android/pylib/gtest/filter/content_browsertests_disabled b/build/android/pylib/gtest/filter/content_browsertests_disabled
index 0314f5f..1e3d523 100644
--- a/build/android/pylib/gtest/filter/content_browsertests_disabled
+++ b/build/android/pylib/gtest/filter/content_browsertests_disabled
@@ -16,6 +16,10 @@ ResourceDispatcherHostBrowserTest.CrossSiteAfterCrash
RenderFrameHostManagerTest.IgnoreRendererDebugURLsWhenCrashed
RenderFrameHostManagerTest.ProcessExitWithSwappedOutViews
+# Crashes due to using --disable-gpu.
+# Needs to investigate more in http://crbug.com/461624.
+ScreenOrientationBrowserTest.*
+
# Failures
RenderViewHostTest.BaseURLParam
OffTheRecordClipboardTest.ClearContentData
@@ -93,13 +97,6 @@ BrowserGpuChannelHostFactoryTest.Basic
BrowserGpuChannelHostFactoryTest.CrashAndRecover
BrowserGpuChannelHostFactoryTest.EstablishAndTerminate
-# http://crbug.com/338011
-TouchInputBrowserTest.MultiPointTouchPress
-TouchInputBrowserTest.TouchHandlerConsume
-TouchInputBrowserTest.TouchHandlerNoConsume
-TouchInputBrowserTest.TouchNoHandler
-TouchActionBrowserTest.*
-
# http://crbug.com/338408
TracingControllerTest.EnableCaptureAndDisableMonitoring
diff --git a/content/browser/renderer_host/input/touch_input_browsertest.cc b/content/browser/renderer_host/input/touch_input_browsertest.cc
index ce20fc2..3324d23 100644
--- a/content/browser/renderer_host/input/touch_input_browsertest.cc
+++ b/content/browser/renderer_host/input/touch_input_browsertest.cc
@@ -36,6 +36,11 @@ void GiveItSomeTime() {
const char kTouchEventDataURL[] =
"data:text/html;charset=utf-8,"
+#if defined(OS_ANDROID)
+ "<head>"
+ "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">"
+ "</head>"
+#endif
"<body onload='setup();'>"
"<div id='first'></div><div id='second'></div><div id='third'></div>"
"<style>"
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java
index 950ea3b..994cf24 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java
@@ -103,6 +103,18 @@ public class ContentViewRenderView extends FrameLayout {
mContentReadbackHandler.initNativeContentReadbackHandler();
}
+ @Override
+ protected void onSizeChanged(int wPix, int hPix, int owPix, int ohPix) {
+ // If mContentViewCore was initialized too early, physical backing size is empty.
+ // In this case, we should resize it before viewport size is set.
+ // TODO(jaekyun): Remove this workaround when more proper fix is landed.
+ if (mContentViewCore != null && mContentViewCore.getPhysicalBackingWidthPix() == 0
+ && mContentViewCore.getPhysicalBackingHeightPix() == 0) {
+ mContentViewCore.onPhysicalBackingSizeChanged(wPix, hPix);
+ }
+ super.onSizeChanged(wPix, hPix, owPix, ohPix);
+ }
+
/**
* @return The content readback handler.
*/
diff --git a/content/shell/android/browsertests_apk/src/org/chromium/content_browsertests_apk/ContentBrowserTestsActivity.java b/content/shell/android/browsertests_apk/src/org/chromium/content_browsertests_apk/ContentBrowserTestsActivity.java
index 9164413..bc95f1c 100644
--- a/content/shell/android/browsertests_apk/src/org/chromium/content_browsertests_apk/ContentBrowserTestsActivity.java
+++ b/content/shell/android/browsertests_apk/src/org/chromium/content_browsertests_apk/ContentBrowserTestsActivity.java
@@ -7,9 +7,10 @@ package org.chromium.content_browsertests_apk;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
+import android.os.Handler;
import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
import org.chromium.base.JNINamespace;
import org.chromium.base.annotations.SuppressFBWarnings;
@@ -45,17 +46,25 @@ public class ContentBrowserTestsActivity extends Activity {
BrowserStartupController.get(getApplicationContext(), LibraryProcessType.PROCESS_BROWSER)
.initChromiumBrowserProcessForTests();
- LayoutInflater inflater =
- (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- View view = inflater.inflate(R.layout.test_activity, null);
- mShellManager = (ShellManager) view.findViewById(R.id.shell_container);
+ setContentView(R.layout.test_activity);
+ mShellManager = (ShellManager) findViewById(R.id.shell_container);
mWindowAndroid = new ActivityWindowAndroid(this);
- mShellManager.setWindow(mWindowAndroid);
+ mShellManager.setWindow(mWindowAndroid, false);
- Log.i(TAG, "Running tests");
- runTests();
- Log.i(TAG, "Tests finished.");
- finish();
+ Window wind = this.getWindow();
+ wind.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
+ wind.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
+ wind.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
+
+ new Handler().post(new Runnable() {
+ @Override
+ public void run() {
+ Log.i(TAG, "Running tests");
+ runTests();
+ Log.i(TAG, "Tests finished.");
+ finish();
+ }
+ });
}
private void runTests() {
diff --git a/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java b/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java
index bb9a5d6..2715e4c 100644
--- a/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java
+++ b/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java
@@ -14,6 +14,7 @@ import android.widget.FrameLayout;
import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
import org.chromium.base.ThreadUtils;
+import org.chromium.base.VisibleForTesting;
import org.chromium.content.browser.ActivityContentVideoViewClient;
import org.chromium.content.browser.ContentVideoViewClient;
import org.chromium.content.browser.ContentViewClient;
@@ -68,13 +69,22 @@ public class ShellManager extends FrameLayout {
* @param window The window used to generate all shells.
*/
public void setWindow(WindowAndroid window) {
+ setWindow(window, true);
+ }
+
+ /**
+ * @param window The window used to generate all shells.
+ * @param initialLoadingNeeded Whether initial loading is needed or not.
+ */
+ @VisibleForTesting
+ public void setWindow(WindowAndroid window, final boolean initialLoadingNeeded) {
assert window != null;
mWindow = window;
mContentViewRenderView = new ContentViewRenderView(getContext()) {
@Override
protected void onReadyToRender() {
if (sStartup) {
- mActiveShell.loadUrl(mStartupUrl);
+ if (initialLoadingNeeded) mActiveShell.loadUrl(mStartupUrl);
sStartup = false;
}
}
diff --git a/content/test/data/accessibility/html/a-with-img-expected-android.txt b/content/test/data/accessibility/html/a-with-img-expected-android.txt
index 5fa0a68..e8158e09 100644
--- a/content/test/data/accessibility/html/a-with-img-expected-android.txt
+++ b/content/test/data/accessibility/html/a-with-img-expected-android.txt
@@ -1,6 +1,6 @@
android.webkit.WebView focusable focused scrollable
++android.view.View
-++++android.view.View clickable focusable link name='Linkwith image at start.'
-++++android.view.View clickable focusable link name='Link withimagein the middle.'
-++++android.view.View clickable focusable link name='Link withbrokenin the middle.'
-++++android.view.View clickable focusable link name='Link with image at theend'
+++++android.view.View clickable focusable link name='Link with image at start.'
+++++android.view.View clickable focusable link name='Link with image in the middle.'
+++++android.view.View clickable focusable link name='Link with broken in the middle.'
+++++android.view.View clickable focusable link name='Link with image at the end'
diff --git a/content/test/data/accessibility/html/abbr-expected-android.txt b/content/test/data/accessibility/html/abbr-expected-android.txt
index d8585d1..4cfbda8 100644
--- a/content/test/data/accessibility/html/abbr-expected-android.txt
+++ b/content/test/data/accessibility/html/abbr-expected-android.txt
@@ -1,5 +1,5 @@
android.webkit.WebView focusable focused scrollable
++android.view.View
-++++android.view.View clickable name='The'
+++++android.view.View clickable name='The '
++++android.view.View clickable name='World Health Organization'
-++++android.view.View clickable name='was founded in 1948.'
+++++android.view.View clickable name=' was founded in 1948.'
diff --git a/content/test/data/accessibility/html/bdo-expected-android.txt b/content/test/data/accessibility/html/bdo-expected-android.txt
index a9c8e15..9b1b549 100644
--- a/content/test/data/accessibility/html/bdo-expected-android.txt
+++ b/content/test/data/accessibility/html/bdo-expected-android.txt
@@ -1,2 +1,2 @@
android.webkit.WebView focusable focused scrollable
-++android.view.View clickable name='Some LTR textSome RTL textwith some LTR text embedded'
+++android.view.View clickable name='Some LTR textSome RTL text with some LTR text embedded'
diff --git a/content/test/data/accessibility/html/br-expected-android.txt b/content/test/data/accessibility/html/br-expected-android.txt
index 2105217..94d8bbd 100644
--- a/content/test/data/accessibility/html/br-expected-android.txt
+++ b/content/test/data/accessibility/html/br-expected-android.txt
@@ -1,5 +1,5 @@
android.webkit.WebView focusable focused scrollable
++android.view.View
-++++android.view.View clickable name='Text line 1'
+++++android.view.View clickable name='Text line 1 '
++++android.view.View
++++android.view.View clickable name='Text line 2'
diff --git a/content/test/data/accessibility/html/cite-expected-android.txt b/content/test/data/accessibility/html/cite-expected-android.txt
index aedb49b..ba1f59d 100644
--- a/content/test/data/accessibility/html/cite-expected-android.txt
+++ b/content/test/data/accessibility/html/cite-expected-android.txt
@@ -1,4 +1,4 @@
android.webkit.WebView focusable focused scrollable
++android.view.View
++++android.widget.Image clickable name='Pipe'
-++android.view.View clickable name='The pipeclicked by SomeOne.'
+++android.view.View clickable name='The pipe clicked by SomeOne.'
diff --git a/content/test/data/accessibility/html/del-expected-android.txt b/content/test/data/accessibility/html/del-expected-android.txt
index 9ed784f..c274a14 100644
--- a/content/test/data/accessibility/html/del-expected-android.txt
+++ b/content/test/data/accessibility/html/del-expected-android.txt
@@ -1,2 +1,2 @@
android.webkit.WebView focusable focused scrollable
-++android.view.View clickable name='I amvegetarian'
+++android.view.View clickable name='I am vegetarian'
diff --git a/content/test/data/accessibility/html/dfn-expected-android.txt b/content/test/data/accessibility/html/dfn-expected-android.txt
index 13f6c22..461ed51 100644
--- a/content/test/data/accessibility/html/dfn-expected-android.txt
+++ b/content/test/data/accessibility/html/dfn-expected-android.txt
@@ -1,2 +1,2 @@
android.webkit.WebView focusable focused scrollable
-++android.view.View clickable name='Web BrowserA computer program with a graphical user interface for displaying HTML files, used to navigate the World Wide Web.'
+++android.view.View clickable name='Web Browser A computer program with a graphical user interface for displaying HTML files, used to navigate the World Wide Web.'
diff --git a/content/test/data/accessibility/html/i-expected-android.txt b/content/test/data/accessibility/html/i-expected-android.txt
index 5ebe489..c33afcd 100644
--- a/content/test/data/accessibility/html/i-expected-android.txt
+++ b/content/test/data/accessibility/html/i-expected-android.txt
@@ -1,2 +1,2 @@
android.webkit.WebView focusable focused scrollable
-++android.view.View clickable name='This is to checkitalic propertyusing i tag.'
+++android.view.View clickable name='This is to check italic property using i tag.'
diff --git a/content/test/data/accessibility/html/legend-expected-android.txt b/content/test/data/accessibility/html/legend-expected-android.txt
index c2572ce..91b439e 100644
--- a/content/test/data/accessibility/html/legend-expected-android.txt
+++ b/content/test/data/accessibility/html/legend-expected-android.txt
@@ -5,5 +5,5 @@ android.webkit.WebView focusable focused scrollable
++++++android.view.View
++++++++android.view.View clickable name='Browser: '
++++++++android.widget.EditText clickable editable_text focusable input_type=1
-++++++++android.view.View clickable name='Rendering Engine: '
-++++++++android.widget.EditText clickable editable_text focusable input_type=1 \ No newline at end of file
+++++++++android.view.View clickable name=' Rendering Engine: '
+++++++++android.widget.EditText clickable editable_text focusable input_type=1
diff --git a/content/test/data/accessibility/html/modal-dialog-in-iframe-closed-expected-android.txt b/content/test/data/accessibility/html/modal-dialog-in-iframe-closed-expected-android.txt
index 4ae4a73..edecaf4 100644
--- a/content/test/data/accessibility/html/modal-dialog-in-iframe-closed-expected-android.txt
+++ b/content/test/data/accessibility/html/modal-dialog-in-iframe-closed-expected-android.txt
@@ -1,6 +1,6 @@
android.webkit.WebView focusable focused scrollable
++android.view.View
-++++android.view.View clickable name='Test for modal dialog closed in an iframe.'
+++++android.view.View clickable name='Test for modal dialog closed in an iframe. '
++++android.view.View
++++++android.view.View
++++++++android.view.View scrollable
diff --git a/content/test/data/accessibility/html/modal-dialog-stack-expected-android.txt b/content/test/data/accessibility/html/modal-dialog-stack-expected-android.txt
index d445deb..8079070 100644
--- a/content/test/data/accessibility/html/modal-dialog-stack-expected-android.txt
+++ b/content/test/data/accessibility/html/modal-dialog-stack-expected-android.txt
@@ -1,4 +1,4 @@
android.webkit.WebView focusable focused scrollable
++android.app.Dialog
-++++android.view.View clickable name='This is the now active dialog. Of course it should be in the tree.'
+++++android.view.View clickable name='This is the now active dialog. Of course it should be in the tree. '
++++android.widget.Button clickable focusable name='This is in the active dialog and should be in the tree.'
diff --git a/content/test/data/accessibility/html/q-expected-android.txt b/content/test/data/accessibility/html/q-expected-android.txt
index 7cd534f..12439e3 100644
--- a/content/test/data/accessibility/html/q-expected-android.txt
+++ b/content/test/data/accessibility/html/q-expected-android.txt
@@ -1,2 +1,2 @@
android.webkit.WebView focusable focused scrollable
-++android.view.View clickable name='This is"Chromium Blink"based browser.'
+++android.view.View clickable name='This is "Chromium Blink" based browser.'
diff --git a/content/test/data/accessibility/html/sub-expected-android.txt b/content/test/data/accessibility/html/sub-expected-android.txt
index 4b0bf9a..73c10da 100644
--- a/content/test/data/accessibility/html/sub-expected-android.txt
+++ b/content/test/data/accessibility/html/sub-expected-android.txt
@@ -1,2 +1,2 @@
android.webkit.WebView focusable focused scrollable
-++android.view.View clickable name='This text containssubscripttext.'
+++android.view.View clickable name='This text contains subscript text.'