| # Copyright 2014 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("//testing/test.gni") |
| import("//build/config/locales.gni") |
| import("//tools/grit/grit_rule.gni") |
| |
| config("internal_config") { |
| if (is_clang) { |
| cflags = [ |
| "-Wno-newline-eof", |
| |
| # md5.cc uses "register". TODO(thakis): Fix. |
| "-Wno-deprecated-register", |
| ] |
| } |
| |
| # libaddressinput just says `#include "messages.h"` for grit-generated |
| # headers. |
| include_dirs = [ target_gen_dir ] |
| } |
| |
| grit("strings") { |
| source = "chromium/address_input_strings.grd" |
| |
| outputs = [ |
| "messages.h", |
| "en_messages.cc", |
| ] |
| foreach(locale, locales_with_fake_bidi) { |
| outputs += [ "address_input_strings_$locale.pak" ] |
| } |
| |
| configs = [ ":internal_config" ] |
| } |
| |
| config("libaddressinput_config") { |
| defines = [ "I18N_ADDRESS_VALIDATION_DATA_URL=\"https://chromium-i18n.appspot.com/ssl-aggregate-address/\"" ] |
| include_dirs = [ "src/cpp/include" ] |
| } |
| |
| # This target provides basic functionality which is cooked into the build. |
| static_library("util") { |
| sources = [ |
| "chromium/addressinput_util.cc", |
| "chromium/json.cc", |
| "src/cpp/src/address_data.cc", |
| "src/cpp/src/address_field.cc", |
| "src/cpp/src/address_field_util.cc", |
| "src/cpp/src/address_formatter.cc", |
| "src/cpp/src/address_metadata.cc", |
| "src/cpp/src/address_ui.cc", |
| "src/cpp/src/format_element.cc", |
| "src/cpp/src/language.cc", |
| "src/cpp/src/localization.cc", |
| "src/cpp/src/lookup_key.cc", |
| "src/cpp/src/region_data_constants.cc", |
| "src/cpp/src/rule.cc", |
| "src/cpp/src/util/cctype_tolower_equal.cc", |
| "src/cpp/src/util/string_split.cc", |
| "src/cpp/src/util/string_util.cc", |
| ] |
| |
| configs -= [ "//build/config/compiler:chromium_code" ] |
| configs += [ |
| ":internal_config", |
| "//build/config/compiler:no_chromium_code", |
| ] |
| |
| public_configs = [ ":libaddressinput_config" ] |
| |
| include_dirs = [ "$root_gen_dir/third_party/libaddressinput" ] |
| |
| deps = [ |
| ":strings", |
| "//base", |
| "//base:i18n", |
| "//third_party/icu", |
| "//third_party/re2", |
| ] |
| } |
| |
| # This target provides more complicated functionality like pinging servers |
| # for validation rules. |
| static_library("libaddressinput") { |
| sources = [ |
| "chromium/chrome_address_validator.cc", |
| "chromium/chrome_address_validator.h", |
| "chromium/chrome_metadata_source.cc", |
| "chromium/chrome_metadata_source.h", |
| "chromium/chrome_storage_impl.cc", |
| "chromium/chrome_storage_impl.h", |
| "chromium/fallback_data_store.cc", |
| "chromium/fallback_data_store.h", |
| "chromium/input_suggester.cc", |
| "chromium/input_suggester.h", |
| "chromium/string_compare.cc", |
| "chromium/trie.cc", |
| "chromium/trie.h", |
| "src/cpp/src/address_input_helper.cc", |
| "src/cpp/src/address_normalizer.cc", |
| "src/cpp/src/address_problem.cc", |
| "src/cpp/src/address_validator.cc", |
| "src/cpp/src/null_storage.cc", |
| "src/cpp/src/ondemand_supplier.cc", |
| "src/cpp/src/ondemand_supply_task.cc", |
| "src/cpp/src/post_box_matchers.cc", |
| "src/cpp/src/preload_supplier.cc", |
| "src/cpp/src/region_data.cc", |
| "src/cpp/src/region_data_builder.cc", |
| "src/cpp/src/retriever.cc", |
| "src/cpp/src/rule_retriever.cc", |
| "src/cpp/src/util/md5.cc", |
| "src/cpp/src/validating_storage.cc", |
| "src/cpp/src/validating_util.cc", |
| "src/cpp/src/validation_task.cc", |
| ] |
| |
| configs -= [ "//build/config/compiler:chromium_code" ] |
| configs += [ |
| ":internal_config", |
| "//build/config/compiler:no_chromium_code", |
| ] |
| |
| public_configs = [ ":libaddressinput_config" ] |
| |
| deps = [ |
| ":strings", |
| ":util", |
| "//base", |
| "//base:i18n", |
| "//components/prefs", |
| "//net", |
| "//services/network/public/cpp", |
| "//third_party/icu", |
| "//third_party/re2", |
| ] |
| } |
| |
| if (is_ios) { |
| bundle_data("countryinfo_test_bundle_data") { |
| testonly = true |
| sources = [ |
| "//third_party/libaddressinput/src/testdata/countryinfo.txt", |
| ] |
| outputs = [ |
| "{{bundle_resources_dir}}/" + |
| "{{source_root_relative_dir}}/{{source_file_part}}", |
| ] |
| } |
| } |
| |
| # This target provides utilities for tests of libaddressinput. |
| source_set("test_support") { |
| testonly = true |
| sources = [ |
| "src/cpp/test/fake_storage.cc", |
| "src/cpp/test/mock_source.cc", |
| "src/cpp/test/testdata_source.cc", |
| ] |
| |
| configs -= [ "//build/config/compiler:chromium_code" ] |
| configs += [ |
| ":internal_config", |
| "//build/config/compiler:no_chromium_code", |
| ] |
| |
| defines = [ "TEST_DATA_DIR=\"src/third_party/libaddressinput/src/testdata\"" ] |
| |
| data = [ |
| "//third_party/libaddressinput/src/testdata/", |
| ] |
| |
| include_dirs = [ "src/cpp/src" ] |
| |
| deps = [ |
| ":libaddressinput", |
| ] |
| if (is_ios) { |
| deps += [ ":countryinfo_test_bundle_data" ] |
| } |
| } |
| |
| test("libaddressinput_unittests") { |
| sources = [ |
| "chromium/addressinput_util_unittest.cc", |
| "chromium/chrome_address_validator_unittest.cc", |
| "chromium/chrome_metadata_source_unittest.cc", |
| "chromium/chrome_storage_impl_unittest.cc", |
| "chromium/fallback_data_store_unittest.cc", |
| "chromium/storage_test_runner.cc", |
| "chromium/storage_test_runner.h", |
| "chromium/string_compare_unittest.cc", |
| "chromium/trie_unittest.cc", |
| "src/cpp/test/address_data_test.cc", |
| "src/cpp/test/address_field_test.cc", |
| "src/cpp/test/address_field_util_test.cc", |
| "src/cpp/test/address_formatter_test.cc", |
| "src/cpp/test/address_input_helper_test.cc", |
| "src/cpp/test/address_metadata_test.cc", |
| "src/cpp/test/address_normalizer_test.cc", |
| "src/cpp/test/address_problem_test.cc", |
| "src/cpp/test/address_ui_test.cc", |
| "src/cpp/test/address_validator_test.cc", |
| "src/cpp/test/fake_storage_test.cc", |
| "src/cpp/test/format_element_test.cc", |
| "src/cpp/test/language_test.cc", |
| "src/cpp/test/localization_test.cc", |
| "src/cpp/test/lookup_key_test.cc", |
| "src/cpp/test/null_storage_test.cc", |
| "src/cpp/test/ondemand_supply_task_test.cc", |
| "src/cpp/test/post_box_matchers_test.cc", |
| "src/cpp/test/preload_supplier_test.cc", |
| "src/cpp/test/region_data_builder_test.cc", |
| "src/cpp/test/region_data_constants_test.cc", |
| "src/cpp/test/region_data_test.cc", |
| "src/cpp/test/retriever_test.cc", |
| "src/cpp/test/rule_retriever_test.cc", |
| "src/cpp/test/rule_test.cc", |
| "src/cpp/test/supplier_test.cc", |
| "src/cpp/test/testdata_source_test.cc", |
| "src/cpp/test/util/json_test.cc", |
| "src/cpp/test/util/md5_unittest.cc", |
| "src/cpp/test/util/string_compare_test.cc", |
| "src/cpp/test/util/string_split_unittest.cc", |
| "src/cpp/test/util/string_util_test.cc", |
| "src/cpp/test/validating_storage_test.cc", |
| "src/cpp/test/validating_util_test.cc", |
| "src/cpp/test/validation_task_test.cc", |
| ] |
| |
| configs -= [ "//build/config/compiler:chromium_code" ] |
| configs += [ |
| ":internal_config", |
| "//build/config/compiler:no_chromium_code", |
| ] |
| |
| include_dirs = [ "src/cpp/src" ] |
| |
| deps = [ |
| ":libaddressinput", |
| ":strings", |
| ":test_support", |
| "//base/test:run_all_unittests", |
| "//components/prefs", |
| "//mojo/core/embedder", |
| "//net:test_support", |
| "//services/network:test_support", |
| "//testing/gtest", |
| ] |
| } |