# 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("//build/buildflag_header.gni") import("//build/config/chromecast_build.gni") import("//mojo/public/tools/bindings/mojom.gni") import("//testing/test.gni") mojom("variations_mojom") { sources = [ "variations.mojom" ] } if (is_android) { import("//build/config/android/rules.gni") } large_variation_key_size_enabled = is_chromecast buildflag_header("buildflags") { header = "buildflags.h" flags = [ "LARGE_VARIATION_KEY_SIZE=$large_variation_key_size_enabled" ] } component("variations_features") { output_name = "variations_features" defines = [ "IS_VARIATIONS_FEATURES_IMPL" ] sources = [ "variations_features.cc", "variations_features.h", ] deps = [ "//base" ] } static_library("variations") { sources = [ "active_field_trials.cc", "active_field_trials.h", "child_process_field_trial_syncer.cc", "child_process_field_trial_syncer.h", "client_filterable_state.cc", "client_filterable_state.h", "entropy_provider.cc", "entropy_provider.h", "hashing.cc", "hashing.h", "metrics.cc", "metrics.h", "platform_field_trials.h", "pref_names.cc", "pref_names.h", "processed_study.cc", "processed_study.h", "seed_response.cc", "seed_response.h", "study_filtering.cc", "study_filtering.h", "synthetic_trial_registry.cc", "synthetic_trial_registry.h", "synthetic_trials.cc", "synthetic_trials.h", "synthetic_trials_active_group_id_provider.cc", "synthetic_trials_active_group_id_provider.h", "variations_associated_data.cc", "variations_associated_data.h", "variations_client.h", "variations_crash_keys.cc", "variations_crash_keys.h", "variations_id_collection.cc", "variations_id_collection.h", "variations_ids_provider.cc", "variations_ids_provider.h", "variations_murmur_hash.cc", "variations_murmur_hash.h", "variations_request_scheduler.cc", "variations_request_scheduler.h", "variations_seed_processor.cc", "variations_seed_processor.h", "variations_seed_simulator.cc", "variations_seed_simulator.h", "variations_seed_store.cc", "variations_seed_store.h", "variations_switches.cc", "variations_switches.h", "variations_url_constants.cc", "variations_url_constants.h", ] if (is_android || is_ios) { sources += [ "variations_request_scheduler_mobile.cc", "variations_request_scheduler_mobile.h", ] } if (is_android) { sources += [ "android/variations_associated_data_android.cc", "android/variations_seed_bridge.cc", "android/variations_seed_bridge.h", ] } public_deps = [ ":variations_features" ] deps = [ ":buildflags", ":variations_mojom", "proto", "//base", "//components/crash/core/common:crash_key", "//components/prefs", "//crypto", "//third_party/protobuf:protobuf_lite", "//third_party/zlib/google:compression_utils", ] if (is_android) { deps += [ ":jni" ] } } if (is_android) { generate_jni("jni") { sources = [ "android/java/src/org/chromium/components/variations/VariationsAssociatedData.java", "android/java/src/org/chromium/components/variations/firstrun/VariationsSeedBridge.java", ] } android_library("load_seed_result_enum_java") { deps = [ "//base:base_java", "//third_party/android_deps:androidx_annotation_annotation_java", ] srcjar_deps = [ ":load_seed_result_enum_srcjar" ] } java_cpp_enum("load_seed_result_enum_srcjar") { sources = [ "metrics.h" ] } } static_library("test_support") { testonly = true sources = [ "variations_params_manager.cc", "variations_params_manager.h", "variations_test_utils.cc", "variations_test_utils.h", ] public_deps = [ ":variations", ":variations_mojom", ] deps = [ "field_trial_config:field_trial_config", "proto", "//base/test:test_support", ] } source_set("unit_tests") { testonly = true sources = [ "active_field_trials_unittest.cc", "child_process_field_trial_syncer_unittest.cc", "client_filterable_state_unittest.cc", "entropy_provider_unittest.cc", "hashing_unittest.cc", "net/variations_command_line_unittest.cc", "net/variations_http_headers_unittest.cc", "simulate_for_crosstalk_unittest.cc", "study_filtering_unittest.cc", "synthetic_trial_registry_unittest.cc", "variations_associated_data_unittest.cc", "variations_crash_keys_unittest.cc", "variations_id_collection_unittest.cc", "variations_ids_provider_unittest.cc", "variations_murmur_hash_unittest.cc", "variations_request_scheduler_unittest.cc", "variations_seed_processor_unittest.cc", "variations_seed_simulator_unittest.cc", "variations_seed_store_unittest.cc", ] if (is_android || is_ios) { sources += [ "variations_request_scheduler_mobile_unittest.cc" ] } deps = [ ":test_support", ":variations", ":variations_features", ":variations_mojom", "net", "proto", "//base/test:test_support", "//components/crash/core/common:crash_key", "//components/prefs:test_support", "//components/variations/field_trial_config:field_trial_config", "//services/network/public/cpp:cpp_base", "//testing/gmock", "//testing/gtest", "//third_party/smhasher:murmurhash3", "//third_party/zlib/google:compression_utils", "//url", ] } # Convenience testing target test("variations_unittests") { sources = [ "//components/test/run_all_unittests.cc" ] deps = [ ":unit_tests", "//components/test:test_support", "//components/variations/field_trial_config:unit_tests", "//components/variations/service:unit_tests", ] }