diff options
author | jbudorick <jbudorick@chromium.org> | 2015-06-12 06:19:35 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-12 13:20:07 +0000 |
commit | de5ee37653080ea96ba50572f2241f3c8261056a (patch) | |
tree | 2993f3f70eba1b53e5193d9270413d705b1846be /components/test | |
parent | 7a6ee91fc53118deffc379026754265eafb69b08 (diff) | |
download | chromium_src-de5ee37653080ea96ba50572f2241f3c8261056a.zip chromium_src-de5ee37653080ea96ba50572f2241f3c8261056a.tar.gz chromium_src-de5ee37653080ea96ba50572f2241f3c8261056a.tar.bz2 |
Revert of [Android] Refactor browser test execution. (patchset #14 id:260001 of https://codereview.chromium.org/1165523002/)
Reason for revert:
broke cronet_sample_test_apk compilation :(
Original issue's description:
> [Android] Refactor browser test execution.
>
> This change allows us to run multiple browser tests within a single
> invocation of an app. It does so by moving the test activity into its
> own process, running each test individually within that activity, and
> killing the process between each test.
>
> BUG=472360
>
> Committed: https://crrev.com/b049103fa4848e304102a24e78c6ba994130a535
> Cr-Commit-Position: refs/heads/master@{#334149}
TBR=jochen@chromium.org,cjhopman@chromium.org,jaekyun@chromium.org,tedchoc@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=472360
Review URL: https://codereview.chromium.org/1186513002
Cr-Commit-Position: refs/heads/master@{#334151}
Diffstat (limited to 'components/test')
4 files changed, 41 insertions, 23 deletions
diff --git a/components/test/DEPS b/components/test/DEPS index 88da157..ec6ab2f 100644 --- a/components/test/DEPS +++ b/components/test/DEPS @@ -7,7 +7,6 @@ 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 e2b2f15..97dae9e 100644 --- a/components/test/android/browsertests_apk/AndroidManifest.xml.jinja2 +++ b/components/test/android/browsertests_apk/AndroidManifest.xml.jinja2 @@ -15,8 +15,7 @@ android:launchMode="singleTask" android:theme="@android:style/Theme.Holo.Light.NoActionBar" android:configChanges="orientation|keyboardHidden|keyboard|screenSize" - android:hardwareAccelerated="true" - android:process=":test_process"> + android:hardwareAccelerated="true"> <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 77264b3..ae94edc 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,16 +5,29 @@ package org.chromium.components_browsertests_apk; import android.os.Bundle; - -import org.chromium.base.PathUtils; -import org.chromium.content_shell.browsertests.ContentShellBrowserTestActivity; - -import java.io.File; +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; /** * Android activity for running components browser tests */ -public class ComponentsBrowserTestsActivity extends ContentShellBrowserTestActivity { +public class ComponentsBrowserTestsActivity extends NativeBrowserTestActivity { + private static final String TAG = Log.makeTag("native_test"); + + private ShellManager mShellManager; + private WindowAndroid mWindowAndroid; + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -23,18 +36,25 @@ public class ComponentsBrowserTestsActivity extends ContentShellBrowserTestActiv } @Override - 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; + @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); } } 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 ffcea44..91ee597 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"}; - static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "components_shell"; + private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "components_shell"; @Override public void onCreate() { |