# Copyright 2015 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("//android_webview/variables.gni") import("//build/config/android/rules.gni") import("//build/config/python.gni") import("//device/vr/buildflags/buildflags.gni") import("//testing/test.gni") import("//tools/v8_context_snapshot/v8_context_snapshot.gni") # Mark all targets as test only. testonly = true group("test") { deps = [ ":android_webview_junit_tests", ":android_webview_unittests", ":webview_instrumentation_test_apk", ] } python_library("webview_cts_tests") { pydeps_file = "//android_webview/tools/run_cts.pydeps" deps = [ "//android_webview:system_webview_apk" ] data_deps = [ "//build/android:logdog_wrapper_py", "//build/android:test_runner_py", "//testing/buildbot/filters:webview_cts_tests_filters", ] data = [ "//android_webview/tools/cts_config/" ] } python_library("system_webview_wpt") { testonly = true pydeps_file = "//testing/scripts/run_android_wpt.pydeps" data_deps = [ "//android_webview:system_webview_apk", "//android_webview/tools/system_webview_shell:system_webview_shell_layout_test_apk", "//chrome/test/chromedriver:chromedriver($host_toolchain)", "//third_party/blink/tools:wpt_tests_android_isolate", ] } android_apk("webview_instrumentation_apk") { deps = [ ":webview_instrumentation_apk_assets", ":webview_instrumentation_apk_resources", ":webview_instrumentation_test_utils_java", "//android_webview:android_webview_java", "//android_webview:android_webview_product_config_java", "//android_webview:common_java", "//android_webview:locale_pak_assets", "//android_webview:platform_service_bridge_upstream_implementation_java", "//base:base_java", "//base:base_java_test_support", "//components/heap_profiling/multi_process:heap_profiling_java_test_support", "//components/policy/android:policy_java_test_support", "//content/public/android:content_java", "//third_party/android_support_test_runner:runner_java", "//third_party/junit", "//ui/android:ui_java", "//url:gurl_java", ] apk_name = "WebViewInstrumentation" android_manifest = "shell/AndroidManifest.xml" sources = [ "shell/src/org/chromium/android_webview/shell/AwShellActivity.java", "shell/src/org/chromium/android_webview/shell/AwShellApplication.java", "shell/src/org/chromium/android_webview/shell/AwShellResourceProvider.java", "shell/src/org/chromium/android_webview/shell/AwShellSwitches.java", "shell/src/org/chromium/android_webview/shell/DrawFn.java", "shell/src/org/chromium/android_webview/test/AwJUnit4ClassRunner.java", "shell/src/org/chromium/android_webview/test/AwTestContainerView.java", "shell/src/org/chromium/android_webview/test/AwTestRunnerActivity.java", "shell/src/org/chromium/android_webview/test/NullContentsClient.java", "shell/src/org/chromium/android_webview/test/OnlyRunIn.java", "shell/src/org/chromium/android_webview/test/SecondBrowserProcess.java", "shell/src/org/chromium/android_webview/test/TestContentProvider.java", ] product_config_java_packages = [ webview_product_config_java_package ] shared_libraries = [ ":libstandalonelibwebviewchromium" ] native_lib_version_rule = "//build/util:chrome_version_json" _native_lib_file = rebase_path("$root_gen_dir/CHROME_VERSION.json", root_build_dir) native_lib_version_arg = "@FileArg($_native_lib_file:full-quoted)" command_line_flags_file = "android-webview-command-line" } android_resources("webview_instrumentation_apk_resources") { sources = [ "shell/res/layout/testshell_activity.xml", "shell/res/raw/resource_file.html", "shell/res/raw/resource_icon.png", "shell/res/values/config.xml", ] custom_package = "org.chromium.android_webview.shell" } android_assets("webview_instrumentation_apk_assets") { deps = [ "//android_webview:pak_file_assets", "//third_party/icu:icu_assets", ] sources = [ "shell/assets/asset_file.html", "shell/assets/asset_icon.png", "shell/assets/autofill.html", "shell/assets/cookie_test.html", "shell/assets/cors.html", "shell/assets/full_screen_video.js", "shell/assets/full_screen_video_inside_div_test.html", "shell/assets/full_screen_video_test.html", "shell/assets/full_screen_video_test_not_preloaded.html", "shell/assets/key-system-test.html", "shell/assets/star.svg", "shell/assets/star.svgz", "shell/assets/video.webm", "shell/assets/visual_state_during_fullscreen_test.html", "shell/assets/visual_state_on_page_commit_visible_test.html", "shell/assets/visual_state_waits_for_js_detached_test.html", "shell/assets/visual_state_waits_for_js_test.html", ] if (use_v8_context_snapshot) { deps += [ "//tools/v8_context_snapshot:v8_context_snapshot_assets" ] } else { deps += [ "//v8:v8_external_startup_data_assets" ] } } shared_library("libstandalonelibwebviewchromium") { testonly = true sources = [ "shell/src/draw_gl/draw_fn.cc" ] ldflags = [ "-Wl,-shared,-Bsymbolic" ] deps = [ ":webview_instrumentation_test_native_jni_impl", "//android_webview/lib", "//android_webview/lib:webview_entry_point", "//android_webview/nonembedded", "//android_webview/public", "//base", "//components/heap_profiling/multi_process:test_support", "//content/public/test/android:content_native_test_support", ] configs -= [ "//build/config/android:hide_all_but_jni_onload" ] configs += [ "//build/config/android:hide_all_but_jni" ] } instrumentation_test_apk("webview_instrumentation_test_apk") { apk_name = "WebViewInstrumentationTest" apk_under_test = ":webview_instrumentation_apk" android_manifest = "../javatests/AndroidManifest.xml" min_sdk_version = 21 deps = [ ":webview_instrumentation_test_utils_java", "//android_webview:android_webview_java", "//android_webview:common_aidl_java", "//android_webview:common_crash_java", "//android_webview:common_platform_services_java", "//android_webview:common_variations_java", "//android_webview/nonembedded:devui_java", "//android_webview/nonembedded:services_java", "//android_webview/proto:aw_variations_seed_proto_java", "//android_webview/proto:metrics_bridge_records_proto_java", "//android_webview/test/embedded_test_server:aw_net_java_test_support", "//base:base_java", "//base:base_java_test_support", "//components/autofill/android:autofill_java", "//components/autofill/android/provider:java", "//components/autofill/core/common/mojom:mojo_types_java", "//components/background_task_scheduler:background_task_scheduler_task_ids_java", "//components/content_capture/android:java", "//components/embedder_support/android:web_contents_delegate_java", "//components/heap_profiling/multi_process:heap_profiling_java_test_support", "//components/metrics:metrics_java", "//components/minidump_uploader:minidump_uploader_java", "//components/minidump_uploader:minidump_uploader_javatests", "//components/policy/android:policy_java", "//components/policy/android:policy_java_test_support", "//components/safe_browsing/android:safe_browsing_java", "//components/variations/android:variations_java", "//components/variations/proto:proto_java", "//components/version_info/android:version_constants_java", "//content/public/android:content_java", "//content/public/test/android:content_java_test_support", "//mojo/public/java:bindings_java", "//net/android:net_java", "//net/android:net_java_test_support", "//net/android:net_javatests", "//services/device/public/java:geolocation_java", "//services/device/public/java:geolocation_java_test_support", "//third_party/android_deps:com_google_guava_failureaccess_java", "//third_party/android_deps:com_google_protobuf_protobuf_javalite_java", "//third_party/android_deps:espresso_java", "//third_party/android_support_test_runner:rules_java", "//third_party/android_support_test_runner:runner_java", "//third_party/blink/public/mojom:web_feature_mojo_bindings_java", "//third_party/guava:guava_android_java", "//third_party/hamcrest:hamcrest_java", "//third_party/junit", "//third_party/metrics_proto:metrics_proto_java", "//third_party/mockito:mockito_java", "//ui/android:ui_java", "//url:gurl_java", ] sources = [ "../javatests/src/org/chromium/android_webview/test/AcceptLanguageTest.java", "../javatests/src/org/chromium/android_webview/test/AndroidProtocolHandlerTest.java", "../javatests/src/org/chromium/android_webview/test/AndroidScrollIntegrationTest.java", "../javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java", "../javatests/src/org/chromium/android_webview/test/ArchiveTest.java", "../javatests/src/org/chromium/android_webview/test/AwActivityTestRule.java", "../javatests/src/org/chromium/android_webview/test/AwAutocompleteTest.java", "../javatests/src/org/chromium/android_webview/test/AwAutofillTest.java", "../javatests/src/org/chromium/android_webview/test/AwContentCaptureTest.java", "../javatests/src/org/chromium/android_webview/test/AwContentsAnchorViewTest.java", "../javatests/src/org/chromium/android_webview/test/AwContentsClientAutoLoginTest.java", "../javatests/src/org/chromium/android_webview/test/AwContentsClientCallbackHelperTest.java", "../javatests/src/org/chromium/android_webview/test/AwContentsClientFaviconTest.java", "../javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenTest.java", "../javatests/src/org/chromium/android_webview/test/AwContentsClientGetDefaultVideoPosterTest.java", "../javatests/src/org/chromium/android_webview/test/AwContentsClientOnFormResubmissionTest.java", "../javatests/src/org/chromium/android_webview/test/AwContentsClientOnRenderProcessGoneTest.java", "../javatests/src/org/chromium/android_webview/test/AwContentsClientOnRendererUnresponsiveTest.java", "../javatests/src/org/chromium/android_webview/test/AwContentsClientOnScaleChangedTest.java", "../javatests/src/org/chromium/android_webview/test/AwContentsClientOnUnhandledKeyEventTest.java", "../javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java", "../javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java", "../javatests/src/org/chromium/android_webview/test/AwContentsClientVisitedHistoryTest.java", "../javatests/src/org/chromium/android_webview/test/AwContentsContainerViewTest.java", "../javatests/src/org/chromium/android_webview/test/AwContentsGarbageCollectionTest.java", "../javatests/src/org/chromium/android_webview/test/AwContentsLifecycleNotifierTest.java", "../javatests/src/org/chromium/android_webview/test/AwContentsRenderTest.java", "../javatests/src/org/chromium/android_webview/test/AwContentsStaticsTest.java", "../javatests/src/org/chromium/android_webview/test/AwContentsTest.java", "../javatests/src/org/chromium/android_webview/test/AwFormDatabaseTest.java", "../javatests/src/org/chromium/android_webview/test/AwImeTest.java", "../javatests/src/org/chromium/android_webview/test/AwJavaBridgeTest.java", "../javatests/src/org/chromium/android_webview/test/AwLegacyQuirksTest.java", "../javatests/src/org/chromium/android_webview/test/AwMetricsIntegrationTest.java", "../javatests/src/org/chromium/android_webview/test/AwNetworkConfigurationTest.java", "../javatests/src/org/chromium/android_webview/test/AwPageLoadMetricsTest.java", "../javatests/src/org/chromium/android_webview/test/AwPermissionManagerTest.java", "../javatests/src/org/chromium/android_webview/test/AwProxyControllerTest.java", "../javatests/src/org/chromium/android_webview/test/AwQuotaManagerBridgeTest.java", "../javatests/src/org/chromium/android_webview/test/AwSecondBrowserProcessTest.java", "../javatests/src/org/chromium/android_webview/test/AwServiceWorkerClientTest.java", "../javatests/src/org/chromium/android_webview/test/AwSettingsTest.java", "../javatests/src/org/chromium/android_webview/test/AwUncaughtExceptionTest.java", "../javatests/src/org/chromium/android_webview/test/AwVariationsSeedFetcherTest.java", "../javatests/src/org/chromium/android_webview/test/AwWebContentsObserverTest.java", "../javatests/src/org/chromium/android_webview/test/AwZoomTest.java", "../javatests/src/org/chromium/android_webview/test/CleanupReferenceTest.java", "../javatests/src/org/chromium/android_webview/test/ClearHistoryTest.java", "../javatests/src/org/chromium/android_webview/test/ClientAddMessageToConsoleTest.java", "../javatests/src/org/chromium/android_webview/test/ClientOnPageFinishedTest.java", "../javatests/src/org/chromium/android_webview/test/ClientOnPageStartedTest.java", "../javatests/src/org/chromium/android_webview/test/ClientOnReceivedError2Test.java", "../javatests/src/org/chromium/android_webview/test/ClientOnReceivedErrorTest.java", "../javatests/src/org/chromium/android_webview/test/ClientOnReceivedHttpErrorTest.java", "../javatests/src/org/chromium/android_webview/test/ConsoleMessagesForBlockedLoadsTest.java", "../javatests/src/org/chromium/android_webview/test/ContentViewMiscTest.java", "../javatests/src/org/chromium/android_webview/test/CookieManagerStartupTest.java", "../javatests/src/org/chromium/android_webview/test/CookieManagerTest.java", "../javatests/src/org/chromium/android_webview/test/DarkModeTest.java", "../javatests/src/org/chromium/android_webview/test/DisableHardwareAccelerationForTest.java", "../javatests/src/org/chromium/android_webview/test/FullScreenVideoTestAwContentsClient.java", "../javatests/src/org/chromium/android_webview/test/GeolocationTest.java", "../javatests/src/org/chromium/android_webview/test/GetTitleTest.java", "../javatests/src/org/chromium/android_webview/test/HeapProfilingTest.java", "../javatests/src/org/chromium/android_webview/test/HttpAuthDatabaseTest.java", "../javatests/src/org/chromium/android_webview/test/JsJavaInteractionTest.java", "../javatests/src/org/chromium/android_webview/test/KeySystemTest.java", "../javatests/src/org/chromium/android_webview/test/LoadDataWithBaseUrlTest.java", "../javatests/src/org/chromium/android_webview/test/LoadUrlTest.java", "../javatests/src/org/chromium/android_webview/test/MediaAccessPermissionRequestTest.java", "../javatests/src/org/chromium/android_webview/test/MemoryMetricsLoggerTest.java", "../javatests/src/org/chromium/android_webview/test/NavigationHistoryTest.java", "../javatests/src/org/chromium/android_webview/test/OnDiskFileTest.java", "../javatests/src/org/chromium/android_webview/test/PolicyUrlFilteringTest.java", "../javatests/src/org/chromium/android_webview/test/PopupWindowTest.java", "../javatests/src/org/chromium/android_webview/test/PostMessageTest.java", "../javatests/src/org/chromium/android_webview/test/RenderProcessGoneHelper.java", "../javatests/src/org/chromium/android_webview/test/SafeBrowsingTest.java", "../javatests/src/org/chromium/android_webview/test/SaveRestoreStateTest.java", "../javatests/src/org/chromium/android_webview/test/SslPreferencesTest.java", "../javatests/src/org/chromium/android_webview/test/StandaloneAwQuotaManagerBridgeTest.java", "../javatests/src/org/chromium/android_webview/test/TestAwContents.java", "../javatests/src/org/chromium/android_webview/test/TestAwContentsClient.java", "../javatests/src/org/chromium/android_webview/test/TestAwServiceWorkerClient.java", "../javatests/src/org/chromium/android_webview/test/UserAgentTest.java", "../javatests/src/org/chromium/android_webview/test/VariationsSeedHolderTest.java", "../javatests/src/org/chromium/android_webview/test/VariationsSeedLoaderTest.java", "../javatests/src/org/chromium/android_webview/test/VariationsTest.java", "../javatests/src/org/chromium/android_webview/test/VisualStateTest.java", "../javatests/src/org/chromium/android_webview/test/WebKitHitTestTest.java", "../javatests/src/org/chromium/android_webview/test/WebViewAsynchronousFindApisTest.java", "../javatests/src/org/chromium/android_webview/test/WebViewFindApisTestRule.java", "../javatests/src/org/chromium/android_webview/test/WebViewModalDialogOverrideTest.java", "../javatests/src/org/chromium/android_webview/test/common/crash/CrashInfoEqualityMatcher.java", "../javatests/src/org/chromium/android_webview/test/common/crash/CrashInfoTest.java", "../javatests/src/org/chromium/android_webview/test/common/variations/VariationsUtilsTest.java", "../javatests/src/org/chromium/android_webview/test/devui/AwNonembeddedUmaRecorderTest.java", "../javatests/src/org/chromium/android_webview/test/devui/DeveloperUiTest.java", "../javatests/src/org/chromium/android_webview/test/devui/util/CrashBugUrlFactoryTest.java", "../javatests/src/org/chromium/android_webview/test/devui/util/UnuploadedFilesStateLoaderTest.java", "../javatests/src/org/chromium/android_webview/test/devui/util/UploadedCrashesInfoLoaderTest.java", "../javatests/src/org/chromium/android_webview/test/devui/util/WebViewCrashInfoCollectorTest.java", "../javatests/src/org/chromium/android_webview/test/devui/util/WebViewCrashLogParserTest.java", "../javatests/src/org/chromium/android_webview/test/services/CrashReceiverServiceTest.java", "../javatests/src/org/chromium/android_webview/test/services/MetricsBridgeServiceTest.java", "../javatests/src/org/chromium/android_webview/test/services/MinidumpUploadJobTest.java", "../javatests/src/org/chromium/android_webview/test/services/MockMetricsBridgeService.java", "../javatests/src/org/chromium/android_webview/test/services/MockVariationsSeedServer.java", "../javatests/src/org/chromium/android_webview/test/services/ServiceConnectionHelper.java", "../javatests/src/org/chromium/android_webview/test/services/VariationsSeedServerTest.java", "../javatests/src/org/chromium/android_webview/test/services/VisualStateCallbackTest.java", "../javatests/src/org/chromium/android_webview/test/util/AwQuotaManagerBridgeTestUtil.java", "../javatests/src/org/chromium/android_webview/test/util/AwTestTouchUtils.java", "../javatests/src/org/chromium/android_webview/test/util/CommonResources.java", "../javatests/src/org/chromium/android_webview/test/util/CookieUtils.java", "../javatests/src/org/chromium/android_webview/test/util/GraphicsTestUtils.java", "../javatests/src/org/chromium/android_webview/test/util/ImagePageGenerator.java", "../javatests/src/org/chromium/android_webview/test/util/JSUtils.java", "../javatests/src/org/chromium/android_webview/test/util/JavascriptEventObserver.java", "../javatests/src/org/chromium/android_webview/test/util/VideoSurfaceViewUtils.java", "../javatests/src/org/chromium/android_webview/test/util/VideoTestUtil.java", "../javatests/src/org/chromium/android_webview/test/util/VideoTestWebServer.java", ] if (!use_jacoco_coverage) { # Jacoco requires strict mode to be turned off since it writes coverage data to files. sources += [ "../javatests/src/org/chromium/android_webview/test/AwStrictModeTest.java" ] } data = [ "data/" ] data_deps = [ "//testing/buildbot/filters:webview_instrumentation_test_apk_filters" ] if (enable_chrome_android_internal) { data_deps += [ "//clank/build/bot/filters:webview_instrumentation_test_apk_filters" ] } # We only want to bother including these on bots set up for VR testing if (include_vr_data) { data += [ "//chrome/android/shared_preference_files/test/", "//third_party/gvr-android-sdk/test-apks/vr_services/vr_services_current.apk", ] } additional_apks = [ "//android_webview/test/embedded_test_server:aw_net_test_support_apk", "//net/android:net_test_support_apk", ] } android_library("webview_instrumentation_test_utils_java") { testonly = true sources = [ "../javatests/src/org/chromium/android_webview/test/util/VariationsTestUtils.java", "shell/src/org/chromium/android_webview/test/util/MemoryMetricsLoggerUtils.java", ] deps = [ "//android_webview:common_variations_java", "//base:base_java", "//base:jni_java", "//components/variations/android:variations_java", "//third_party/junit", ] annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("webview_instrumentation_test_native_jni") { testonly = true sources = [ "../javatests/src/org/chromium/android_webview/test/util/VariationsTestUtils.java", "shell/src/org/chromium/android_webview/test/util/MemoryMetricsLoggerUtils.java", ] } source_set("webview_instrumentation_test_native_jni_impl") { sources = [ "browser/variations_test_utils.cc", "shell/memory_metrics_logger_utils.cc", ] deps = [ ":webview_instrumentation_test_native_jni", "//android_webview/browser", "//base", "//base/test:test_support", "//components/embedder_support/android/metrics", "//third_party/protobuf:protobuf_lite", ] } test("android_webview_unittests") { deps = [ ":android_webview_unittests_assets", ":android_webview_unittests_java", ":android_webview_unittests_jni", "//android_webview/browser", "//android_webview/browser/gfx", "//android_webview/browser/lifecycle", "//android_webview/browser/metrics", "//android_webview/common", "//base/test:test_support", "//components/autofill/core/browser", "//components/metrics", "//components/prefs:prefs", "//components/prefs:test_support", "//content:content", "//content/test:test_support", "//mojo/core/embedder", "//net:net", "//net:test_support", "//services/network:test_support", "//ui/base:ui_base_jni_headers", "//ui/gl", "//ui/gl:test_support", ] sources = [ "../browser/aw_browser_context_unittest.cc", "../browser/aw_content_browser_client_unittest.cc", "../browser/aw_contents_client_bridge_unittest.cc", "../browser/aw_form_database_service_unittest.cc", "../browser/aw_media_url_interceptor_unittest.cc", "../browser/aw_pac_processor_unittest.cc", "../browser/aw_permission_manager_unittest.cc", "../browser/gfx/aw_attaching_to_window_recorder_unittest.cc", "../browser/gfx/begin_frame_source_webview_unittest.cc", "../browser/gfx/browser_view_renderer_unittest.cc", "../browser/gfx/test/fake_window.cc", "../browser/gfx/test/fake_window.h", "../browser/gfx/test/rendering_test.cc", "../browser/gfx/test/rendering_test.h", "../browser/input_stream_unittest.cc", "../browser/lifecycle/aw_contents_lifecycle_notifier_unittest.cc", "../browser/metrics/aw_stability_metrics_provider_unittest.cc", "../browser/metrics/visibility_metrics_logger_unittest.cc", "../browser/network_service/android_stream_reader_url_loader_unittest.cc", "../browser/network_service/input_stream_reader_unittest.cc", "../browser/permission/media_access_permission_request_unittest.cc", "../browser/permission/permission_request_handler_unittest.cc", "../browser/renderer_host/auto_login_parser_unittest.cc", "../browser/safe_browsing/aw_safe_browsing_whitelist_manager_unittest.cc", "../browser/scoped_add_feature_flags_unittests.cc", "../browser/state_serializer_unittest.cc", "../lib/webview_tests.cc", ] deps += [ "//v8:v8_external_startup_data_assets" ] } android_assets("android_webview_unittests_assets") { sources = [ "unittest/assets/asset_file.ogg" ] } android_library("android_webview_unittests_java") { testonly = true deps = [ "//android_webview:android_webview_java", "//base:base_java", "//content/public/test/android:content_java_test_support", ] sources = [ "../unittestjava/src/org/chromium/android_webview/unittest/InputStreamUnittest.java", "../unittestjava/src/org/chromium/android_webview/unittest/MockAwContentsClientBridge.java", ] } generate_jni("android_webview_unittests_jni") { testonly = true sources = [ "../unittestjava/src/org/chromium/android_webview/unittest/InputStreamUnittest.java", "../unittestjava/src/org/chromium/android_webview/unittest/MockAwContentsClientBridge.java", ] } # robolectric tests junit_binary("android_webview_junit_tests") { sources = [ "../junit/src/org/chromium/android_webview/robolectric/AwLayoutSizerTest.java", "../junit/src/org/chromium/android_webview/robolectric/AwScrollOffsetManagerTest.java", "../junit/src/org/chromium/android_webview/robolectric/FindAddressTest.java", "../junit/src/org/chromium/android_webview/robolectric/common/FlagOverrideHelperTest.java", "../junit/src/org/chromium/android_webview/robolectric/common/services/ServiceNamesTest.java", "../junit/src/org/chromium/android_webview/robolectric/metrics/AwNonembeddedUmaReplayerTest.java", ] deps = [ "//android_webview:android_webview_java", "//android_webview/nonembedded:services_java", "//android_webview/proto:metrics_bridge_records_proto_java", "//base:base_java", "//base:base_java_test_support", "//base:base_junit_test_support", "//content/public/test/android:content_java_test_support", "//third_party/android_deps:com_google_protobuf_protobuf_javalite_java", "//third_party/android_support_test_runner:runner_java", ] package_name = "org.chromium.android_webview.robolectric" }