| # 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") |
| |
| if (is_android) { |
| import("//build/config/android/rules.gni") |
| } |
| |
| static_library("variations") { |
| sources = [ |
| "active_field_trials.cc", |
| "active_field_trials.h", |
| "android/variations_associated_data_android.cc", |
| "android/variations_seed_bridge.cc", |
| "android/variations_seed_bridge.h", |
| "caching_permuted_entropy_provider.cc", |
| "caching_permuted_entropy_provider.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", |
| "experiment_labels.cc", |
| "experiment_labels.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", |
| "proto/client_variations.proto", |
| "proto/permuted_entropy_cache.proto", |
| "proto/study.proto", |
| "proto/variations_seed.proto", |
| "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_crash_keys.cc", |
| "variations_crash_keys.h", |
| "variations_experiment_util.cc", |
| "variations_experiment_util.h", |
| "variations_http_header_provider.cc", |
| "variations_http_header_provider.h", |
| "variations_id_collection.cc", |
| "variations_id_collection.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_starboard) { |
| sources -= [ |
| # These bring in JNI, which we do not want to bring into Cobalt. |
| "android/variations_associated_data_android.cc", |
| "android/variations_seed_bridge.cc", |
| "android/variations_seed_bridge.h", |
| # The ".proto" files were referenced here directly, but caused the build |
| # to fail. |
| "proto/client_variations.proto", |
| "proto/permuted_entropy_cache.proto", |
| "proto/study.proto", |
| "proto/variations_seed.proto", |
| ] |
| } |
| |
| if (use_cobalt_customizations) { |
| # Files with unused symbols. ex: base::FeatureList::RegisterFieldTrialOverride |
| # These files give linker errors about undefined symbols during modualr builds. |
| sources -= [ |
| "variations_seed_processor.cc", |
| "variations_seed_processor.h", |
| "variations_seed_simulator.cc", |
| "variations_seed_simulator.h", |
| ] |
| } |
| |
| if (!use_cobalt_customizations && (is_android || is_ios)) { |
| sources += [ |
| "variations_request_scheduler_mobile.cc", |
| "variations_request_scheduler_mobile.h", |
| ] |
| } |
| |
| deps = [ |
| "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 && !use_cobalt_customizations) { |
| deps += [ ":jni" ] |
| } |
| } |
| |
| if (is_android && !use_cobalt_customizations) { |
| generate_jni("jni") { |
| sources = [ |
| "android/java/src/org/chromium/components/variations/VariationsAssociatedData.java", |
| "android/java/src/org/chromium/components/variations/firstrun/VariationsSeedBridge.java", |
| ] |
| jni_package = "variations" |
| } |
| |
| android_library("load_seed_result_enum_java") { |
| deps = [ "//base:base_java" ] |
| srcjar_deps = [ ":load_seed_result_enum_srcjar" ] |
| } |
| |
| java_cpp_enum("load_seed_result_enum_srcjar") { |
| sources = [ "metrics.h" ] |
| } |
| } |
| |
| if (!use_cobalt_customizations) { |
| static_library("test_support") { |
| testonly = true |
| sources = [ |
| "variations_params_manager.cc", |
| "variations_params_manager.h", |
| ] |
| |
| public_deps = [ |
| ":variations", |
| ] |
| |
| deps = [ |
| "field_trial_config:field_trial_config", |
| "//base/test:test_support", |
| ] |
| } |
| |
| source_set("unit_tests") { |
| testonly = true |
| sources = [ |
| "active_field_trials_unittest.cc", |
| "caching_permuted_entropy_provider_unittest.cc", |
| "child_process_field_trial_syncer_unittest.cc", |
| "entropy_provider_unittest.cc", |
| "experiment_labels_unittest.cc", |
| "hashing_unittest.cc", |
| "net/variations_command_line_unittest.cc", |
| "net/variations_http_headers_unittest.cc", |
| "study_filtering_unittest.cc", |
| "synthetic_trial_registry_unittest.cc", |
| "variations_associated_data_unittest.cc", |
| "variations_crash_keys_unittest.cc", |
| "variations_http_header_provider_unittest.cc", |
| "variations_id_collection_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 = [ |
| ":variations", |
| "net", |
| "proto", |
| "//base/test:test_support", |
| "//components/crash/core/common:crash_key", |
| "//components/prefs:test_support", |
| "//components/variations/field_trial_config:field_trial_config", |
| "//testing/gmock", |
| "//testing/gtest", |
| "//third_party/zlib/google:compression_utils", |
| ] |
| } |
| |
| # 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", |
| ] |
| } |
| } |