Misha Efimov | 1770a1b | 2018-01-11 15:27:27 | [diff] [blame] | 1 | # Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | import("//build/util/process_version.gni") |
| 6 | import("//build/util/version.gni") |
| 7 | import("//testing/test.gni") |
| 8 | |
| 9 | process_version("cronet_version_header") { |
| 10 | template_file = "//components/cronet/version.h.in" |
| 11 | sources = [ |
| 12 | "//chrome/VERSION", |
| 13 | ] |
| 14 | output = "$target_gen_dir/version.h" |
| 15 | extra_args = [ |
| 16 | "-e", |
| 17 | "VERSION_FULL=\"%s.%s.%s.%s\" % (MAJOR,MINOR,BUILD,PATCH)", |
| 18 | ] |
| 19 | } |
| 20 | |
| 21 | # Cronet common implementation. |
| 22 | source_set("cronet_common") { |
| 23 | sources = [ |
| 24 | "cronet_global_state.h", |
| 25 | "cronet_prefs_manager.cc", |
| 26 | "cronet_prefs_manager.h", |
Misha Efimov | c1731b0 | 2018-01-16 21:46:51 | [diff] [blame] | 27 | "cronet_url_request.cc", |
| 28 | "cronet_url_request.h", |
Misha Efimov | 1770a1b | 2018-01-11 15:27:27 | [diff] [blame] | 29 | "cronet_url_request_context.cc", |
| 30 | "cronet_url_request_context.h", |
| 31 | "histogram_manager.cc", |
| 32 | "histogram_manager.h", |
| 33 | "host_cache_persistence_manager.cc", |
| 34 | "host_cache_persistence_manager.h", |
| 35 | "stale_host_resolver.cc", |
| 36 | "stale_host_resolver.h", |
| 37 | "url_request_context_config.cc", |
| 38 | "url_request_context_config.h", |
| 39 | ] |
| 40 | deps = [ |
| 41 | ":cronet_version_header", |
| 42 | "//base", |
| 43 | "//components/metrics:metrics", |
| 44 | "//components/prefs:prefs", |
| 45 | "//net", |
| 46 | "//third_party/metrics_proto", |
| 47 | ] |
| 48 | } |
| 49 | |
| 50 | # Unit tests for Cronet common implementation. |
| 51 | source_set("cronet_common_unittests") { |
| 52 | testonly = true |
| 53 | |
| 54 | deps = [ |
| 55 | ":cronet_common", |
| 56 | "//components/prefs:test_support", |
| 57 | "//net:test_support", |
| 58 | ] |
| 59 | |
| 60 | sources = [ |
| 61 | "histogram_manager_unittest.cc", |
| 62 | "host_cache_persistence_manager_unittest.cc", |
| 63 | "run_all_unittests.cc", |
| 64 | "stale_host_resolver_unittest.cc", |
| 65 | "url_request_context_config_unittest.cc", |
| 66 | ] |
| 67 | } |
Wez | 115d431 | 2018-02-17 04:05:19 | [diff] [blame^] | 68 | |
| 69 | # For platforms on which the native Cronet library is used, build the library, |
| 70 | # a cronet_tests binary that exercises it, and a unit-tests binary. |
| 71 | # Android and iOS have their own platform-specific rules to build Cronet. |
| 72 | # TODO(https://crbug.com/812268): Fix Windows build, and enable it. |
| 73 | if (!is_ios && !is_android && !is_win) { |
| 74 | shared_library("cronet") { |
| 75 | deps = [ |
| 76 | "//base", |
| 77 | |
| 78 | # Explicitly add the exe_and_shlib_deps, otherwise the library will fail |
| 79 | # to link in component builds, due to missing libc++ symbols. |
| 80 | "//build/config:exe_and_shlib_deps", |
| 81 | "//components/cronet:cronet_common", |
| 82 | "//components/cronet/native:cronet_native_impl", |
| 83 | "//net", |
| 84 | ] |
| 85 | |
| 86 | sources = [ |
| 87 | "cronet_global_state_stubs.cc", |
| 88 | ] |
| 89 | } |
| 90 | |
| 91 | test("cronet_tests") { |
| 92 | testonly = true |
| 93 | |
| 94 | deps = [ |
| 95 | ":cronet", |
| 96 | "//components/cronet/native/test:cronet_native_tests", |
| 97 | "//testing/gtest:gtest_main", |
| 98 | ] |
| 99 | } |
| 100 | |
| 101 | test("cronet_unittests") { |
| 102 | testonly = true |
| 103 | |
| 104 | deps = [ |
| 105 | ":cronet_common", |
| 106 | ":cronet_common_unittests", |
| 107 | "//base", |
| 108 | "//components/cronet/native:cronet_native_unittests", |
| 109 | "//net", |
| 110 | ] |
| 111 | |
| 112 | sources = [ |
| 113 | "cronet_global_state_stubs.cc", |
| 114 | ] |
| 115 | } |
| 116 | } |