#include "chrome/browser/ui/views/side_panel/read_anything/read_anything_coordinator.h"
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/memory/raw_ptr.h"
#include "chrome/browser/accessibility/embedded_a11y_extension_loader.h"
#include "chrome/browser/companion/core/features.h"
#include "chrome/browser/extensions/component_loader.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/browser/ui/browser_window/public/browser_window_features.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/test_with_browser_view.h"
#include "chrome/browser/ui/views/side_panel/read_anything/read_anything_side_panel_web_view.h"
#include "chrome/browser/ui/views/side_panel/side_panel_coordinator.h"
#include "chrome/browser/ui/views/side_panel/side_panel_entry.h"
#include "chrome/browser/ui/views/side_panel/side_panel_registry.h"
#include "chrome/browser/ui/webui/side_panel/read_anything/read_anything_untrusted_ui.h"
#include "chrome/common/extensions/extension_constants.h"
#include "content/public/test/scoped_web_ui_controller_factory_registration.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "ui/accessibility/accessibility_features.h"
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chrome/browser/lacros/embedded_a11y_manager_lacros.h"
#endif
_;
class MockReadAnythingCoordinatorObserver
: public ReadAnythingCoordinator::Observer { … };
class ReadAnythingCoordinatorTest : public TestWithBrowserView { … };
#if !BUILDFLAG(IS_MAC) || !defined(ADDRESS_SANITIZER)
TEST_F(ReadAnythingCoordinatorTest, ContainerViewsAreUnique) { … }
TEST_F(ReadAnythingCoordinatorTest,
ActivateCalled_ShowAndHideReadAnythingEntry) { … }
#if !BUILDFLAG(IS_CHROMEOS_LACROS)
TEST_F(ReadAnythingCoordinatorTest,
SidePanelShowAndHide_NonLacros_CallEmbeddedA11yExtensionLoader) { … }
#endif
#if BUILDFLAG(IS_CHROMEOS_LACROS)
TEST_F(
ReadAnythingCoordinatorTest,
SidePanelShowAndHide_Lacros_EmbeddedA11yManagerLacrosUpdateReadingModeState) {
SidePanelEntry* entry = contextual_registries_[0]->GetEntryForKey(
SidePanelEntry::Key(SidePanelEntry::Id::kReadAnything));
EXPECT_FALSE(
EmbeddedA11yManagerLacros::GetInstance()->IsReadingModeEnabled());
entry->OnEntryShown();
EXPECT_TRUE(EmbeddedA11yManagerLacros::GetInstance()->IsReadingModeEnabled());
entry->OnEntryHidden();
EXPECT_TRUE(EmbeddedA11yManagerLacros::GetInstance()->IsReadingModeEnabled());
task_environment()->FastForwardBy(base::Seconds(30));
EXPECT_FALSE(
EmbeddedA11yManagerLacros::GetInstance()->IsReadingModeEnabled());
}
#endif
TEST_F(ReadAnythingCoordinatorTest,
OnBrowserSetLastActive_SidePanelIsNotVisible) { … }
TEST_F(ReadAnythingCoordinatorTest, WithWebUIFlagEnabled_ShowsWebUIToolbar) { … }
class ReadAnythingCoordinatorScreen2xDataCollectionModeTest
: public TestWithBrowserView { … };
TEST_F(ReadAnythingCoordinatorScreen2xDataCollectionModeTest,
OnBrowserSetLastActive_SidePanelIsVisible) { … }
#endif