diff options
author | jbudorick <jbudorick@chromium.org> | 2015-06-12 16:53:31 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-12 23:54:06 +0000 |
commit | 590a3d7811a63f4be729cbbfb3ad2a0b1e2a5078 (patch) | |
tree | bcf1eca83aed0b5ae63fe5eb1c161fc6abd4874e /components/test | |
parent | 17b32adf2de02e5a4cdf1c0195bb3b06c721b2ca (diff) | |
download | chromium_src-590a3d7811a63f4be729cbbfb3ad2a0b1e2a5078.zip chromium_src-590a3d7811a63f4be729cbbfb3ad2a0b1e2a5078.tar.gz chromium_src-590a3d7811a63f4be729cbbfb3ad2a0b1e2a5078.tar.bz2 |
[Android] Refactor browser test execution. (RELAND)
This is a reland of https://codereview.chromium.org/1165523002/
BUG=472360
TBR=jochen@chromium.org
Review URL: https://codereview.chromium.org/1173363008
Cr-Commit-Position: refs/heads/master@{#334285}
Diffstat (limited to 'components/test')
4 files changed, 23 insertions, 41 deletions
diff --git a/components/test/DEPS b/components/test/DEPS index ec6ab2f..88da157 100644 --- a/components/test/DEPS +++ b/components/test/DEPS @@ -7,6 +7,7 @@ include_rules = [ "+content/public/app/content_main.h", "+content/public/common/content_switches.h", "+content/public/test", + "+content/shell/android/browsertests", "+content/shell/android/java/src/org/chromium/content_shell", "+content/shell/android/shell_jni_registrar.h", "+content/shell/app/shell_main_delegate.h", diff --git a/components/test/android/browsertests_apk/AndroidManifest.xml.jinja2 b/components/test/android/browsertests_apk/AndroidManifest.xml.jinja2 index 97dae9e..e2b2f15 100644 --- a/components/test/android/browsertests_apk/AndroidManifest.xml.jinja2 +++ b/components/test/android/browsertests_apk/AndroidManifest.xml.jinja2 @@ -15,7 +15,8 @@ android:launchMode="singleTask" android:theme="@android:style/Theme.Holo.Light.NoActionBar" android:configChanges="orientation|keyboardHidden|keyboard|screenSize" - android:hardwareAccelerated="true"> + android:hardwareAccelerated="true" + android:process=":test_process"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> diff --git a/components/test/android/browsertests_apk/src/org/chromium/components_browsertests_apk/ComponentsBrowserTestsActivity.java b/components/test/android/browsertests_apk/src/org/chromium/components_browsertests_apk/ComponentsBrowserTestsActivity.java index ae94edc..77264b3 100644 --- a/components/test/android/browsertests_apk/src/org/chromium/components_browsertests_apk/ComponentsBrowserTestsActivity.java +++ b/components/test/android/browsertests_apk/src/org/chromium/components_browsertests_apk/ComponentsBrowserTestsActivity.java @@ -5,29 +5,16 @@ package org.chromium.components_browsertests_apk; import android.os.Bundle; -import android.view.Window; -import android.view.WindowManager; - -import org.chromium.base.Log; -import org.chromium.base.annotations.SuppressFBWarnings; -import org.chromium.base.library_loader.LibraryLoader; -import org.chromium.base.library_loader.LibraryProcessType; -import org.chromium.base.library_loader.ProcessInitException; -import org.chromium.content.browser.BrowserStartupController; -import org.chromium.content_shell.ShellManager; -import org.chromium.native_test.NativeBrowserTestActivity; -import org.chromium.ui.base.ActivityWindowAndroid; -import org.chromium.ui.base.WindowAndroid; + +import org.chromium.base.PathUtils; +import org.chromium.content_shell.browsertests.ContentShellBrowserTestActivity; + +import java.io.File; /** * Android activity for running components browser tests */ -public class ComponentsBrowserTestsActivity extends NativeBrowserTestActivity { - private static final String TAG = Log.makeTag("native_test"); - - private ShellManager mShellManager; - private WindowAndroid mWindowAndroid; - +public class ComponentsBrowserTestsActivity extends ContentShellBrowserTestActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -36,25 +23,18 @@ public class ComponentsBrowserTestsActivity extends NativeBrowserTestActivity { } @Override - @SuppressFBWarnings("DM_EXIT") - protected void initializeBrowserProcess() { - try { - LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized(); - } catch (ProcessInitException e) { - Log.e(TAG, "Cannot load components_browsertests.", e); - System.exit(-1); - } - BrowserStartupController.get(getApplicationContext(), LibraryProcessType.PROCESS_BROWSER) - .initChromiumBrowserProcessForTests(); - - setContentView(R.layout.test_activity); - mShellManager = (ShellManager) findViewById(R.id.shell_container); - mWindowAndroid = new ActivityWindowAndroid(this); - mShellManager.setWindow(mWindowAndroid, false); - - 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); + protected File getPrivateDataDirectory() { + return new File(PathUtils.getExternalStorageDirectory(), + ComponentsBrowserTestsApplication.PRIVATE_DATA_DIRECTORY_SUFFIX); + } + + @Override + protected int getTestActivityViewId() { + return R.layout.test_activity; + } + + @Override + protected int getShellManagerViewId() { + return R.id.shell_container; } } diff --git a/components/test/android/browsertests_apk/src/org/chromium/components_browsertests_apk/ComponentsBrowserTestsApplication.java b/components/test/android/browsertests_apk/src/org/chromium/components_browsertests_apk/ComponentsBrowserTestsApplication.java index 91ee597..ffcea44 100644 --- a/components/test/android/browsertests_apk/src/org/chromium/components_browsertests_apk/ComponentsBrowserTestsApplication.java +++ b/components/test/android/browsertests_apk/src/org/chromium/components_browsertests_apk/ComponentsBrowserTestsApplication.java @@ -17,7 +17,7 @@ public class ComponentsBrowserTestsApplication extends BaseChromiumApplication { private static final String[] MANDATORY_PAK_FILES = new String[] {"components_tests_resources.pak", "content_shell.pak", "icudtl.dat", "natives_blob.bin", "snapshot_blob.bin"}; - private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "components_shell"; + static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "components_shell"; @Override public void onCreate() { |