chromium/components/global_media_controls/BUILD.gn

# Copyright 2021 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/chromeos/ui_mode.gni")

component("global_media_controls") {
  public = [
    "public/constants.h",
    "public/media_dialog_delegate.h",
    "public/media_item_manager.h",
    "public/media_item_manager_observer.h",
    "public/media_item_producer.h",
    "public/media_item_ui.h",
    "public/media_item_ui_observer.h",
    "public/media_item_ui_observer_set.h",
    "public/media_session_item_producer.h",
    "public/media_session_item_producer_observer.h",
    "public/media_session_notification_item.h",
    "public/views/media_action_button.h",
    "public/views/media_item_ui_detailed_view.h",
    "public/views/media_item_ui_device_selector.h",
    "public/views/media_item_ui_footer.h",
    "public/views/media_item_ui_list_view.h",
    "public/views/media_item_ui_updated_view.h",
    "public/views/media_item_ui_view.h",
    "public/views/media_live_status_view.h",
    "public/views/media_progress_view.h",
  ]

  defines = [ "IS_GLOBAL_MEDIA_CONTROLS_IMPL" ]

  deps = [
    "//base",
    "//components/media_message_center/vector_icons",
    "//components/strings:components_strings_grit",
    "//components/vector_icons",
    "//media",
    "//skia",
    "//ui/accessibility:ax_base",
    "//ui/accessibility:ax_enums_mojo",
    "//ui/color",
    "//ui/message_center/public/cpp",
  ]

  if (is_chromeos) {
    deps += [ "//chromeos/constants:constants" ]
  }

  if (is_chromeos_ash) {
    public += [ "public/views/chapter_item_view.h" ]
  }

  public_deps = [
    "//components/media_message_center",
    "//services/media_session/public/cpp",
    "//services/media_session/public/mojom",
    "//ui/views",
  ]

  sources = [
    "media_item_manager_impl.cc",
    "media_item_manager_impl.h",
    "media_view_utils.cc",
    "media_view_utils.h",
    "public/media_item_ui_observer_set.cc",
    "public/media_session_item_producer.cc",
    "public/media_session_notification_item.cc",
    "public/views/media_action_button.cc",
    "public/views/media_item_ui_detailed_view.cc",
    "public/views/media_item_ui_device_selector.cc",
    "public/views/media_item_ui_footer.cc",
    "public/views/media_item_ui_list_view.cc",
    "public/views/media_item_ui_updated_view.cc",
    "public/views/media_item_ui_view.cc",
    "public/views/media_live_status_view.cc",
    "public/views/media_progress_view.cc",
  ]

  if (is_chromeos_ash) {
    sources += [ "public/views/chapter_item_view.cc" ]
  }

  friend = [ ":*" ]
}

source_set("unit_tests") {
  testonly = true

  sources = [
    "media_item_manager_impl_unittest.cc",
    "media_view_utils_unittest.cc",
    "public/media_session_item_producer_unittest.cc",
    "public/media_session_notification_item_unittest.cc",
    "public/views/media_action_button_unittest.cc",
    "public/views/media_item_ui_detailed_view_unittest.cc",
    "public/views/media_item_ui_list_view_unittest.cc",
    "public/views/media_item_ui_updated_view_unittest.cc",
    "public/views/media_item_ui_view_unittest.cc",
    "public/views/media_live_status_view_unittest.cc",
    "public/views/media_progress_view_unittest.cc",
  ]

  if (is_chromeos_ash) {
    sources += [ "public/views/chapter_item_view_unittest.cc" ]
  }

  deps = [
    ":global_media_controls",
    ":test_support",
    "//base/test:test_support",
    "//components/media_message_center:test_support",
    "//components/strings:components_strings_grit",
    "//media",
    "//services/media_session/public/cpp/test:test_support",
    "//skia",
    "//testing/gmock",
    "//testing/gtest",
    "//ui/display:test_support",
    "//ui/events:test_support",
    "//ui/gfx:test_support",
    "//ui/views:test_support",
  ]
}

static_library("test_support") {
  testonly = true

  sources = [
    "public/test/mock_device_service.cc",
    "public/test/mock_device_service.h",
    "public/test/mock_media_dialog_delegate.cc",
    "public/test/mock_media_dialog_delegate.h",
    "public/test/mock_media_item_manager.cc",
    "public/test/mock_media_item_manager.h",
    "public/test/mock_media_item_manager_observer.cc",
    "public/test/mock_media_item_manager_observer.h",
    "public/test/mock_media_item_producer.cc",
    "public/test/mock_media_item_producer.h",
    "public/test/mock_media_item_ui_device_selector.cc",
    "public/test/mock_media_item_ui_device_selector.h",
    "public/test/mock_media_item_ui_footer.cc",
    "public/test/mock_media_item_ui_footer.h",
    "public/test/mock_media_item_ui_observer.cc",
    "public/test/mock_media_item_ui_observer.h",
    "public/test/mock_media_session_notification_item_delegate.cc",
    "public/test/mock_media_session_notification_item_delegate.h",
  ]

  deps = [
    ":global_media_controls",
    "public/mojom:device_service",
    "//components/media_message_center:test_support",
    "//skia",
    "//testing/gmock",
  ]
}