# Copyright 2014 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/buildflag_header.gni") import("//media/media_options.gni") import("//testing/test.gni") buildflag_header("features") { header = "features.h" enable_mojo_renderer = false enable_mojo_cdm = false enable_mojo_audio_decoder = false enable_mojo_video_decoder = false enable_mojo_media_in_browser_process = false enable_mojo_media_in_gpu_process = false enable_mojo_media_in_utility_process = false if (!enable_mojo_media) { assert(mojo_media_services == [], "Mojo media is not enabled") assert(mojo_media_host == "none", "Mojo media is not enabled") assert(!enable_test_mojo_media_client, "Mojo media is not enabled") } else { assert(mojo_media_services != [], "No mojo media service specified") foreach(service, mojo_media_services) { if (service == "renderer") { enable_mojo_renderer = true } else if (service == "cdm") { enable_mojo_cdm = true } else if (service == "audio_decoder") { enable_mojo_audio_decoder = true } else if (service == "video_decoder") { enable_mojo_video_decoder = true } else { assert(false, "Invalid mojo media service: $service") } } assert( enable_mojo_renderer || !enable_runtime_media_renderer_selection, "The mojo renderer must be enabled to use runtime media renderer selection.") if (mojo_media_host == "browser") { enable_mojo_media_in_browser_process = true } else if (mojo_media_host == "gpu") { enable_mojo_media_in_gpu_process = true } else if (mojo_media_host == "utility") { enable_mojo_media_in_utility_process = true } else if (!enable_standalone_cdm_service) { assert(false, "Invalid mojo media host: $mojo_media_host") } } if (enable_standalone_cdm_service) { assert(enable_mojo_cdm, "Mojo CDM must be enabled to run in standalone CDM service.") } flags = [ "ENABLE_MOJO_MEDIA=$enable_mojo_media", "ENABLE_TEST_MOJO_MEDIA_CLIENT=$enable_test_mojo_media_client", "ENABLE_MOJO_RENDERER=$enable_mojo_renderer", "ENABLE_MOJO_CDM=$enable_mojo_cdm", "ENABLE_MOJO_AUDIO_DECODER=$enable_mojo_audio_decoder", "ENABLE_MOJO_VIDEO_DECODER=$enable_mojo_video_decoder", "ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS=$enable_mojo_media_in_browser_process", "ENABLE_MOJO_MEDIA_IN_GPU_PROCESS=$enable_mojo_media_in_gpu_process", "ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS=$enable_mojo_media_in_utility_process", "ENABLE_STANDALONE_CDM_SERVICE=$enable_standalone_cdm_service", ] } source_set("unit_tests") { testonly = true sources = [ "clients/mojo_audio_decoder_unittest.cc", "clients/mojo_cdm_unittest.cc", "clients/mojo_decryptor_unittest.cc", "clients/mojo_renderer_unittest.cc", "clients/mojo_video_encode_accelerator_unittest.cc", "common/media_type_converters_unittest.cc", "common/mojo_decoder_buffer_converter_unittest.cc", "common/mojo_shared_buffer_video_frame_unittest.cc", "interfaces/audio_decoder_config_struct_traits_unittest.cc", "interfaces/encryption_scheme_struct_traits_unittest.cc", "interfaces/video_decoder_config_struct_traits_unittest.cc", "interfaces/video_frame_struct_traits_unittest.cc", "mojo_video_encode_accelerator_integration_test.cc", "services/mojo_audio_output_stream_unittest.cc", "services/video_decode_perf_history_unittest.cc", "services/video_decode_stats_db_unittest.cc", "services/watch_time_recorder_unittest.cc", ] if (is_android) { sources += [ "clients/mojo_android_overlay_unittest.cc" ] } deps = [ "//base", "//base/test:test_support", "//components/leveldb_proto:test_support", "//components/ukm:test_support", "//media:test_support", "//media/mojo/clients", "//media/mojo/common", "//media/mojo/common:mojo_shared_buffer_video_frame", "//media/mojo/interfaces", "//media/mojo/interfaces:test_interfaces", "//media/mojo/services", "//media/mojo/services:video_decode_stats_proto", "//services/metrics/public/cpp:ukm_builders", "//services/service_manager/tests:interfaces", "//testing/gmock", "//testing/gtest", "//ui/gfx:test_support", ] if (is_android) { deps += [ "//gpu/ipc/common:common", "//ui/gl:gl", ] } if (enable_library_cdms) { sources += [ "services/mojo_cdm_allocator_unittest.cc" ] deps += [ "//media/cdm:cdm_api" ] } } test("media_mojo_unittests") { deps = [ ":unit_tests", "//mojo/edk/test:run_all_unittests", ] }