blob: d83b2e664b57a68145dbffde14dd477414fe1251 [file] [log] [blame]
# Copyright 2021 The Cobalt Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
config("update_client_config") {
defines = [
"LIBXML_READER_ENABLED",
"LIBXML_WRITER_ENABLED",
]
}
static_library("update_client") {
sources = [
"action_runner.cc",
"action_runner.h",
"activity_data_service.h",
"cobalt_slot_management.cc",
"cobalt_slot_management.h",
"command_line_config_policy.cc",
"command_line_config_policy.h",
"component.cc",
"component.h",
"component_patcher.cc",
"component_patcher.h",
"component_patcher_operation.cc",
"component_patcher_operation.h",
"component_unpacker.cc",
"component_unpacker.h",
"configurator.h",
"crx_downloader.cc",
"crx_downloader.h",
"crx_update_item.h",
"network.cc",
"network.h",
"patcher.h",
"persisted_data.cc",
"persisted_data.h",
"ping_manager.cc",
"ping_manager.h",
"protocol_definition.cc",
"protocol_definition.h",
"protocol_handler.cc",
"protocol_handler.h",
"protocol_parser.cc",
"protocol_parser.h",
"protocol_parser_json.cc",
"protocol_parser_json.h",
"protocol_serializer.cc",
"protocol_serializer.h",
"protocol_serializer_json.cc",
"protocol_serializer_json.h",
"request_sender.cc",
"request_sender.h",
"task.h",
"task_send_uninstall_ping.cc",
"task_send_uninstall_ping.h",
"task_traits.h",
"task_update.cc",
"task_update.h",
"unzipper.h",
"update_checker.cc",
"update_checker.h",
"update_client.cc",
"update_client.h",
"update_client_errors.h",
"update_client_internal.h",
"update_engine.cc",
"update_engine.h",
"update_query_params.cc",
"update_query_params.h",
"update_query_params_delegate.cc",
"update_query_params_delegate.h",
"updater_state.cc",
"updater_state.h",
"url_fetcher_downloader.cc",
"url_fetcher_downloader.h",
"utils.cc",
"utils.h",
]
configs += [ ":update_client_config" ]
deps = [
"//components/client_update_protocol",
"//components/crx_file",
"//components/prefs",
"//crypto",
"//net",
"//starboard/loader_app:app_key_files",
"//starboard/loader_app:drain_file",
"//third_party/libxml",
"//url",
]
}
static_library("test_support") {
testonly = true
sources = [
"net/network_cobalt.h",
"net/network_impl_cobalt.cc",
"net/network_impl_cobalt.h",
"net/url_request_post_interceptor.cc",
"net/url_request_post_interceptor.h",
"patch/patch_impl_cobalt.cc",
"patch/patch_impl_cobalt.h",
"test_configurator.cc",
"test_configurator.h",
"unzip/unzip_impl_cobalt.cc",
"unzip/unzip_impl_cobalt.h",
]
deps = [
":update_client",
"//base",
"//cobalt/base",
"//cobalt/debug:console_command_manager",
"//cobalt/loader",
"//cobalt/network",
"//components/prefs",
"//net",
"//net:test_support",
"//testing/gmock",
"//testing/gtest",
"//third_party/zlib:zip",
"//url",
]
}
copy("update_client_test_files") {
sources = [
"//components/test/data/update_client/ChromeRecovery.crx3",
"//components/test/data/update_client/binary_bsdiff_patch.bin",
"//components/test/data/update_client/binary_courgette_patch.bin",
"//components/test/data/update_client/binary_input.bin",
"//components/test/data/update_client/binary_output.bin",
"//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc/ihfokbkgjpifnbbojhneepfflplebdkc.pem",
"//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc/ihfokbkgjpifnbbojhneepfflplebdkc_1/a_changing_binary_file",
"//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc/ihfokbkgjpifnbbojhneepfflplebdkc_1/a_changing_text_file",
"//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc/ihfokbkgjpifnbbojhneepfflplebdkc_1/a_static_text_file",
"//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc/ihfokbkgjpifnbbojhneepfflplebdkc_1/manifest.json",
"//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc/ihfokbkgjpifnbbojhneepfflplebdkc_1to2/commands.json",
"//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc/ihfokbkgjpifnbbojhneepfflplebdkc_1to2/f0",
"//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc/ihfokbkgjpifnbbojhneepfflplebdkc_1to2/f1",
"//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc/ihfokbkgjpifnbbojhneepfflplebdkc_1to2/f2",
"//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc/ihfokbkgjpifnbbojhneepfflplebdkc_1to2_bad/commands.json",
"//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc/ihfokbkgjpifnbbojhneepfflplebdkc_1to2_bad/f1",
"//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc/ihfokbkgjpifnbbojhneepfflplebdkc_1to2_bad/f2",
"//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc/ihfokbkgjpifnbbojhneepfflplebdkc_1to2_bad/f3",
"//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc/ihfokbkgjpifnbbojhneepfflplebdkc_2/a_changing_binary_file",
"//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc/ihfokbkgjpifnbbojhneepfflplebdkc_2/a_changing_text_file",
"//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc/ihfokbkgjpifnbbojhneepfflplebdkc_2/a_static_text_file",
"//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc/ihfokbkgjpifnbbojhneepfflplebdkc_2/manifest.json",
"//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc_1.crx",
"//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc_1to2.crx",
"//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc_1to2_bad.crx",
"//components/test/data/update_client/ihfokbkgjpifnbbojhneepfflplebdkc_2.crx",
"//components/test/data/update_client/jebgalgnebhfojomionfpkfelancnnkf.crx",
"//components/test/data/update_client/jebgalgnebhfojomionfpkfelancnnkf.pem",
"//components/test/data/update_client/jebgalgnebhfojomionfpkfelancnnkf/component1.dll",
"//components/test/data/update_client/jebgalgnebhfojomionfpkfelancnnkf/manifest.json",
"//components/test/data/update_client/runaction_test_win.crx3",
"//components/test/data/update_client/updatecheck_reply_1.json",
"//components/test/data/update_client/updatecheck_reply_4.json",
"//components/test/data/update_client/updatecheck_reply_noupdate.json",
"//components/test/data/update_client/updatecheck_reply_parse_error.json",
"//components/test/data/update_client/updatecheck_reply_unknownapp.json",
]
outputs = [ "$sb_static_contents_output_data_dir/test/{{source_root_relative_dir}}/{{source_file_part}}" ]
}
target(gtest_target_type, "update_client_test") {
testonly = true
sources = [
"component_unpacker_unittest.cc",
# TODO: enable the tests commented out
"crx_downloader_unittest.cc",
"persisted_data_unittest.cc",
"ping_manager_unittest.cc",
"protocol_parser_json_unittest.cc",
# "protocol_serializer_json_unittest.cc",
"protocol_serializer_unittest.cc",
"request_sender_unittest.cc",
"update_checker_unittest.cc",
# "update_client_unittest.cc",
"update_query_params_unittest.cc",
"updater_state_unittest.cc",
"utils_unittest.cc",
]
deps = [
":test_support",
":update_client",
":update_client_test_files",
"//cobalt/base",
"//cobalt/test:run_all_unittests",
"//cobalt/updater",
"//components/crx_file",
"//components/prefs",
"//components/prefs:test_support",
"//components/version_info",
"//crypto",
"//net",
"//net:test_support",
"//testing/gmock",
"//testing/gtest",
"//url",
]
}
target(gtest_target_type, "cobalt_slot_management_test") {
testonly = true
sources = [
"//starboard/common/test_main.cc",
"//starboard/loader_app/system_get_extension_shim.cc",
"cobalt_slot_management_test.cc",
]
deps = [
":update_client",
"//cobalt/base",
"//cobalt/updater",
"//components/crx_file",
"//components/prefs",
"//components/prefs:test_support",
"//crypto",
"//net:test_support",
"//starboard/loader_app:app_key_files",
"//starboard/loader_app:drain_file",
"//starboard/loader_app:installation_manager",
"//testing/gmock",
"//testing/gtest",
]
if (build_with_separate_cobalt_toolchain) {
data_deps = [ "//starboard/loader_app($starboard_toolchain)" ]
} else {
deps += [ "//starboard/loader_app" ]
}
}