#include "chrome/browser/ui/views/global_media_controls/media_item_ui_device_selector_view.h"
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/callback_list.h"
#include "base/ranges/algorithm.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
#include "chrome/browser/ui/global_media_controls/media_item_ui_device_selector_delegate.h"
#include "chrome/browser/ui/global_media_controls/media_notification_device_provider.h"
#include "chrome/browser/ui/global_media_controls/media_notification_service.h"
#include "chrome/browser/ui/media_router/cast_dialog_model.h"
#include "chrome/browser/ui/media_router/media_route_starter.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/test/views/chrome_views_test_base.h"
#include "components/global_media_controls/public/test/mock_device_service.h"
#include "components/media_router/browser/presentation/start_presentation_context.h"
#include "media/audio/audio_device_description.h"
#include "media/base/media_switches.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/events/base_event_utils.h"
#include "ui/gfx/color_palette.h"
#include "ui/views/test/button_test_api.h"
MockDeviceListHost;
CastDialogController;
CastDialogModel;
UIMediaSink;
UIMediaSinkState;
_;
NiceMock;
namespace {
constexpr char kItemId[] = …;
constexpr char kSinkFriendlyName[] = …;
ui::MouseEvent pressed_event(ui::EventType::kMousePressed,
gfx::Point(),
gfx::Point(),
ui::EventTimeForNow(),
ui::EF_LEFT_MOUSE_BUTTON,
ui::EF_LEFT_MOUSE_BUTTON);
global_media_controls::mojom::DevicePtr CreateDevice() { … }
std::vector<global_media_controls::mojom::DevicePtr> CreateDevices() { … }
class MockMediaNotificationDeviceProvider
: public MediaNotificationDeviceProvider { … };
class MockMediaItemUIDeviceSelectorDelegate
: public MediaItemUIDeviceSelectorDelegate { … };
class MockCastDialogController : public CastDialogController { … };
}
class MediaItemUIDeviceSelectorViewTest : public ChromeViewsTestBase { … };
TEST_F(MediaItemUIDeviceSelectorViewTest, DeviceButtonsCreated) { … }
TEST_F(MediaItemUIDeviceSelectorViewTest, ExpandButtonAndLabelCreated) { … }
TEST_F(MediaItemUIDeviceSelectorViewTest, ExpandButtonOpensEntryContainer) { … }
TEST_F(MediaItemUIDeviceSelectorViewTest, ExpandLabelOpensEntryContainer) { … }
TEST_F(MediaItemUIDeviceSelectorViewTest, DeviceEntryContainerVisibility) { … }
TEST_F(MediaItemUIDeviceSelectorViewTest,
AudioDeviceButtonClickNotifiesContainer) { … }
TEST_F(MediaItemUIDeviceSelectorViewTest,
StartCastingTriggersAnotherSinkUpdate) { … }
TEST_F(MediaItemUIDeviceSelectorViewTest, CurrentAudioDeviceHighlighted) { … }
TEST_F(MediaItemUIDeviceSelectorViewTest, AudioDeviceHighlightedOnChange) { … }
TEST_F(MediaItemUIDeviceSelectorViewTest, AudioDeviceButtonsChange) { … }
TEST_F(MediaItemUIDeviceSelectorViewTest, VisibilityChanges) { … }
TEST_F(MediaItemUIDeviceSelectorViewTest, AudioDeviceChangeIsNotSupported) { … }
TEST_F(MediaItemUIDeviceSelectorViewTest, AudioDevicesCountHistogramRecorded) { … }
TEST_F(MediaItemUIDeviceSelectorViewTest,
DeviceSelectorAvailableHistogramRecorded) { … }
TEST_F(MediaItemUIDeviceSelectorViewTest,
DeviceSelectorOpenedHistogramRecorded) { … }