diff options
author | Brett Wilson <brettw@chromium.org> | 2015-08-22 13:36:49 -0700 |
---|---|---|
committer | Brett Wilson <brettw@chromium.org> | 2015-08-22 20:39:20 +0000 |
commit | 817fec0d4f038f90cae45ed78fe71f22336c3c4a (patch) | |
tree | 509284cab926558de491cf314ed1451458cd1802 | |
parent | 1ee3626cbd39116f57ede2a22d5acea9f0fbfc32 (diff) | |
download | chromium_src-817fec0d4f038f90cae45ed78fe71f22336c3c4a.zip chromium_src-817fec0d4f038f90cae45ed78fe71f22336c3c4a.tar.gz chromium_src-817fec0d4f038f90cae45ed78fe71f22336c3c4a.tar.bz2 |
Add more components_unittests to GN build
This adds tests for: url matcher, precache, sync driver, serialization, proxy config, leveldb proto, error page, storage monitor, search provider logos, translate, json schema, guest view, dom distiller, network hints.
CQ_EXTRA_TRYBOTS=tryserver.chromium.mac:mac_chromium_gn_rel
TBR=dpranke@chromium.org
Reland of issue 1303703004.
TBR=dpranke@chromium.org
Review URL: https://codereview.chromium.org/1311623002 .
Cr-Commit-Position: refs/heads/master@{#344987}
23 files changed, 309 insertions, 71 deletions
@@ -513,7 +513,7 @@ group("both_gn_and_gyp") { # are pulled in automatically. deps += [ "//cc/blink", - "//components/ui/zoom:ui_zoom", + "//components/ui/zoom", "//content", "//content/test:test_support", "//device/battery", diff --git a/build/gn_migration.gypi b/build/gn_migration.gypi index 55b63e2..5aef3fb 100644 --- a/build/gn_migration.gypi +++ b/build/gn_migration.gypi @@ -419,7 +419,7 @@ # TODO(GYP): remove these when the corresponding root targets work. #"//cc/blink", - #"//components/ui/zoom:ui_zoom", + #"//components/ui/zoom", #"//content", #"//content/test:test_support", #"//device/battery", diff --git a/chromeos/BUILD.gn b/chromeos/BUILD.gn index ea0a9d0..5b9a574 100644 --- a/chromeos/BUILD.gn +++ b/chromeos/BUILD.gn @@ -43,15 +43,15 @@ component("chromeos") { defines = [ "CHROMEOS_IMPLEMENTATION" ] } -static_library("test_support") { +source_set("test_support") { testonly = true configs += [ "//build/config/linux:dbus" ] - deps = [ - "//testing/gmock", + public_deps = [ ":chromeos", ":cryptohome_proto", ":power_manager_proto", ":test_support_without_gmock", + "//testing/gmock", ] sources = [ "attestation/mock_attestation_flow.cc", diff --git a/components/BUILD.gn b/components/BUILD.gn index 301f780..1f01f37 100644 --- a/components/BUILD.gn +++ b/components/BUILD.gn @@ -65,6 +65,9 @@ group("all_components") { "//components/mime_util", "//components/navigation_interception", "//components/navigation_metrics", + "//components/network_hints/browser", + "//components/network_hints/common", + "//components/network_hints/renderer", "//components/network_time", "//components/offline_pages", "//components/omnibox/browser", @@ -168,6 +171,7 @@ group("all_components") { deps -= [ "//components/history/content/browser", "//components/keyed_service/content", + "//components/network_hints/renderer", ] } @@ -309,6 +313,7 @@ test("components_unittests") { "//components/data_reduction_proxy/core/common:unit_tests", "//components/device_event_log:unit_tests", "//components/devtools_http_handler:unit_tests", + "//components/dom_distiller/content:unit_tests", "//components/dom_distiller/core:unit_tests", "//components/domain_reliability:unit_tests", "//components/enhanced_bookmarks:unit_tests", @@ -323,8 +328,10 @@ test("components_unittests") { "//components/history/core/browser:unit_tests", "//components/history/core/common:unit_tests", "//components/invalidation/impl:unit_tests", + "//components/json_schema:unit_tests", "//components/keyed_service/content:unit_tests", "//components/keyed_service/core:unit_tests", + "//components/leveldb_proto:unit_tests", "//components/login:unit_tests", "//components/metrics:unit_tests", "//components/mime_util:unit_tests", @@ -336,14 +343,22 @@ test("components_unittests") { "//components/password_manager/core/browser:unit_tests", "//components/password_manager/core/common:unit_tests", "//components/password_manager/sync/browser:unit_tests", + "//components/precache/content:unit_tests", + "//components/precache/core:unit_tests", + "//components/proxy_config:unit_tests", "//components/rappor:unit_tests", "//components/search:unit_tests", "//components/search_engines:unit_tests", + "//components/search_provider_logos:unit_tests", "//components/signin/core/browser:unit_tests", "//components/suggestions:unit_tests", "//components/sync_driver:unit_tests", + "//components/translate/core/browser:unit_tests", + "//components/translate/core/common:unit_tests", + "//components/translate/core/language_detection:unit_tests", "//components/undo:unit_tests", "//components/url_formatter:unit_tests", + "//components/url_matcher:unit_tests", "//components/update_client:unit_tests", "//components/upload_list:unit_tests", "//components/user_prefs/tracked:unit_tests", @@ -393,6 +408,7 @@ test("components_unittests") { "//components/feedback:unit_tests", "//components/proximity_auth:unit_tests", "//components/sessions:unit_tests", + "//components/storage_monitor:unit_tests", ] } @@ -424,10 +440,13 @@ test("components_unittests") { if (is_ios) { deps += [ "//components/signin/core/browser:unit_tests" ] deps -= [ "//components/devtools_http_handler:unit_tests" ] - } - if (!is_ios) { + } else { + # Non-iOS tests. deps += [ + "//components/error_page/renderer:unit_tests", + "//components/guest_view/browser:unit_tests", "//components/navigation_interception:unit_tests", + "//components/network_hints/renderer:unit_tests", "//components/safe_json:unit_tests", "//components/scheduler:unit_tests", ] diff --git a/components/components_tests.gyp b/components/components_tests.gyp index c18d832..4e4a6bc 100644 --- a/components/components_tests.gyp +++ b/components/components_tests.gyp @@ -618,6 +618,7 @@ 'translate/core/common/translate_metrics_unittest.cc', 'translate/core/common/translate_util_unittest.cc', 'translate/core/language_detection/language_detection_util_unittest.cc', + # TODO(GYP) bug 523060: these translate tests on iOS. 'translate/ios/browser/js_translate_manager_unittest.mm', 'translate/ios/browser/language_detection_controller_unittest.mm', 'translate/ios/browser/translate_controller_unittest.mm', diff --git a/components/dom_distiller/content/BUILD.gn b/components/dom_distiller/content/BUILD.gn index 9ba3899..7f018a9 100644 --- a/components/dom_distiller/content/BUILD.gn +++ b/components/dom_distiller/content/BUILD.gn @@ -2,55 +2,67 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -if (!is_ios) { - # GYP version: components/dom_distiller.gypi:dom_distiller_content - static_library("content_browser") { - sources = [ - "browser/distillable_page_utils.cc", - "browser/distillable_page_utils.h", - "browser/distiller_javascript_utils.cc", - "browser/distiller_javascript_utils.h", - "browser/distiller_page_web_contents.cc", - "browser/distiller_page_web_contents.h", - "browser/dom_distiller_viewer_source.cc", - "browser/dom_distiller_viewer_source.h", - "browser/external_feedback_reporter.h", - "browser/web_contents_main_frame_observer.cc", - "browser/web_contents_main_frame_observer.h", - ] +assert(!is_ios) - public_deps = [ - "//components/dom_distiller/core", - ] - deps = [ - "//base", - "//components/resources", - "//components/strings", - "//content/public/browser", - "//net", - "//skia", - "//sync", - "//ui/gfx", - "//url", - ] +# GYP version: components/dom_distiller.gypi:dom_distiller_content +source_set("content_browser") { + sources = [ + "browser/distillable_page_utils.cc", + "browser/distillable_page_utils.h", + "browser/distiller_javascript_utils.cc", + "browser/distiller_javascript_utils.h", + "browser/distiller_page_web_contents.cc", + "browser/distiller_page_web_contents.h", + "browser/dom_distiller_viewer_source.cc", + "browser/dom_distiller_viewer_source.h", + "browser/external_feedback_reporter.h", + "browser/web_contents_main_frame_observer.cc", + "browser/web_contents_main_frame_observer.h", + ] - if (is_android) { - sources += [ - "browser/distillable_page_utils_android.cc", - "browser/distillable_page_utils_android.h", - ] - deps += [ ":jni_headers" ] - } - } + public_deps = [ + "//components/dom_distiller/core", + "//content/public/browser", + ] + deps = [ + "//base", + "//components/resources", + "//components/strings", + "//net", + "//skia", + "//sync", + "//ui/gfx", + "//url", + ] if (is_android) { - import("//build/config/android/rules.gni") + sources += [ + "browser/distillable_page_utils_android.cc", + "browser/distillable_page_utils_android.h", + ] + deps += [ ":jni_headers" ] + } +} + +if (is_android) { + import("//build/config/android/rules.gni") - generate_jni("jni_headers") { - sources = [ - "../android/java/src/org/chromium/components/dom_distiller/content/DistillablePageUtils.java", - ] - jni_package = "dom_distiller_content" - } + generate_jni("jni_headers") { + sources = [ + "../android/java/src/org/chromium/components/dom_distiller/content/DistillablePageUtils.java", + ] + jni_package = "dom_distiller_content" } } + +source_set("unit_tests") { + testonly = true + sources = [ + "browser/dom_distiller_viewer_source_unittest.cc", + "browser/web_contents_main_frame_observer_unittest.cc", + ] + deps = [ + ":content_browser", + "//testing/gtest", + ] +} diff --git a/components/dom_distiller/core/BUILD.gn b/components/dom_distiller/core/BUILD.gn index 2d12abd..f07e024 100644 --- a/components/dom_distiller/core/BUILD.gn +++ b/components/dom_distiller/core/BUILD.gn @@ -118,6 +118,7 @@ source_set("unit_tests") { testonly = true sources = [ "article_entry_unittest.cc", + "distillable_page_detector_unittest.cc", "distilled_content_store_unittest.cc", "distilled_page_prefs_unittests.cc", "distiller_unittest.cc", diff --git a/components/error_page/renderer/BUILD.gn b/components/error_page/renderer/BUILD.gn index bafaada..83c49a1 100644 --- a/components/error_page/renderer/BUILD.gn +++ b/components/error_page/renderer/BUILD.gn @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -static_library("renderer") { +source_set("renderer") { sources = [ "net_error_helper_core.cc", "net_error_helper_core.h", @@ -20,3 +20,14 @@ static_library("renderer") { "//url", ] } + +source_set("unit_tests") { + testonly = true + sources = [ + "net_error_helper_core_unittest.cc", + ] + deps = [ + ":renderer", + "//testing/gtest", + ] +} diff --git a/components/guest_view/browser/BUILD.gn b/components/guest_view/browser/BUILD.gn index d588582..0aba612 100644 --- a/components/guest_view/browser/BUILD.gn +++ b/components/guest_view/browser/BUILD.gn @@ -36,8 +36,19 @@ source_set("test_support") { "//components/guest_view/browser/test_guest_view_manager.h", ] - deps = [ + public_deps = [ ":browser", "//content/test:test_support", ] } + +source_set("unit_tests") { + testonly = true + sources = [ + "guest_view_manager_unittest.cc", + ] + deps = [ + ":test_support", + "//testing/gtest", + ] +} diff --git a/components/json_schema/BUILD.gn b/components/json_schema/BUILD.gn index 8bcb7d5..4e7b435 100644 --- a/components/json_schema/BUILD.gn +++ b/components/json_schema/BUILD.gn @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -static_library("json_schema") { +source_set("json_schema") { sources = [ "json_schema_constants.cc", "json_schema_constants.h", @@ -15,3 +15,16 @@ static_library("json_schema") { "//third_party/re2", ] } + +source_set("unit_tests") { + testonly = true + sources = [ + "json_schema_validator_unittest.cc", + "json_schema_validator_unittest_base.cc", + "json_schema_validator_unittest_base.h", + ] + deps = [ + ":json_schema", + "//testing/gtest", + ] +} diff --git a/components/leveldb_proto/BUILD.gn b/components/leveldb_proto/BUILD.gn index 9743af0..03297f9 100644 --- a/components/leveldb_proto/BUILD.gn +++ b/components/leveldb_proto/BUILD.gn @@ -21,8 +21,20 @@ source_set("test_support") { "testing/fake_db.h", ] - deps = [ + public_deps = [ ":leveldb_proto", "//components/leveldb_proto/testing/proto", ] } + +source_set("unit_tests") { + testonly = true + sources = [ + "proto_database_impl_unittest.cc", + ] + deps = [ + ":test_support", + "//testing/gmock", + "//testing/gtest", + ] +} diff --git a/components/metrics/BUILD.gn b/components/metrics/BUILD.gn index 4796d5c..3a5fd4d 100644 --- a/components/metrics/BUILD.gn +++ b/components/metrics/BUILD.gn @@ -208,5 +208,10 @@ source_set("unit_tests") { "//content/public/common", "//testing/gtest", ] + + if (is_linux) { + sources += [ "serialization/serialization_utils_unittest.cc" ] + deps += [ ":serialization" ] + } } # TODO(GYP): metrics_chromeos diff --git a/components/network_hints/renderer/BUILD.gn b/components/network_hints/renderer/BUILD.gn index 48f52cd..8ddd2ab 100644 --- a/components/network_hints/renderer/BUILD.gn +++ b/components/network_hints/renderer/BUILD.gn @@ -21,3 +21,15 @@ source_set("renderer") { "//third_party/WebKit/public:blink", ] } + +source_set("unit_tests") { + testonly = true + sources = [ + "dns_prefetch_queue_unittest.cc", + "renderer_dns_prefetch_unittest.cc", + ] + deps = [ + ":renderer", + "//testing/gtest", + ] +} diff --git a/components/precache/content/BUILD.gn b/components/precache/content/BUILD.gn index f3f7bd9..57ca5e2 100644 --- a/components/precache/content/BUILD.gn +++ b/components/precache/content/BUILD.gn @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -static_library("content") { +source_set("content") { sources = [ "precache_manager.cc", "precache_manager.h", @@ -17,3 +17,15 @@ static_library("content") { "//url", ] } + +source_set("unit_tests") { + testonly = true + sources = [ + "precache_manager_unittest.cc", + ] + deps = [ + ":content", + "//testing/gmock", + "//testing/gtest", + ] +} diff --git a/components/precache/core/BUILD.gn b/components/precache/core/BUILD.gn index ca97225..4aa14d0 100644 --- a/components/precache/core/BUILD.gn +++ b/components/precache/core/BUILD.gn @@ -18,7 +18,7 @@ config("precache_config") { ] } -static_library("core") { +source_set("core") { sources = [ "precache_database.cc", "precache_database.h", @@ -47,3 +47,18 @@ proto_library("proto") { "proto/precache.proto", ] } + +source_set("unit_tests") { + testonly = true + sources = [ + "precache_database_unittest.cc", + "precache_fetcher_unittest.cc", + "precache_url_table_unittest.cc", + ] + deps = [ + ":core", + ":proto", + "//testing/gmock", + "//testing/gtest", + ] +} diff --git a/components/proxy_config/BUILD.gn b/components/proxy_config/BUILD.gn index 439fd30..7c68794 100644 --- a/components/proxy_config/BUILD.gn +++ b/components/proxy_config/BUILD.gn @@ -19,3 +19,15 @@ component("proxy_config") { "//net", ] } + +source_set("unit_tests") { + testonly = true + sources = [ + "proxy_config_dictionary_unittest.cc", + "proxy_prefs_unittest.cc", + ] + deps = [ + ":proxy_config", + "//testing/gtest", + ] +} diff --git a/components/search_provider_logos/BUILD.gn b/components/search_provider_logos/BUILD.gn index aa38308..2465112 100644 --- a/components/search_provider_logos/BUILD.gn +++ b/components/search_provider_logos/BUILD.gn @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -static_library("search_provider_logos") { +source_set("search_provider_logos") { sources = [ "google_logo_api.cc", "google_logo_api.h", @@ -14,11 +14,27 @@ static_library("search_provider_logos") { "logo_tracker.h", ] - deps = [ + public_deps = [ "//base", - "//net", "//skia", + ] + + deps = [ + "//net", "//ui/gfx", "//url", ] } + +source_set("unit_tests") { + testonly = true + sources = [ + "logo_cache_unittest.cc", + "logo_tracker_unittest.cc", + ] + deps = [ + ":search_provider_logos", + "//testing/gmock", + "//testing/gtest", + ] +} diff --git a/components/storage_monitor/BUILD.gn b/components/storage_monitor/BUILD.gn index 48b34d0..ccb33ce 100644 --- a/components/storage_monitor/BUILD.gn +++ b/components/storage_monitor/BUILD.gn @@ -5,7 +5,7 @@ import("//build/config/features.gni") # GYP version: components/storage_monitor.gypi:storage_monitor -static_library("storage_monitor") { +source_set("storage_monitor") { sources = [ "image_capture_device.h", "image_capture_device.mm", @@ -85,7 +85,7 @@ static_library("storage_monitor") { } # GYP version: components/storage_monitor.gypi:storage_monitor_test_support -static_library("test_support") { +source_set("test_support") { sources = [ "mock_removable_storage_observer.cc", "mock_removable_storage_observer.h", @@ -101,16 +101,47 @@ static_library("test_support") { "test_volume_mount_watcher_win.h", ] - deps = [ - "//base", + public_deps = [ ":storage_monitor", + "//base", ] if (is_linux) { - deps += [ + deps = [ "//device/media_transfer_protocol", "//device/media_transfer_protocol:mtp_file_entry_proto", "//device/media_transfer_protocol:mtp_storage_info_proto", ] } } + +source_set("unit_tests") { + testonly = true + sources = [ + "image_capture_device_manager_unittest.mm", + "media_storage_util_unittest.cc", + "media_transfer_protocol_device_observer_linux_unittest.cc", + "storage_info_unittest.cc", + "storage_monitor_mac_unittest.mm", + "storage_monitor_unittest.cc", + "storage_monitor_win_unittest.cc", + ] + + configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] + + deps = [ + ":test_support", + "//testing/gtest", + ] + + if (is_linux && !is_chromeos) { + sources += [ "storage_monitor_linux_unittest.cc" ] + } + if (is_chromeos) { + sources += [ "storage_monitor_chromeos_unittest.cc" ] + deps += [ + "//chromeos:test_support", + "//testing/gmock", + ] + } +} diff --git a/components/sync_driver/BUILD.gn b/components/sync_driver/BUILD.gn index ec03122..8c6181c 100644 --- a/components/sync_driver/BUILD.gn +++ b/components/sync_driver/BUILD.gn @@ -167,6 +167,7 @@ source_set("unit_tests") { "shared_change_processor_unittest.cc", "sync_policy_handler_unittest.cc", "sync_prefs_unittest.cc", + "sync_stopped_reporter_unittest.cc", "system_encryptor_unittest.cc", "tab_node_pool_unittest.cc", "ui_data_type_controller_unittest.cc", diff --git a/components/translate/core/browser/BUILD.gn b/components/translate/core/browser/BUILD.gn index 13728f4..862d2d0 100644 --- a/components/translate/core/browser/BUILD.gn +++ b/components/translate/core/browser/BUILD.gn @@ -51,3 +51,18 @@ source_set("browser") { "//url", ] } + +source_set("unit_tests") { + testonly = true + sources = [ + "language_state_unittest.cc", + "translate_browser_metrics_unittest.cc", + "translate_language_list_unittest.cc", + "translate_prefs_unittest.cc", + "translate_script_unittest.cc", + ] + deps = [ + ":browser", + "//testing/gtest", + ] +} diff --git a/components/translate/core/common/BUILD.gn b/components/translate/core/common/BUILD.gn index 9cde65a..e4f73c02 100644 --- a/components/translate/core/common/BUILD.gn +++ b/components/translate/core/common/BUILD.gn @@ -24,3 +24,15 @@ source_set("common") { "//url", ] } + +source_set("unit_tests") { + testonly = true + sources = [ + "translate_metrics_unittest.cc", + "translate_util_unittest.cc", + ] + deps = [ + ":common", + "//testing/gtest", + ] +} diff --git a/components/translate/core/language_detection/BUILD.gn b/components/translate/core/language_detection/BUILD.gn index 57e1d10..a1d15ef 100644 --- a/components/translate/core/language_detection/BUILD.gn +++ b/components/translate/core/language_detection/BUILD.gn @@ -4,7 +4,7 @@ import("//build/config/features.gni") -static_library("language_detection") { +source_set("language_detection") { sources = [ "language_detection_util.cc", "language_detection_util.h", @@ -18,8 +18,20 @@ static_library("language_detection") { if (cld_version == 1) { deps += [ "//third_party/cld" ] + } else if (cld_version == 2) { + deps += [ "//third_party/cld_2:cld2_platform_impl" ] + } else { + assert(false, "Need a CLD version") } - if (cld_version == 2) { - deps += [ "//third_party/cld_2" ] - } +} + +source_set("unit_tests") { + testonly = true + sources = [ + "language_detection_util_unittest.cc", + ] + deps = [ + ":language_detection", + "//testing/gtest", + ] } diff --git a/components/url_matcher/BUILD.gn b/components/url_matcher/BUILD.gn index 7df189b..9ba616f 100644 --- a/components/url_matcher/BUILD.gn +++ b/components/url_matcher/BUILD.gn @@ -23,7 +23,7 @@ component("url_matcher") { defines = [ "URL_MATCHER_IMPLEMENTATION" ] - deps = [ + public_deps = [ "//base", "//base/third_party/dynamic_annotations", "//third_party/re2", @@ -32,3 +32,18 @@ component("url_matcher") { configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] } + +source_set("unit_tests") { + testonly = true + sources = [ + "regex_set_matcher_unittest.cc", + "string_pattern_unittest.cc", + "substring_set_matcher_unittest.cc", + "url_matcher_factory_unittest.cc", + "url_matcher_unittest.cc", + ] + deps = [ + ":url_matcher", + "//testing/gtest", + ] +} |