Skip to content

Commit

Permalink
Add initial components unit tests to GN build.
Browse files Browse the repository at this point in the history
R=dalecurtis@chromium.org

Review URL: https://codereview.chromium.org/398423007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284178 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
brettw@chromium.org committed Jul 18, 2014
1 parent e8e2942 commit 0260b7a
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 5 deletions.
34 changes: 29 additions & 5 deletions components/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,32 @@ group("all_components") {
}
}

# TODO(GYP) components_unittests
#test("components_unittests") {
## # Precache tests need these defines.
# configs += [ "//components/precache/core:precache_config" ]
#}
# TODO(GYP) enable when it links.
if (false) {

# To add a unit test to this target, make a "unit_test" source_set in your
# component (it's important to use a source_set instead of a static library or
# no tests will run) and add a reference here. You can add more than one unit
# test target if convenient.
test("components_unittests") {
sources = [
"test/run_all_unittests.cc",
]

# Add only ":unit_tests" dependencies here. If your tests have dependencies
# (this would at least include the component itself), they should be on the
# test source set and not here.
deps = [
"//components/auto_login_parser:unit_tests",
"//components/autocomplete:unit_tests",
"//components/autofill/content/browser:unit_tests",
"//components/autofill/core/browser:unit_tests",
"//components/autofill/core/common:unit_tests",
]


# Precache tests need these defines.
#configs += [ "//components/precache/core:precache_config" ]
}

}
11 changes: 11 additions & 0 deletions components/auto_login_parser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,14 @@ source_set("auto_login_parser") {
"//net",
]
}

source_set("unit_tests") {
sources = [
"auto_login_parser_unittest.cc",
]

deps = [
":auto_login_parser",
"//testing/gtest",
]
}
16 changes: 16 additions & 0 deletions components/autocomplete/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ static_library("autocomplete") {
"//net",
"//url",
]

forward_dependent_configs_from = [
"//components/metrics/proto",
]
}

static_library("test_support") {
Expand All @@ -32,3 +36,15 @@ static_library("test_support") {
"//components/metrics/proto",
]
}

source_set("unit_tests") {
sources = [
"autocomplete_input_unittest.cc",
]

deps = [
":autocomplete",
":test_support",
"//testing/gtest",
]
}
25 changes: 25 additions & 0 deletions components/autofill/content/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ static_library("browser") {
#"../third_party/libjingle/libjingle.gyp:libjingle", TODO(GYP)
#"user_prefs", TODO(GYP)
]

forward_dependent_configs_from = [
"//skia",
]
}

proto_library("risk_proto") {
Expand All @@ -85,3 +89,24 @@ static_library("test_support") {
"//testing/gmock",
]
}

source_set("unit_tests") {
sources = [
"content_autofill_driver_unittest.cc",
"request_autocomplete_manager_unittest.cc",
"wallet/full_wallet_unittest.cc",
"wallet/instrument_unittest.cc",
"wallet/wallet_address_unittest.cc",
"wallet/wallet_client_unittest.cc",
"wallet/wallet_items_unittest.cc",
"wallet/wallet_service_url_unittest.cc",
"wallet/wallet_signin_helper_unittest.cc",
]

deps = [
":browser",
":test_support",
"//testing/gmock",
"//testing/gtest",
]
}
50 changes: 50 additions & 0 deletions components/autofill/core/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,59 @@ static_library("test_support") {
]

deps = [
":browser",
"//components/autofill/core/browser",
"//components/autofill/core/common",
"//skia",
"//testing/gtest",
]
}

source_set("unit_tests") {
sources = [
"address_field_unittest.cc",
"address_unittest.cc",
"android/auxiliary_profile_unittest_android.cc",
"autocomplete_history_manager_unittest.cc",
"autofill_country_unittest.cc",
"autofill_data_model_unittest.cc",
"autofill_download_unittest.cc",
"autofill_external_delegate_unittest.cc",
"autofill_field_unittest.cc",
"autofill_ie_toolbar_import_win_unittest.cc",
"autofill_manager_unittest.cc",
"autofill_merge_unittest.cc",
"autofill_metrics_unittest.cc",
"autofill_profile_unittest.cc",
"autofill_regexes_unittest.cc",
"autofill_type_unittest.cc",
"autofill_xml_parser_unittest.cc",
"contact_info_unittest.cc",
"credit_card_field_unittest.cc",
"credit_card_unittest.cc",
"form_field_unittest.cc",
"form_structure_unittest.cc",
"name_field_unittest.cc",
"password_generator_unittest.cc",
"personal_data_manager_unittest.cc",
"phone_field_unittest.cc",
"phone_number_i18n_unittest.cc",
"phone_number_unittest.cc",
"validation_unittest.cc",
"webdata/autofill_profile_syncable_service_unittest.cc",
"webdata/autofill_table_unittest.cc",
"webdata/web_data_service_unittest.cc",
]

configs += [ "//content:libjingle_stub_config" ]

deps = [
":browser",
":test_support",
"//components/resources",
"//components/strings",
"//testing/gmock",
"//third_party/libphonenumber",
#'../third_party/libjingle/libjingle.gyp:libjingle', TODO(GYP)
]
}
15 changes: 15 additions & 0 deletions components/autofill/core/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,18 @@ static_library("common") {
# deps += [ 'autofill_jni_headers' ] TODO(GYP)
}
}

source_set("unit_tests") {
sources = [
"form_data_unittest.cc",
"form_field_data_unittest.cc",
"password_form_fill_data_unittest.cc",
"save_password_progress_logger_unittest.cc",
]

deps = [
":common",
"//testing/gmock",
"//testing/gtest",
]
}
5 changes: 5 additions & 0 deletions components/components_tests.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@
['android_webview_build == 0', {
'targets': [
{
# GN version: //components/components_unittests
'target_name': 'components_unittests',
'type': '<(gtest_target_type)',
'sources': [
# Note: sources list duplicated in GN build. In the GN build,
# each component has its own unit tests target defined in its
# directory that are then linked into the final content_unittests.
'auto_login_parser/auto_login_parser_unittest.cc',
'autocomplete/autocomplete_input_unittest.cc',
'autofill/content/browser/content_autofill_driver_unittest.cc',
Expand Down Expand Up @@ -64,6 +68,7 @@
'autofill/core/common/form_field_data_unittest.cc',
'autofill/core/common/password_form_fill_data_unittest.cc',
'autofill/core/common/save_password_progress_logger_unittest.cc',
# Note: GN tests converted to here, need to do the rest.
'bookmarks/browser/bookmark_codec_unittest.cc',
'bookmarks/browser/bookmark_expanded_state_tracker_unittest.cc',
'bookmarks/browser/bookmark_index_unittest.cc',
Expand Down

0 comments on commit 0260b7a

Please sign in to comment.