#include "chrome/browser/ui/views/media_preview/media_view_controller_base.h"
#include <memory>
#include <optional>
#include <string>
#include "base/test/metrics/histogram_tester.h"
#include "base/test/mock_callback.h"
#include "chrome/browser/ui/views/media_preview/media_preview_metrics.h"
#include "chrome/browser/ui/views/media_preview/media_view.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/test/views/chrome_views_test_base.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/simple_combobox_model.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/controls/combobox/combobox.h"
#include "ui/views/controls/label.h"
#include "ui/views/test/combobox_test_api.h"
#include "ui/views/widget/unique_widget_ptr.h"
_;
Eq;
UserAction;
namespace {
constexpr char16_t kNoDeviceComboboxText[] = …;
constexpr char16_t kNoDeviceLabelText[] = …;
constexpr char16_t kComboboxAccessibleName[] = …;
std::u16string GetDeviceName(size_t index) { … }
media_preview_metrics::Context GetMetricsContext() { … }
#if !BUILDFLAG(IS_MAC)
std::optional<std::u16string> GetAnnouncementFromRootView(
views::View* root_view) { … }
#endif
}
class MediaViewControllerBaseTestParameterized
: public ChromeViewsTestBase,
public ui::ComboboxModelObserver,
public testing::WithParamInterface<bool> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(MediaViewControllerBaseTestParameterized,
OnDeviceListChanged_NoDevices) { … }
TEST_P(MediaViewControllerBaseTestParameterized,
OnDeviceListChanged_OneDevice) { … }
TEST_P(MediaViewControllerBaseTestParameterized,
OnDeviceListChanged_MultipleDevices) { … }
#if !BUILDFLAG(IS_MAC)
TEST_P(MediaViewControllerBaseTestParameterized,
OnDeviceListChanged_Announcement) { … }
#endif
TEST_P(MediaViewControllerBaseTestParameterized, ActionHistogram_NoAction) { … }
TEST_P(MediaViewControllerBaseTestParameterized, ActionHistogram_Opened) { … }
TEST_P(MediaViewControllerBaseTestParameterized, ActionHistogram_Selection) { … }