# 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("//build/config/android/rules.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_unittests", ":webview_instrumentation_test_apk", ] } android_apk("webview_instrumentation_apk") { deps = [ ":android_webview_apk_assets", ":android_webview_apk_resources", "//android_webview:android_webview_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: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", ] apk_name = "WebViewInstrumentation" android_manifest = "shell/AndroidManifest.xml" java_files = [ "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/DrawGL.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/AwJUnit4ClassRunner.java", "shell/src/org/chromium/android_webview/test/NullContentsClient.java", "shell/src/org/chromium/android_webview/test/SecondBrowserProcess.java", "shell/src/org/chromium/android_webview/test/OnlyRunIn.java", "shell/src/org/chromium/android_webview/test/TestContentProvider.java", ] shared_libraries = [ ":libdrawgl", ":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)" enable_multidex = true command_line_flags_file = "android-webview-command-line" } android_resources("android_webview_apk_resources") { resource_dirs = [ "shell/res" ] custom_package = "org.chromium.android_webview.shell" } android_assets("android_webview_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/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/platform-media-codec-test.html", "shell/assets/star.svg", "shell/assets/star.svgz", "shell/assets/video.3gp", "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", "shell/assets/webvr_not_functional_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 = [ "../lib/webview_entry_point.cc", ] ldflags = [ "-Wl,-shared,-Bsymbolic" ] deps = [ "//android_webview:common", "//components/heap_profiling:test_support", "//components/minidump_uploader", ] 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" deps = [ "//android_webview:android_webview_java", "//android_webview:android_webview_platform_services_java", "//android_webview:android_webview_services_java", "//android_webview:aw_variations_seed_server_aidl", "//android_webview/test/embedded_test_server:aw_net_java_test_support", "//base:base_java", "//base:base_java_test_support", "//components/autofill/android:provider_java", "//components/embedder_support/android:web_contents_delegate_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", "//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", "//services/device/public/java:geolocation_java", "//services/device/public/java:geolocation_java_test_support", "//third_party/android_support_test_runner:rules_java", "//third_party/android_support_test_runner:runner_java", "//third_party/junit", "//ui/android:ui_java", ] java_files = [ "../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/AwAutofillTest.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/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/AwDebugTest.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/AwLayoutSizerTest.java", "../javatests/src/org/chromium/android_webview/test/AwLegacyQuirksTest.java", "../javatests/src/org/chromium/android_webview/test/AwPermissionManagerTest.java", "../javatests/src/org/chromium/android_webview/test/AwQuotaManagerBridgeTest.java", "../javatests/src/org/chromium/android_webview/test/AwScrollOffsetManagerTest.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/AwStrictModeTest.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/DisableHardwareAccelerationForTest.java", "../javatests/src/org/chromium/android_webview/test/FindAddressTest.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/HttpCacheTest.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/NavigationHistoryTest.java", "../javatests/src/org/chromium/android_webview/test/PlatformMediaCodecTest.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/SaveRestoreStateTest.java", "../javatests/src/org/chromium/android_webview/test/SafeBrowsingTest.java", "../javatests/src/org/chromium/android_webview/test/AwUncaughtExceptionTest.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/VariationsUtilsTest.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/WebViewWebVrTest.java", "../javatests/src/org/chromium/android_webview/test/services/CrashReceiverServiceTest.java", "../javatests/src/org/chromium/android_webview/test/services/MinidumpUploaderTest.java", "../javatests/src/org/chromium/android_webview/test/services/MockVariationsSeedServer.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/VariationsTestUtils.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", ] data = [ "data/", ] # 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", ] } test("android_webview_unittests") { # Dependencies (e.g. Play services) make the binary reach the dex limit. enable_multidex = true deps = [ ":android_webview_unittests_assets", ":android_webview_unittests_java", ":android_webview_unittests_jni", "//android_webview:common", "//base/test:test_support", "//components/prefs:prefs", "//components/prefs:test_support", "//content:content", "//content/test:test_support", "//net:net", "//net:test_support", "//ui/base:ui_base_jni_headers", "//ui/gl", "//ui/gl:test_support", ] sources = [ "../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_permission_manager_unittest.cc", "../browser/aw_safe_browsing_whitelist_manager_unittest.cc", "../browser/aw_static_cookie_policy_unittest.cc", "../browser/browser_view_renderer_unittest.cc", "../browser/command_line_helper_unittest.cc", "../browser/input_stream_unittest.cc", "../browser/net/android_stream_reader_url_request_job_unittest.cc", "../browser/net/aw_cookie_store_wrapper_unittest.cc", "../browser/net/aw_url_request_context_getter_unittest.cc", "../browser/net/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/state_serializer_unittest.cc", "../browser/test/fake_window.cc", "../browser/test/fake_window.h", "../browser/test/rendering_test.cc", "../browser/test/rendering_test.h", "../lib/webview_tests.cc", ] } 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", ] java_files = [ "../unittestjava/src/org/chromium/android_webview/unittest/InputStreamUnittest.java", "../unittestjava/src/org/chromium/android_webview/unittest/MockAwContentsClientBridge.java", ] } generate_jni("android_webview_unittests_jni") { jni_package = "android_webview_unittests" sources = [ "../unittestjava/src/org/chromium/android_webview/unittest/InputStreamUnittest.java", "../unittestjava/src/org/chromium/android_webview/unittest/MockAwContentsClientBridge.java", ] } shared_library("libdrawgl") { sources = [ "shell/src/draw_gl/draw_gl.cc", ] configs -= [ "//build/config/android:hide_all_but_jni_onload" ] }