12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- # Copyright 2015 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/config/chromeos/ui_mode.gni")
- declare_args() {
- invert_fieldtrials = false
- }
- action("field_trial_testing_config_action") {
- visibility = [ ":field_trial_config" ]
- script = "//tools/variations/fieldtrial_to_struct.py"
- source = "//testing/variations/fieldtrial_testing_config.json"
- inputs = [
- "//tools/json_to_struct/element_generator.py",
- "//tools/json_to_struct/json_to_struct.py",
- "//tools/json_to_struct/struct_generator.py",
- source,
- ]
- out_name = "fieldtrial_testing_config"
- outputs = [
- "$target_gen_dir/$out_name.cc",
- "$target_gen_dir/$out_name.h",
- ]
- if (current_os == "win") {
- platform = "windows"
- } else if (is_chromeos_lacros) {
- platform = "chromeos_lacros"
- } else {
- platform = current_os
- }
- args = [
- rebase_path(source, root_build_dir),
- "--destbase=" + rebase_path(target_gen_dir, root_build_dir),
- "--namespace=variations",
- "--schema=" +
- rebase_path("field_trial_testing_config_schema.json", root_build_dir),
- "--platform=" + platform,
- "--output=$out_name",
- ]
- if (invert_fieldtrials) {
- args += [ "--invert_fieldtrials" ]
- }
- # At build-time, Android Chrome and WebView/WebLayer use the platform
- # "android", but at run-time, variations has separate platforms "android",
- # "android_webview" and "android_weblayer". So if building "android", also
- # include WebView/WebLayer.
- if (platform == "android") {
- args += [
- "--platform=android_weblayer",
- "--platform=android_webview",
- ]
- }
- }
- static_library("field_trial_config") {
- sources = [
- "field_trial_util.cc",
- "field_trial_util.h",
- ]
- sources += get_target_outputs(":field_trial_testing_config_action")
- deps = [
- ":field_trial_testing_config_action",
- "//base",
- "//components/variations",
- "//components/variations/proto",
- "//net",
- ]
- public_deps = [ "//third_party/protobuf:protobuf_lite" ]
- }
- source_set("unit_tests") {
- testonly = true
- sources = [ "field_trial_util_unittest.cc" ]
- deps = [
- ":field_trial_config",
- "//base",
- "//base/test:test_support",
- "//components/variations",
- "//components/variations/service",
- "//components/version_info",
- "//services/network/public/cpp",
- "//testing/gtest",
- ]
- }
|