BUILD.gn 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. # Copyright 2014 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. import("//build/buildflag_header.gni")
  5. import("//components/update_client/buildflags.gni")
  6. import("//net/features.gni")
  7. import("//testing/libfuzzer/fuzzer_test.gni")
  8. buildflag_header("buildflags") {
  9. header = "buildflags.h"
  10. flags = [ "ENABLE_PUFFIN_PATCHES=$enable_puffin_patches" ]
  11. }
  12. source_set("network_impl") {
  13. sources = [
  14. "net/network_chromium.h",
  15. "net/network_impl.cc",
  16. "net/network_impl.h",
  17. ]
  18. deps = [
  19. ":update_client",
  20. "//base",
  21. "//net",
  22. "//services/network/public/cpp:cpp",
  23. "//url",
  24. ]
  25. }
  26. source_set("in_process_unzipper") {
  27. sources = [
  28. "unzip/in_process_unzipper.cc",
  29. "unzip/in_process_unzipper.h",
  30. ]
  31. deps = [
  32. ":update_client",
  33. "//base",
  34. "//third_party/zlib/google:zip",
  35. ]
  36. }
  37. source_set("in_process_patcher") {
  38. sources = [
  39. "patch/in_process_patcher.cc",
  40. "patch/in_process_patcher.h",
  41. ]
  42. deps = [
  43. ":buildflags",
  44. ":update_client",
  45. "//base",
  46. "//courgette:bsdiff",
  47. "//courgette:courgette_lib",
  48. ]
  49. }
  50. source_set("unzip_impl") {
  51. sources = [
  52. "unzip/unzip_impl.cc",
  53. "unzip/unzip_impl.h",
  54. ]
  55. deps = [
  56. ":update_client",
  57. "//components/services/unzip/public/cpp",
  58. ]
  59. }
  60. source_set("patch_impl") {
  61. sources = [
  62. "patch/patch_impl.cc",
  63. "patch/patch_impl.h",
  64. ]
  65. deps = [
  66. ":buildflags",
  67. ":update_client",
  68. "//build:chromeos_buildflags",
  69. "//components/services/patch/public/cpp",
  70. "//components/services/patch/public/mojom",
  71. "//mojo/public/cpp/bindings",
  72. ]
  73. }
  74. group("common_impl") {
  75. public_deps = [
  76. ":network_impl",
  77. ":patch_impl",
  78. ":unzip_impl",
  79. ]
  80. }
  81. static_library("update_client") {
  82. sources = [
  83. "action_runner.cc",
  84. "action_runner.h",
  85. "activity_data_service.h",
  86. "command_line_config_policy.cc",
  87. "command_line_config_policy.h",
  88. "component.cc",
  89. "component.h",
  90. "component_patcher.cc",
  91. "component_patcher.h",
  92. "component_patcher_operation.cc",
  93. "component_patcher_operation.h",
  94. "component_unpacker.cc",
  95. "component_unpacker.h",
  96. "configurator.h",
  97. "crx_downloader.cc",
  98. "crx_downloader.h",
  99. "crx_downloader_factory.cc",
  100. "crx_downloader_factory.h",
  101. "crx_update_item.h",
  102. "network.cc",
  103. "network.h",
  104. "patcher.h",
  105. "persisted_data.cc",
  106. "persisted_data.h",
  107. "ping_manager.cc",
  108. "ping_manager.h",
  109. "protocol_definition.cc",
  110. "protocol_definition.h",
  111. "protocol_handler.cc",
  112. "protocol_handler.h",
  113. "protocol_parser.cc",
  114. "protocol_parser.h",
  115. "protocol_parser_json.cc",
  116. "protocol_parser_json.h",
  117. "protocol_serializer.cc",
  118. "protocol_serializer.h",
  119. "protocol_serializer_json.cc",
  120. "protocol_serializer_json.h",
  121. "request_sender.cc",
  122. "request_sender.h",
  123. "task.h",
  124. "task_send_uninstall_ping.cc",
  125. "task_send_uninstall_ping.h",
  126. "task_traits.h",
  127. "task_update.cc",
  128. "task_update.h",
  129. "unzipper.h",
  130. "update_checker.cc",
  131. "update_checker.h",
  132. "update_client.cc",
  133. "update_client.h",
  134. "update_client_errors.h",
  135. "update_client_internal.h",
  136. "update_engine.cc",
  137. "update_engine.h",
  138. "update_query_params.cc",
  139. "update_query_params.h",
  140. "update_query_params_delegate.cc",
  141. "update_query_params_delegate.h",
  142. "url_fetcher_downloader.cc",
  143. "url_fetcher_downloader.h",
  144. "utils.cc",
  145. "utils.h",
  146. ]
  147. deps = [
  148. "//base",
  149. "//build:branding_buildflags",
  150. "//build:chromeos_buildflags",
  151. "//components/client_update_protocol",
  152. "//components/crx_file",
  153. "//components/prefs",
  154. "//components/version_info:version_info",
  155. "//courgette:courgette_lib",
  156. "//crypto",
  157. "//url",
  158. ]
  159. if (is_win) {
  160. sources += [
  161. "background_downloader_win.cc",
  162. "background_downloader_win.h",
  163. ]
  164. }
  165. # TODO(crbug.com/1349060) once Puffin patches are fully implemented,
  166. # we should remove the enable_puffin_patches flag.
  167. if (enable_puffin_patches) {
  168. include_dirs = [ "//third_party/puffin/src/include" ]
  169. sources += [
  170. "puffin_component_unpacker.cc",
  171. "puffin_component_unpacker.h",
  172. "puffin_patcher.cc",
  173. "puffin_patcher.h",
  174. ]
  175. }
  176. }
  177. static_library("test_support") {
  178. testonly = true
  179. sources = [
  180. "net/url_loader_post_interceptor.cc",
  181. "net/url_loader_post_interceptor.h",
  182. "test_activity_data_service.cc",
  183. "test_activity_data_service.h",
  184. "test_configurator.cc",
  185. "test_configurator.h",
  186. "test_installer.cc",
  187. "test_installer.h",
  188. ]
  189. public_deps = [ ":update_client" ]
  190. deps = [
  191. ":network_impl",
  192. ":patch_impl",
  193. ":unzip_impl",
  194. "//base",
  195. "//components/prefs",
  196. "//components/services/patch:in_process",
  197. "//components/services/unzip:in_process",
  198. "//mojo/public/cpp/bindings",
  199. "//net:test_support",
  200. "//services/network:test_support",
  201. "//testing/gmock",
  202. "//testing/gtest",
  203. "//url",
  204. ]
  205. }
  206. bundle_data("unit_tests_bundle_data") {
  207. visibility = [ ":unit_tests" ]
  208. testonly = true
  209. sources = [
  210. "//components/test/data/update_client/binary_bsdiff_patch.bin",
  211. "//components/test/data/update_client/binary_courgette_patch.bin",
  212. "//components/test/data/update_client/binary_input.bin",
  213. "//components/test/data/update_client/binary_output.bin",
  214. "//components/test/data/update_client/empty_file",
  215. "//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc_1.crx",
  216. "//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc_1to2.crx",
  217. "//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc_2.crx",
  218. "//components/test/data/update_client/jebgalgnebhfojomionfpkfelancnnkf.crx",
  219. "//components/test/data/update_client/runaction_test_win.crx3",
  220. "//components/test/data/update_client/updatecheck_reply_1.json",
  221. "//components/test/data/update_client/updatecheck_reply_4.json",
  222. "//components/test/data/update_client/updatecheck_reply_noupdate.json",
  223. "//components/test/data/update_client/updatecheck_reply_parse_error.json",
  224. "//components/test/data/update_client/updatecheck_reply_unknownapp.json",
  225. ]
  226. outputs = [ "{{bundle_resources_dir}}/" +
  227. "{{source_root_relative_dir}}/{{source_file_part}}" ]
  228. }
  229. bundle_data("recovery_component_tests_bundle_data") {
  230. visibility = [ "//chrome/test:unit_tests" ]
  231. testonly = true
  232. sources = [ "//components/test/data/update_client/ChromeRecovery.crx3" ]
  233. outputs = [ "{{bundle_resources_dir}}/" +
  234. "{{source_root_relative_dir}}/{{source_file_part}}" ]
  235. }
  236. source_set("unit_tests") {
  237. testonly = true
  238. sources = [
  239. "component_patcher_unittest.cc",
  240. "component_patcher_unittest.h",
  241. "component_unpacker_unittest.cc",
  242. "persisted_data_unittest.cc",
  243. "ping_manager_unittest.cc",
  244. "protocol_parser_json_unittest.cc",
  245. "protocol_serializer_json_unittest.cc",
  246. "protocol_serializer_unittest.cc",
  247. "request_sender_unittest.cc",
  248. "update_checker_unittest.cc",
  249. "update_client_unittest.cc",
  250. "update_query_params_unittest.cc",
  251. "utils_unittest.cc",
  252. ]
  253. if (!disable_file_support) {
  254. sources += [ "crx_downloader_unittest.cc" ]
  255. }
  256. deps = [
  257. ":network_impl",
  258. ":patch_impl",
  259. ":test_support",
  260. ":unit_tests_bundle_data",
  261. ":unzip_impl",
  262. ":update_client",
  263. "//base",
  264. "//build:branding_buildflags",
  265. "//components/crx_file",
  266. "//components/prefs",
  267. "//components/prefs:test_support",
  268. "//components/services/patch:in_process",
  269. "//components/version_info:version_info",
  270. "//courgette:courgette_lib",
  271. "//net:test_support",
  272. "//services/network:test_support",
  273. "//services/network/public/cpp:cpp",
  274. "//services/network/public/cpp:cpp_base",
  275. "//testing/gmock",
  276. "//testing/gtest",
  277. "//third_party/re2",
  278. ]
  279. # TODO(crbug.com/1349060) once Puffin patches are fully implemented,
  280. # we should remove the enable_puffin_patches flag.
  281. if (enable_puffin_patches) {
  282. sources += [
  283. "puffin_component_unpacker_unittest.cc",
  284. "puffin_patcher_unittest.cc",
  285. ]
  286. deps += [ "//third_party/puffin:libpuffpatch" ]
  287. data_deps = [ "//components/test/data/update_client/puffin_patch_test:puffin_patch_test_files" ]
  288. }
  289. }
  290. fuzzer_test("update_client_protocol_serializer_fuzzer") {
  291. sources = [ "protocol_serializer_fuzzer.cc" ]
  292. deps = [
  293. ":update_client",
  294. "//base:base",
  295. ]
  296. seed_corpus = "fuzzer_corpuses/protocol_serializer/"
  297. }
  298. fuzzer_test("update_client_protocol_parser_fuzzer") {
  299. sources = [ "protocol_parser_fuzzer.cc" ]
  300. deps = [
  301. ":update_client",
  302. "//base:base",
  303. ]
  304. seed_corpus = "fuzzer_corpuses/protocol_parser/"
  305. }