[WebLayer] Add test-only AIDL + java tests.
Add a test-only AIDL for instrumentation tests, and add a simple instrumentation test to verify that network change auto detect is on when a weblayer activity is created. The change to run weblayer_private_instrumentation_test_apk on clank clank builders is here: https://chrome-internal-review.googlesource.com/c/clank/internal/apps/+/2396452 Bug: 1018848, 1035912 Change-Id: I0bddd1f34e9b2ce4a222ae39aa34611d690fa44a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1975886 Commit-Queue: Mugdha Lakhani <nator@chromium.org> Reviewed-by: Clark DuVall <cduvall@chromium.org> Reviewed-by: Bo <boliu@chromium.org> Reviewed-by: John Abd-El-Malek <jam@chromium.org> Cr-Commit-Position: refs/heads/master@{#730521}
This commit is contained in:

committed by
Commit Bot

parent
69eee5c131
commit
6230b966d2
@ -2859,6 +2859,8 @@ def _GetOwnersFilesToCheckForIpcOwners(input_api):
|
||||
# These files are just used to communicate between class loaders running
|
||||
# in the same process.
|
||||
'weblayer/browser/java/org/chromium/weblayer_private/interfaces/*',
|
||||
'weblayer/browser/java/org/chromium/weblayer_private/test_interfaces/*',
|
||||
|
||||
]
|
||||
|
||||
# Dictionary mapping an OWNERS file path to Patterns.
|
||||
|
@ -4765,6 +4765,64 @@
|
||||
"test": "weblayer_instrumentation_test_apk",
|
||||
"test_target": "//weblayer/browser/android/javatests:weblayer_instrumentation_test_apk"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"--gs-results-bucket=chromium-result-details",
|
||||
"--recover-devices",
|
||||
"--avd-config=../../tools/android/avd/proto/generic_android23.textpb"
|
||||
],
|
||||
"merge": {
|
||||
"args": [
|
||||
"--bucket",
|
||||
"chromium-result-details",
|
||||
"--test-name",
|
||||
"weblayer_private_instrumentation_test_apk"
|
||||
],
|
||||
"script": "//build/android/pylib/results/presentation/test_results_presentation.py"
|
||||
},
|
||||
"swarming": {
|
||||
"can_use_on_swarming_builders": true,
|
||||
"cipd_packages": [
|
||||
{
|
||||
"cipd_package": "infra/tools/luci/logdog/butler/${platform}",
|
||||
"location": "bin",
|
||||
"revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c"
|
||||
}
|
||||
],
|
||||
"dimension_sets": [
|
||||
{
|
||||
"cpu": "x86-64",
|
||||
"device_os": null,
|
||||
"device_type": null,
|
||||
"os": "Ubuntu-16.04",
|
||||
"pool": "chromium.tests.avd",
|
||||
"ssd": "1"
|
||||
}
|
||||
],
|
||||
"named_caches": [
|
||||
{
|
||||
"name": "avd_generic_android23",
|
||||
"path": ".android"
|
||||
},
|
||||
{
|
||||
"name": "system_images_android_23_google_apis_x86",
|
||||
"path": ".emulator_sdk"
|
||||
}
|
||||
],
|
||||
"output_links": [
|
||||
{
|
||||
"link": [
|
||||
"https://luci-logdog.appspot.com/v/?s",
|
||||
"=android%2Fswarming%2Flogcats%2F",
|
||||
"${TASK_ID}%2F%2B%2Funified_logcats"
|
||||
],
|
||||
"name": "shard #${SHARD_INDEX} logcats"
|
||||
}
|
||||
]
|
||||
},
|
||||
"test": "weblayer_private_instrumentation_test_apk",
|
||||
"test_target": "//weblayer/browser/android/javatests:weblayer_private_instrumentation_test_apk"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"--gs-results-bucket=chromium-result-details",
|
||||
@ -9124,6 +9182,64 @@
|
||||
"test": "weblayer_instrumentation_test_apk",
|
||||
"test_target": "//weblayer/browser/android/javatests:weblayer_instrumentation_test_apk"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"--gs-results-bucket=chromium-result-details",
|
||||
"--recover-devices",
|
||||
"--avd-config=../../tools/android/avd/proto/generic_android28.textpb"
|
||||
],
|
||||
"merge": {
|
||||
"args": [
|
||||
"--bucket",
|
||||
"chromium-result-details",
|
||||
"--test-name",
|
||||
"weblayer_private_instrumentation_test_apk"
|
||||
],
|
||||
"script": "//build/android/pylib/results/presentation/test_results_presentation.py"
|
||||
},
|
||||
"swarming": {
|
||||
"can_use_on_swarming_builders": true,
|
||||
"cipd_packages": [
|
||||
{
|
||||
"cipd_package": "infra/tools/luci/logdog/butler/${platform}",
|
||||
"location": "bin",
|
||||
"revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c"
|
||||
}
|
||||
],
|
||||
"dimension_sets": [
|
||||
{
|
||||
"cpu": "x86-64",
|
||||
"device_os": null,
|
||||
"device_type": null,
|
||||
"os": "Ubuntu-16.04",
|
||||
"pool": "chromium.tests.avd",
|
||||
"ssd": "1"
|
||||
}
|
||||
],
|
||||
"named_caches": [
|
||||
{
|
||||
"name": "avd_generic_android28",
|
||||
"path": ".android"
|
||||
},
|
||||
{
|
||||
"name": "system_images_android_28_google_apis_x86",
|
||||
"path": ".emulator_sdk"
|
||||
}
|
||||
],
|
||||
"output_links": [
|
||||
{
|
||||
"link": [
|
||||
"https://luci-logdog.appspot.com/v/?s",
|
||||
"=android%2Fswarming%2Flogcats%2F",
|
||||
"${TASK_ID}%2F%2B%2Funified_logcats"
|
||||
],
|
||||
"name": "shard #${SHARD_INDEX} logcats"
|
||||
}
|
||||
]
|
||||
},
|
||||
"test": "weblayer_private_instrumentation_test_apk",
|
||||
"test_target": "//weblayer/browser/android/javatests:weblayer_private_instrumentation_test_apk"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"--gs-results-bucket=chromium-result-details",
|
||||
|
@ -11205,6 +11205,52 @@
|
||||
"test": "weblayer_instrumentation_test_apk",
|
||||
"test_target": "//weblayer/browser/android/javatests:weblayer_instrumentation_test_apk"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"--gs-results-bucket=chromium-result-details",
|
||||
"--recover-devices"
|
||||
],
|
||||
"merge": {
|
||||
"args": [
|
||||
"--bucket",
|
||||
"chromium-result-details",
|
||||
"--test-name",
|
||||
"weblayer_private_instrumentation_test_apk"
|
||||
],
|
||||
"script": "//build/android/pylib/results/presentation/test_results_presentation.py"
|
||||
},
|
||||
"swarming": {
|
||||
"can_use_on_swarming_builders": true,
|
||||
"cipd_packages": [
|
||||
{
|
||||
"cipd_package": "infra/tools/luci/logdog/butler/${platform}",
|
||||
"location": "bin",
|
||||
"revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c"
|
||||
}
|
||||
],
|
||||
"dimension_sets": [
|
||||
{
|
||||
"device_os": "LMY48I",
|
||||
"device_os_type": "userdebug",
|
||||
"device_type": "hammerhead",
|
||||
"os": "Android"
|
||||
}
|
||||
],
|
||||
"expiration": 10800,
|
||||
"output_links": [
|
||||
{
|
||||
"link": [
|
||||
"https://luci-logdog.appspot.com/v/?s",
|
||||
"=android%2Fswarming%2Flogcats%2F",
|
||||
"${TASK_ID}%2F%2B%2Funified_logcats"
|
||||
],
|
||||
"name": "shard #${SHARD_INDEX} logcats"
|
||||
}
|
||||
]
|
||||
},
|
||||
"test": "weblayer_private_instrumentation_test_apk",
|
||||
"test_target": "//weblayer/browser/android/javatests:weblayer_private_instrumentation_test_apk"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"--gs-results-bucket=chromium-result-details",
|
||||
@ -14398,6 +14444,52 @@
|
||||
"test": "weblayer_instrumentation_test_apk",
|
||||
"test_target": "//weblayer/browser/android/javatests:weblayer_instrumentation_test_apk"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"--gs-results-bucket=chromium-result-details",
|
||||
"--recover-devices"
|
||||
],
|
||||
"merge": {
|
||||
"args": [
|
||||
"--bucket",
|
||||
"chromium-result-details",
|
||||
"--test-name",
|
||||
"weblayer_private_instrumentation_test_apk"
|
||||
],
|
||||
"script": "//build/android/pylib/results/presentation/test_results_presentation.py"
|
||||
},
|
||||
"swarming": {
|
||||
"can_use_on_swarming_builders": true,
|
||||
"cipd_packages": [
|
||||
{
|
||||
"cipd_package": "infra/tools/luci/logdog/butler/${platform}",
|
||||
"location": "bin",
|
||||
"revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c"
|
||||
}
|
||||
],
|
||||
"dimension_sets": [
|
||||
{
|
||||
"device_os": "LMY49B",
|
||||
"device_os_type": "userdebug",
|
||||
"device_type": "flo",
|
||||
"os": "Android"
|
||||
}
|
||||
],
|
||||
"expiration": 10800,
|
||||
"output_links": [
|
||||
{
|
||||
"link": [
|
||||
"https://luci-logdog.appspot.com/v/?s",
|
||||
"=android%2Fswarming%2Flogcats%2F",
|
||||
"${TASK_ID}%2F%2B%2Funified_logcats"
|
||||
],
|
||||
"name": "shard #${SHARD_INDEX} logcats"
|
||||
}
|
||||
]
|
||||
},
|
||||
"test": "weblayer_private_instrumentation_test_apk",
|
||||
"test_target": "//weblayer/browser/android/javatests:weblayer_private_instrumentation_test_apk"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"--gs-results-bucket=chromium-result-details",
|
||||
@ -17715,6 +17807,51 @@
|
||||
"test": "weblayer_instrumentation_test_apk",
|
||||
"test_target": "//weblayer/browser/android/javatests:weblayer_instrumentation_test_apk"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"--gs-results-bucket=chromium-result-details",
|
||||
"--recover-devices"
|
||||
],
|
||||
"merge": {
|
||||
"args": [
|
||||
"--bucket",
|
||||
"chromium-result-details",
|
||||
"--test-name",
|
||||
"weblayer_private_instrumentation_test_apk"
|
||||
],
|
||||
"script": "//build/android/pylib/results/presentation/test_results_presentation.py"
|
||||
},
|
||||
"swarming": {
|
||||
"can_use_on_swarming_builders": true,
|
||||
"cipd_packages": [
|
||||
{
|
||||
"cipd_package": "infra/tools/luci/logdog/butler/${platform}",
|
||||
"location": "bin",
|
||||
"revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c"
|
||||
}
|
||||
],
|
||||
"dimension_sets": [
|
||||
{
|
||||
"device_os": "MMB29Q",
|
||||
"device_os_type": "userdebug",
|
||||
"device_type": "bullhead",
|
||||
"os": "Android"
|
||||
}
|
||||
],
|
||||
"output_links": [
|
||||
{
|
||||
"link": [
|
||||
"https://luci-logdog.appspot.com/v/?s",
|
||||
"=android%2Fswarming%2Flogcats%2F",
|
||||
"${TASK_ID}%2F%2B%2Funified_logcats"
|
||||
],
|
||||
"name": "shard #${SHARD_INDEX} logcats"
|
||||
}
|
||||
]
|
||||
},
|
||||
"test": "weblayer_private_instrumentation_test_apk",
|
||||
"test_target": "//weblayer/browser/android/javatests:weblayer_private_instrumentation_test_apk"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"--gs-results-bucket=chromium-result-details",
|
||||
@ -20905,6 +21042,52 @@
|
||||
"test": "weblayer_instrumentation_test_apk",
|
||||
"test_target": "//weblayer/browser/android/javatests:weblayer_instrumentation_test_apk"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"--gs-results-bucket=chromium-result-details",
|
||||
"--recover-devices"
|
||||
],
|
||||
"merge": {
|
||||
"args": [
|
||||
"--bucket",
|
||||
"chromium-result-details",
|
||||
"--test-name",
|
||||
"weblayer_private_instrumentation_test_apk"
|
||||
],
|
||||
"script": "//build/android/pylib/results/presentation/test_results_presentation.py"
|
||||
},
|
||||
"swarming": {
|
||||
"can_use_on_swarming_builders": true,
|
||||
"cipd_packages": [
|
||||
{
|
||||
"cipd_package": "infra/tools/luci/logdog/butler/${platform}",
|
||||
"location": "bin",
|
||||
"revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c"
|
||||
}
|
||||
],
|
||||
"dimension_sets": [
|
||||
{
|
||||
"device_os": "MRA58Z",
|
||||
"device_os_type": "userdebug",
|
||||
"device_type": "flo",
|
||||
"os": "Android"
|
||||
}
|
||||
],
|
||||
"expiration": 10800,
|
||||
"output_links": [
|
||||
{
|
||||
"link": [
|
||||
"https://luci-logdog.appspot.com/v/?s",
|
||||
"=android%2Fswarming%2Flogcats%2F",
|
||||
"${TASK_ID}%2F%2B%2Funified_logcats"
|
||||
],
|
||||
"name": "shard #${SHARD_INDEX} logcats"
|
||||
}
|
||||
]
|
||||
},
|
||||
"test": "weblayer_private_instrumentation_test_apk",
|
||||
"test_target": "//weblayer/browser/android/javatests:weblayer_private_instrumentation_test_apk"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"--gs-results-bucket=chromium-result-details",
|
||||
@ -25054,6 +25237,51 @@
|
||||
"test": "weblayer_instrumentation_test_apk",
|
||||
"test_target": "//weblayer/browser/android/javatests:weblayer_instrumentation_test_apk"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"--gs-results-bucket=chromium-result-details",
|
||||
"--recover-devices"
|
||||
],
|
||||
"merge": {
|
||||
"args": [
|
||||
"--bucket",
|
||||
"chromium-result-details",
|
||||
"--test-name",
|
||||
"weblayer_private_instrumentation_test_apk"
|
||||
],
|
||||
"script": "//build/android/pylib/results/presentation/test_results_presentation.py"
|
||||
},
|
||||
"swarming": {
|
||||
"can_use_on_swarming_builders": true,
|
||||
"cipd_packages": [
|
||||
{
|
||||
"cipd_package": "infra/tools/luci/logdog/butler/${platform}",
|
||||
"location": "bin",
|
||||
"revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c"
|
||||
}
|
||||
],
|
||||
"dimension_sets": [
|
||||
{
|
||||
"device_os": "MMB29Q",
|
||||
"device_os_type": "userdebug",
|
||||
"device_type": "bullhead",
|
||||
"os": "Android"
|
||||
}
|
||||
],
|
||||
"output_links": [
|
||||
{
|
||||
"link": [
|
||||
"https://luci-logdog.appspot.com/v/?s",
|
||||
"=android%2Fswarming%2Flogcats%2F",
|
||||
"${TASK_ID}%2F%2B%2Funified_logcats"
|
||||
],
|
||||
"name": "shard #${SHARD_INDEX} logcats"
|
||||
}
|
||||
]
|
||||
},
|
||||
"test": "weblayer_private_instrumentation_test_apk",
|
||||
"test_target": "//weblayer/browser/android/javatests:weblayer_private_instrumentation_test_apk"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"--gs-results-bucket=chromium-result-details",
|
||||
@ -32886,6 +33114,52 @@
|
||||
"test": "weblayer_instrumentation_test_apk",
|
||||
"test_target": "//weblayer/browser/android/javatests:weblayer_instrumentation_test_apk"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"--gs-results-bucket=chromium-result-details",
|
||||
"--recover-devices"
|
||||
],
|
||||
"isolate_coverage_data": true,
|
||||
"merge": {
|
||||
"args": [
|
||||
"--bucket",
|
||||
"chromium-result-details",
|
||||
"--test-name",
|
||||
"weblayer_private_instrumentation_test_apk"
|
||||
],
|
||||
"script": "//build/android/pylib/results/presentation/test_results_presentation.py"
|
||||
},
|
||||
"swarming": {
|
||||
"can_use_on_swarming_builders": true,
|
||||
"cipd_packages": [
|
||||
{
|
||||
"cipd_package": "infra/tools/luci/logdog/butler/${platform}",
|
||||
"location": "bin",
|
||||
"revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c"
|
||||
}
|
||||
],
|
||||
"dimension_sets": [
|
||||
{
|
||||
"device_os": "MMB29Q",
|
||||
"device_os_type": "userdebug",
|
||||
"device_type": "bullhead",
|
||||
"os": "Android"
|
||||
}
|
||||
],
|
||||
"output_links": [
|
||||
{
|
||||
"link": [
|
||||
"https://luci-logdog.appspot.com/v/?s",
|
||||
"=android%2Fswarming%2Flogcats%2F",
|
||||
"${TASK_ID}%2F%2B%2Funified_logcats"
|
||||
],
|
||||
"name": "shard #${SHARD_INDEX} logcats"
|
||||
}
|
||||
]
|
||||
},
|
||||
"test": "weblayer_private_instrumentation_test_apk",
|
||||
"test_target": "//weblayer/browser/android/javatests:weblayer_private_instrumentation_test_apk"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"--gs-results-bucket=chromium-result-details",
|
||||
@ -36839,6 +37113,52 @@
|
||||
"test": "weblayer_instrumentation_test_apk",
|
||||
"test_target": "//weblayer/browser/android/javatests:weblayer_instrumentation_test_apk"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"--gs-results-bucket=chromium-result-details",
|
||||
"--recover-devices"
|
||||
],
|
||||
"merge": {
|
||||
"args": [
|
||||
"--bucket",
|
||||
"chromium-result-details",
|
||||
"--test-name",
|
||||
"weblayer_private_instrumentation_test_apk"
|
||||
],
|
||||
"script": "//build/android/pylib/results/presentation/test_results_presentation.py"
|
||||
},
|
||||
"swarming": {
|
||||
"can_use_on_swarming_builders": true,
|
||||
"cipd_packages": [
|
||||
{
|
||||
"cipd_package": "infra/tools/luci/logdog/butler/${platform}",
|
||||
"location": "bin",
|
||||
"revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c"
|
||||
}
|
||||
],
|
||||
"dimension_sets": [
|
||||
{
|
||||
"device_os": "PQ3A.190801.002",
|
||||
"device_os_flavor": "google",
|
||||
"device_os_type": "userdebug",
|
||||
"device_type": "walleye",
|
||||
"os": "Android"
|
||||
}
|
||||
],
|
||||
"output_links": [
|
||||
{
|
||||
"link": [
|
||||
"https://luci-logdog.appspot.com/v/?s",
|
||||
"=android%2Fswarming%2Flogcats%2F",
|
||||
"${TASK_ID}%2F%2B%2Funified_logcats"
|
||||
],
|
||||
"name": "shard #${SHARD_INDEX} logcats"
|
||||
}
|
||||
]
|
||||
},
|
||||
"test": "weblayer_private_instrumentation_test_apk",
|
||||
"test_target": "//weblayer/browser/android/javatests:weblayer_private_instrumentation_test_apk"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"--gs-results-bucket=chromium-result-details",
|
||||
|
@ -9221,6 +9221,52 @@
|
||||
"test": "weblayer_instrumentation_test_apk",
|
||||
"test_target": "//weblayer/browser/android/javatests:weblayer_instrumentation_test_apk"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"--gs-results-bucket=chromium-result-details",
|
||||
"--recover-devices"
|
||||
],
|
||||
"isolate_coverage_data": true,
|
||||
"merge": {
|
||||
"args": [
|
||||
"--bucket",
|
||||
"chromium-result-details",
|
||||
"--test-name",
|
||||
"weblayer_private_instrumentation_test_apk"
|
||||
],
|
||||
"script": "//build/android/pylib/results/presentation/test_results_presentation.py"
|
||||
},
|
||||
"swarming": {
|
||||
"can_use_on_swarming_builders": true,
|
||||
"cipd_packages": [
|
||||
{
|
||||
"cipd_package": "infra/tools/luci/logdog/butler/${platform}",
|
||||
"location": "bin",
|
||||
"revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c"
|
||||
}
|
||||
],
|
||||
"dimension_sets": [
|
||||
{
|
||||
"device_os": "MMB29Q",
|
||||
"device_os_type": "userdebug",
|
||||
"device_type": "bullhead",
|
||||
"os": "Android"
|
||||
}
|
||||
],
|
||||
"output_links": [
|
||||
{
|
||||
"link": [
|
||||
"https://luci-logdog.appspot.com/v/?s",
|
||||
"=android%2Fswarming%2Flogcats%2F",
|
||||
"${TASK_ID}%2F%2B%2Funified_logcats"
|
||||
],
|
||||
"name": "shard #${SHARD_INDEX} logcats"
|
||||
}
|
||||
]
|
||||
},
|
||||
"test": "weblayer_private_instrumentation_test_apk",
|
||||
"test_target": "//weblayer/browser/android/javatests:weblayer_private_instrumentation_test_apk"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"--gs-results-bucket=chromium-result-details",
|
||||
|
@ -1813,6 +1813,10 @@
|
||||
"label": "//weblayer/browser/android/javatests:weblayer_instrumentation_test_apk",
|
||||
"type": "console_test_launcher",
|
||||
},
|
||||
"weblayer_private_instrumentation_test_apk": {
|
||||
"label": "//weblayer/browser/android/javatests:weblayer_private_instrumentation_test_apk",
|
||||
"type": "console_test_launcher",
|
||||
},
|
||||
"weblayer_shell": {
|
||||
"label": "//weblayer/shell/android:run_weblayer_shell",
|
||||
"type": "additional_compile_target",
|
||||
|
@ -3243,6 +3243,8 @@
|
||||
'weblayer_android_gtests': {
|
||||
'weblayer_instrumentation_test_apk': {
|
||||
},
|
||||
'weblayer_private_instrumentation_test_apk': {
|
||||
},
|
||||
},
|
||||
|
||||
'weblayer_gtests': {
|
||||
|
@ -9,6 +9,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.chromium.weblayer.tests">
|
||||
<uses-permission android:name="android.permission.RUN_INSTRUMENTATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<!-- We add an application tag here just so that we can indicate that this
|
||||
package needs to link against the android.test library, which is
|
||||
needed when building test cases. -->
|
||||
|
@ -49,15 +49,36 @@ android_library("weblayer_java_tests") {
|
||||
]
|
||||
}
|
||||
|
||||
android_library("weblayer_private_java_tests") {
|
||||
testonly = true
|
||||
sources = [
|
||||
"src/org/chromium/weblayer/test/InstrumentationActivityTestRule.java",
|
||||
"src/org/chromium/weblayer/test/NavigationWaiter.java",
|
||||
"src/org/chromium/weblayer/test/NetworkChangeNotifierTest.java",
|
||||
"src/org/chromium/weblayer/test/WebLayerJUnit4ClassRunner.java",
|
||||
]
|
||||
deps = [
|
||||
"//base:base_java",
|
||||
"//base:base_java_test_support",
|
||||
"//content/public/test/android:content_java_test_support",
|
||||
"//net/android:net_java_test_support",
|
||||
"//third_party/android_deps:com_android_support_support_fragment_java",
|
||||
"//third_party/android_support_test_runner:rules_java",
|
||||
"//third_party/android_support_test_runner:runner_java",
|
||||
"//third_party/junit:junit",
|
||||
"//weblayer/public/java",
|
||||
"//weblayer/public/javatestutil:test_java",
|
||||
"//weblayer/shell/android:weblayer_shell_java",
|
||||
]
|
||||
}
|
||||
|
||||
template("weblayer_instrumentation") {
|
||||
instrumentation_test_apk(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
|
||||
android_manifest = "AndroidManifest.xml"
|
||||
min_sdk_version = 21
|
||||
deps = [
|
||||
":weblayer_java_tests",
|
||||
]
|
||||
|
||||
if (!defined(additional_apks)) {
|
||||
additional_apks = []
|
||||
}
|
||||
@ -70,12 +91,16 @@ template("weblayer_instrumentation") {
|
||||
|
||||
# Runs the instrumentation tests loading the implementation from the default
|
||||
# WebView provider. This is the loading path that is used in production.
|
||||
# TODO(cduvall): Figure out why the test infrastructure fails on some Android
|
||||
# versions.
|
||||
# TODO(crbug.com/1033070): Figure out why the test infrastructure fails on some
|
||||
# Android versions.
|
||||
weblayer_instrumentation("weblayer_instrumentation_test_apk") {
|
||||
apk_name = "WebLayerInstrumentationTest"
|
||||
apk_under_test = "//weblayer/shell/android:weblayer_shell_system_webview_apk"
|
||||
use_webview_provider = system_webview_apk_target
|
||||
|
||||
deps = [
|
||||
":weblayer_java_tests",
|
||||
]
|
||||
}
|
||||
|
||||
# Runs the instrumentation tests loading the implementation from the WebLayer
|
||||
@ -84,4 +109,18 @@ weblayer_instrumentation("weblayer_support_instrumentation_test_apk") {
|
||||
apk_name = "WebLayerSupportInstrumentationTest"
|
||||
apk_under_test = "//weblayer/shell/android:weblayer_shell_apk"
|
||||
additional_apks = [ "//weblayer/shell/android:weblayer_support_apk" ]
|
||||
|
||||
deps = [
|
||||
":weblayer_java_tests",
|
||||
]
|
||||
}
|
||||
|
||||
weblayer_instrumentation("weblayer_private_instrumentation_test_apk") {
|
||||
apk_name = "WebLayerPrivateInstrumentationTest"
|
||||
apk_under_test = "//weblayer/shell/android:weblayer_shell_apk"
|
||||
additional_apks = [ "//weblayer/shell/android:weblayer_support_apk" ]
|
||||
|
||||
deps = [
|
||||
":weblayer_private_java_tests",
|
||||
]
|
||||
}
|
||||
|
38
weblayer/browser/android/javatests/src/org/chromium/weblayer/test/NetworkChangeNotifierTest.java
Normal file
38
weblayer/browser/android/javatests/src/org/chromium/weblayer/test/NetworkChangeNotifierTest.java
Normal file
@ -0,0 +1,38 @@
|
||||
// Copyright 2020 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
package org.chromium.weblayer.test;
|
||||
|
||||
import android.os.RemoteException;
|
||||
import android.support.test.filters.SmallTest;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.chromium.base.test.util.Feature;
|
||||
import org.chromium.weblayer.TestWebLayer;
|
||||
import org.chromium.weblayer.shell.InstrumentationActivity;
|
||||
|
||||
/** Tests that integration with NetworkStateNotifier works as expected. */
|
||||
@RunWith(WebLayerJUnit4ClassRunner.class)
|
||||
public final class NetworkChangeNotifierTest {
|
||||
@Rule
|
||||
public InstrumentationActivityTestRule mActivityTestRule =
|
||||
new InstrumentationActivityTestRule();
|
||||
|
||||
@Test
|
||||
@SmallTest
|
||||
@Feature({"WebLayer"})
|
||||
public void testNetworkChangeNotifierAutoDetectRegistered()
|
||||
throws RemoteException, JSONException {
|
||||
// This creates an activity with WebLayer loaded, and causes WebLayer
|
||||
// code to start listening to changes in network connectivity.
|
||||
InstrumentationActivity activity = mActivityTestRule.launchShellWithUrl("about:blank");
|
||||
TestWebLayer testWebLayer = TestWebLayer.getTestWebLayer(activity.getApplicationContext());
|
||||
Assert.assertTrue(testWebLayer.isNetworkChangeAutoDetectOn());
|
||||
}
|
||||
}
|
@ -87,6 +87,17 @@ android_library("java") {
|
||||
"//third_party/android_sdk:public_framework_system_java"
|
||||
}
|
||||
|
||||
android_library("test_java") {
|
||||
testonly = true
|
||||
sources = [
|
||||
"org/chromium/weblayer_private/test/TestWebLayerImpl.java",
|
||||
]
|
||||
deps = [
|
||||
"//net/android:net_java",
|
||||
]
|
||||
srcjar_deps = [ ":test_aidl" ]
|
||||
}
|
||||
|
||||
generate_jni("jni") {
|
||||
sources = [
|
||||
"org/chromium/weblayer_private/ContentViewRenderView.java",
|
||||
@ -180,3 +191,11 @@ android_aidl("aidl") {
|
||||
"org/chromium/weblayer_private/interfaces/IWebLayerFactory.aidl",
|
||||
]
|
||||
}
|
||||
|
||||
android_aidl("test_aidl") {
|
||||
import_include = [ "." ]
|
||||
testonly = true
|
||||
sources = [
|
||||
"org/chromium/weblayer_private/test_interfaces/ITestWebLayer.aidl",
|
||||
]
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
// Copyright 2020 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
package org.chromium.weblayer_private.test;
|
||||
|
||||
import android.os.IBinder;
|
||||
|
||||
import org.chromium.base.annotations.UsedByReflection;
|
||||
import org.chromium.net.NetworkChangeNotifier;
|
||||
import org.chromium.weblayer_private.test_interfaces.ITestWebLayer;
|
||||
|
||||
/**
|
||||
* Root implementation class for TestWebLayer.
|
||||
*/
|
||||
@UsedByReflection("WebLayer")
|
||||
public final class TestWebLayerImpl extends ITestWebLayer.Stub {
|
||||
@UsedByReflection("WebLayer")
|
||||
public static IBinder create() {
|
||||
return new TestWebLayerImpl();
|
||||
}
|
||||
|
||||
private TestWebLayerImpl() {}
|
||||
|
||||
@Override
|
||||
public boolean isNetworkChangeAutoDetectOn() {
|
||||
return NetworkChangeNotifier.getAutoDetectorForTest() != null;
|
||||
}
|
||||
}
|
10
weblayer/browser/java/org/chromium/weblayer_private/test_interfaces/ITestWebLayer.aidl
Normal file
10
weblayer/browser/java/org/chromium/weblayer_private/test_interfaces/ITestWebLayer.aidl
Normal file
@ -0,0 +1,10 @@
|
||||
// Copyright 2020 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
package org.chromium.weblayer_private.test_interfaces;
|
||||
|
||||
interface ITestWebLayer {
|
||||
// Force network connectivity state.
|
||||
boolean isNetworkChangeAutoDetectOn() = 1;
|
||||
}
|
20
weblayer/public/javatestutil/BUILD.gn
Normal file
20
weblayer/public/javatestutil/BUILD.gn
Normal file
@ -0,0 +1,20 @@
|
||||
# Copyright 2020 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import("//build/config/android/config.gni")
|
||||
import("//build/config/android/rules.gni")
|
||||
|
||||
android_library("test_java") {
|
||||
testonly = true
|
||||
sources = [
|
||||
"org/chromium/weblayer/TestWebLayer.java",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"//base:base_java_test_support",
|
||||
"//third_party/junit:junit",
|
||||
"//weblayer/browser/java:test_java",
|
||||
"//weblayer/public/java",
|
||||
]
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
// Copyright 2020 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
package org.chromium.weblayer;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.AndroidRuntimeException;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.chromium.weblayer_private.test_interfaces.ITestWebLayer;
|
||||
|
||||
/**
|
||||
* TestWebLayer is responsible for passing messages over a test only AIDL to the
|
||||
* WebLayer implementation.
|
||||
*/
|
||||
public final class TestWebLayer {
|
||||
@Nullable
|
||||
private ITestWebLayer mITestWebLayer;
|
||||
|
||||
@Nullable
|
||||
private static TestWebLayer sInstance;
|
||||
|
||||
public static TestWebLayer getTestWebLayer(@NonNull Context appContext) {
|
||||
if (sInstance == null) sInstance = new TestWebLayer(appContext);
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private TestWebLayer(@NonNull Context appContext) {
|
||||
ClassLoader remoteClassLoader;
|
||||
try {
|
||||
remoteClassLoader = WebLayer.getOrCreateRemoteContext(appContext).getClassLoader();
|
||||
Class TestWebLayerClass = remoteClassLoader.loadClass(
|
||||
"org.chromium.weblayer_private.test.TestWebLayerImpl");
|
||||
mITestWebLayer = ITestWebLayer.Stub.asInterface(
|
||||
(IBinder) TestWebLayerClass.getMethod("create").invoke(null));
|
||||
} catch (PackageManager.NameNotFoundException | ReflectiveOperationException e) {
|
||||
throw new AndroidRuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isNetworkChangeAutoDetectOn() throws RemoteException {
|
||||
return mITestWebLayer.isNetworkChangeAutoDetectOn();
|
||||
}
|
||||
}
|
@ -163,6 +163,7 @@ android_apk("weblayer_support_apk") {
|
||||
"//base:base_java",
|
||||
"//weblayer:locale_pak_assets",
|
||||
"//weblayer/browser/java",
|
||||
"//weblayer/browser/java:test_java",
|
||||
]
|
||||
|
||||
# Transitive dependencies
|
||||
|
Reference in New Issue
Block a user