blob: 7d29a5708cb5656566bf75367cff03a3ed8335ba [file] [log] [blame]
# 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.
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 {
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",
]
# At build-time, Android Chrome and WebView both use platform "android", but
# at run-time, variations has separate platforms "android" and
# "android_webview". So if building "android", also include WebView.
if (platform == "android") {
args += [ "--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: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",
"//testing/gtest",
]
}