Commit 45433153 authored by Andrew Luo's avatar Andrew Luo Committed by Commit Bot

Allow android.support.test.runner.AndroidJUnitRunner to run junit4 tests in test_runner.py

Bug: 868610
Cq-Include-Trybots: master.tryserver.chromium.android:android_cronet_tester;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I8ae54ae93effd83a9197d22d36df9536a5dfa631
Reviewed-on: https://chromium-review.googlesource.com/1155969Reviewed-by: default avatarGrace Kloba <klobag@chromium.org>
Reviewed-by: default avatarJohn Budorick <jbudorick@chromium.org>
Commit-Queue: Andrew Luo <aluo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583779}
parent 3c61aca7
...@@ -7,8 +7,7 @@ ...@@ -7,8 +7,7 @@
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="23" /> <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="23" />
<instrumentation android:name="org.chromium.base.test.BaseChromiumAndroidJUnitRunner" <instrumentation android:name="org.chromium.base.test.BaseChromiumAndroidJUnitRunner"
android:targetPackage="org.chromium.android_webview.shell" android:targetPackage="org.chromium.android_webview.shell"
android:label="Tests for org.chromium.android_webview" android:label="Tests for org.chromium.android_webview"/>
chromium-junit4="true"/>
<uses-permission android:name="android.permission.RUN_INSTRUMENTATION" /> <uses-permission android:name="android.permission.RUN_INSTRUMENTATION" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission android:name="android.permission.READ_LOGS"/> <uses-permission android:name="android.permission.READ_LOGS"/>
......
...@@ -21,6 +21,5 @@ ...@@ -21,6 +21,5 @@
<instrumentation android:name="android.support.test.runner.AndroidJUnitRunner" <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
android:targetPackage="org.chromium.webview_ui_test" android:targetPackage="org.chromium.webview_ui_test"
android:label="Tests for org.chromium.webview_ui_test" android:label="Tests for org.chromium.webview_ui_test"/>
chromium-junit4="true"/>
</manifest> </manifest>
...@@ -32,6 +32,5 @@ ...@@ -32,6 +32,5 @@
<instrumentation android:name="android.support.test.runner.AndroidJUnitRunner" <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
android:targetPackage="org.chromium.webview_shell" android:targetPackage="org.chromium.webview_shell"
android:label="Layout tests for org.chromium.webview_shell" android:label="Layout tests for org.chromium.webview_shell"/>
chromium-junit4="true"/>
</manifest> </manifest>
...@@ -21,6 +21,5 @@ ...@@ -21,6 +21,5 @@
<instrumentation android:name="org.chromium.base.test.BaseChromiumAndroidJUnitRunner" <instrumentation android:name="org.chromium.base.test.BaseChromiumAndroidJUnitRunner"
android:targetPackage="org.chromium.webview_shell" android:targetPackage="org.chromium.webview_shell"
android:label="Page cycler for org.chromium.webview_shell" android:label="Page cycler for org.chromium.webview_shell"/>
chromium-junit4="true"/>
</manifest> </manifest>
...@@ -568,15 +568,15 @@ class InstrumentationTestInstance(test_instance.TestInstance): ...@@ -568,15 +568,15 @@ class InstrumentationTestInstance(test_instance.TestInstance):
self._test_package = self._test_apk.GetPackageName() self._test_package = self._test_apk.GetPackageName()
all_instrumentations = self._test_apk.GetAllInstrumentations() all_instrumentations = self._test_apk.GetAllInstrumentations()
all_junit3_runner_classes = [ all_junit3_runner_classes = [
x for x in all_instrumentations if ('0xffffffff' not in x.get(
'chromium-junit4', ''))]
all_junit4_test_runner_classes = [
x for x in all_instrumentations if ('0xffffffff' in x.get( x for x in all_instrumentations if ('0xffffffff' in x.get(
'chromium-junit4', ''))] 'chromium-junit3', ''))]
all_junit4_runner_classes = [
x for x in all_instrumentations if ('0xffffffff' not in x.get(
'chromium-junit3', ''))]
if len(all_junit3_runner_classes) > 1: if len(all_junit3_runner_classes) > 1:
logging.warning('This test apk has more than one JUnit3 instrumentation') logging.warning('This test apk has more than one JUnit3 instrumentation')
if len(all_junit4_test_runner_classes) > 1: if len(all_junit4_runner_classes) > 1:
logging.warning('This test apk has more than one JUnit4 instrumentation') logging.warning('This test apk has more than one JUnit4 instrumentation')
self._junit3_runner_class = ( self._junit3_runner_class = (
...@@ -584,8 +584,8 @@ class InstrumentationTestInstance(test_instance.TestInstance): ...@@ -584,8 +584,8 @@ class InstrumentationTestInstance(test_instance.TestInstance):
if all_junit3_runner_classes else self.test_apk.GetInstrumentationName()) if all_junit3_runner_classes else self.test_apk.GetInstrumentationName())
self._junit4_runner_class = ( self._junit4_runner_class = (
all_junit4_test_runner_classes[0]['android:name'] all_junit4_runner_classes[0]['android:name']
if all_junit4_test_runner_classes else None) if all_junit4_runner_classes else None)
if self._junit4_runner_class: if self._junit4_runner_class:
if self._test_apk_incremental_install_json: if self._test_apk_incremental_install_json:
......
...@@ -59,6 +59,5 @@ ...@@ -59,6 +59,5 @@
<instrumentation android:name="org.chromium.base.test.BaseChromiumAndroidJUnitRunner" <instrumentation android:name="org.chromium.base.test.BaseChromiumAndroidJUnitRunner"
android:targetPackage="{{manifest_package}}" android:targetPackage="{{manifest_package}}"
android:label="Tests for {{manifest_package}}" android:label="Tests for {{manifest_package}}"/>
chromium-junit4="true"/>
</manifest> </manifest>
...@@ -19,6 +19,5 @@ ...@@ -19,6 +19,5 @@
</application> </application>
<instrumentation android:name="org.chromium.base.test.BaseChromiumAndroidJUnitRunner" <instrumentation android:name="org.chromium.base.test.BaseChromiumAndroidJUnitRunner"
android:targetPackage="{{manifest_package}}" android:targetPackage="{{manifest_package}}"
android:label="Tests for {{manifest_package}}" android:label="Tests for {{manifest_package}}"/>
chromium-junit4="true"/>
</manifest> </manifest>
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
</application> </application>
<instrumentation android:name="android.support.test.runner.AndroidJUnitRunner" <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
android:targetPackage="org.chromium.cronet_sample_apk" android:targetPackage="org.chromium.cronet_sample_apk"
android:label="Tests for org.chromium.cronet_sample_apk" android:label="Tests for org.chromium.cronet_sample_apk"/>
chromium-junit4="true"/>
<instrumentation android:name="android.test.InstrumentationTestRunner" <instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="org.chromium.cronet_sample_apk" android:targetPackage="org.chromium.cronet_sample_apk"
android:label="Tests for org.chromium.cronet_sample_apk"/> android:label="Tests for org.chromium.cronet_sample_apk"
chromium-junit3="true"/>
</manifest> </manifest>
...@@ -18,8 +18,7 @@ ...@@ -18,8 +18,7 @@
</application> </application>
<instrumentation android:name="org.chromium.base.test.BaseChromiumAndroidJUnitRunner" <instrumentation android:name="org.chromium.base.test.BaseChromiumAndroidJUnitRunner"
android:targetPackage="org.chromium.net" android:targetPackage="org.chromium.net"
android:label="Tests for org.chromium.net" android:label="Tests for org.chromium.net">
chromium-junit4="true">
<!-- Meta data used for BaseChromiumAndroidJUnitRunner to scan only <!-- Meta data used for BaseChromiumAndroidJUnitRunner to scan only
one package path for potential tests --> one package path for potential tests -->
<meta-data android:name="org.chromium.base.test.BaseChromiumAndroidJUnitRunner.TestListPackage" <meta-data android:name="org.chromium.base.test.BaseChromiumAndroidJUnitRunner.TestListPackage"
......
...@@ -63,5 +63,6 @@ ...@@ -63,5 +63,6 @@
<instrumentation android:name="org.chromium.native_test.NativeTestInstrumentationTestRunner" <instrumentation android:name="org.chromium.native_test.NativeTestInstrumentationTestRunner"
android:label="ComponentsBrowserTests" android:label="ComponentsBrowserTests"
android:targetPackage="org.chromium.components_browsertests_apk"/> android:targetPackage="org.chromium.components_browsertests_apk"
chromium-junit3="true"/>
</manifest> </manifest>
...@@ -62,5 +62,6 @@ ...@@ -62,5 +62,6 @@
<instrumentation android:name="org.chromium.native_test.NativeTestInstrumentationTestRunner" <instrumentation android:name="org.chromium.native_test.NativeTestInstrumentationTestRunner"
android:label="ContentBrowserTests" android:label="ContentBrowserTests"
android:targetPackage="org.chromium.content_browsertests_apk"/> android:targetPackage="org.chromium.content_browsertests_apk"
chromium-junit3="true"/>
</manifest> </manifest>
...@@ -19,6 +19,5 @@ ...@@ -19,6 +19,5 @@
<instrumentation android:name="org.chromium.base.test.BaseChromiumAndroidJUnitRunner" <instrumentation android:name="org.chromium.base.test.BaseChromiumAndroidJUnitRunner"
android:targetPackage="org.chromium.content_shell_apk" android:targetPackage="org.chromium.content_shell_apk"
chromium-junit4="true"
android:label="JUnit4-based tests for org.chromium.content_shell_apk" /> android:label="JUnit4-based tests for org.chromium.content_shell_apk" />
</manifest> </manifest>
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
<instrumentation android:name="android.support.test.runner.AndroidJUnitRunner" <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
android:targetPackage="org.chromium.mojo.tests" android:targetPackage="org.chromium.mojo.tests"
android:label="Tests for org.chromium.mojo" android:label="Tests for org.chromium.mojo"/>
chromium-junit4="true"/>
</manifest> </manifest>
...@@ -50,6 +50,7 @@ found in the LICENSE file. ...@@ -50,6 +50,7 @@ found in the LICENSE file.
<instrumentation android:name="org.chromium.native_test.NativeTestInstrumentationTestRunner" <instrumentation android:name="org.chromium.native_test.NativeTestInstrumentationTestRunner"
android:targetPackage="org.chromium.native_test" android:targetPackage="org.chromium.native_test"
android:label="Instrumentation entry point for org.chromium.native_test"/> android:label="Instrumentation entry point for org.chromium.native_test"
chromium-junit3="true"/>
</manifest> </manifest>
...@@ -18,6 +18,5 @@ ...@@ -18,6 +18,5 @@
</application> </application>
<instrumentation android:name="org.chromium.base.test.BaseChromiumAndroidJUnitRunner" <instrumentation android:name="org.chromium.base.test.BaseChromiumAndroidJUnitRunner"
android:targetPackage="{{ APK_PACKAGE_NAME }}" android:targetPackage="{{ APK_PACKAGE_NAME }}"
android:label="Tests for {{ APK_PACKAGE_NAME }}" android:label="Tests for {{ APK_PACKAGE_NAME }}"/>
chromium-junit4="true"/>
</manifest> </manifest>
...@@ -17,6 +17,7 @@ found in the LICENSE file. ...@@ -17,6 +17,7 @@ found in the LICENSE file.
<instrumentation android:name="org.chromium.test.driver.OnDeviceInstrumentationDriver" <instrumentation android:name="org.chromium.test.driver.OnDeviceInstrumentationDriver"
android:targetPackage="org.chromium.test.driver" android:targetPackage="org.chromium.test.driver"
android:label="OnDeviceInstrumentationDriver"/> android:label="OnDeviceInstrumentationDriver"
chromium-junit3="true"/>
</manifest> </manifest>
...@@ -65,6 +65,7 @@ found in the LICENSE file. ...@@ -65,6 +65,7 @@ found in the LICENSE file.
<instrumentation android:name="org.chromium.native_test.NativeTestInstrumentationTestRunner" <instrumentation android:name="org.chromium.native_test.NativeTestInstrumentationTestRunner"
android:targetPackage="org.chromium.native_test" android:targetPackage="org.chromium.native_test"
android:label="Instrumentation entry point for org.chromium.native_test"/> android:label="Instrumentation entry point for org.chromium.native_test"
chromium-junit3="true"/>
</manifest> </manifest>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment