#include "chrome/browser/ui/tabs/recent_tabs_sub_menu_model.h"
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/command_line.h"
#include "base/containers/span.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind.h"
#include "build/build_config.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/sessions/chrome_tab_restore_service_client.h"
#include "chrome/browser/sessions/exit_type_service.h"
#include "chrome/browser/sessions/session_service.h"
#include "chrome/browser/sessions/session_service_factory.h"
#include "chrome/browser/sessions/tab_restore_service_factory.h"
#include "chrome/browser/sync/session_sync_service_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/tabs/recent_tabs_builder_test_helper.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/toolbar/app_menu_icon_controller.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/browser_with_test_window_test.h"
#include "chrome/test/base/menu_model_test.h"
#include "components/sessions/content/content_test_helper.h"
#include "components/sessions/core/serialized_navigation_entry_test_helper.h"
#include "components/sessions/core/session_types.h"
#include "components/sessions/core/tab_restore_service_impl.h"
#include "components/sync/engine/data_type_activation_response.h"
#include "components/sync/model/data_type_activation_request.h"
#include "components/sync/model/data_type_controller_delegate.h"
#include "components/sync/service/data_type_controller.h"
#include "components/sync/test/mock_commit_queue.h"
#include "components/sync_sessions/session_sync_service_impl.h"
#include "components/sync_sessions/synced_session.h"
#include "components/tab_groups/tab_group_id.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/test/test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
ElementsAre;
namespace {
class TestRecentTabsMenuModelDelegate : public ui::MenuModelDelegate { … };
struct ModelData { … };
void VerifyModel(const ui::MenuModel& model, base::span<const ModelData> data) { … }
void VerifyModel(const ui::MenuModel* model, base::span<const ModelData> data) { … }
}
class RecentTabsSubMenuModelTest : public BrowserWithTestWindowTest { … };
class TestLogMetricsAppMenuModel : public AppMenuModel { … };
class FakeIconDelegate : public AppMenuIconController::Delegate { … };
TEST_F(RecentTabsSubMenuModelTest, LogMenuMetricsForShowHistory) { … }
TEST_F(RecentTabsSubMenuModelTest, LogMenuMetricsForShowGroupedHistory) { … }
TEST_F(RecentTabsSubMenuModelTest,
LogMenuMetricsForRecentTabsLoginForDeviceTabs) { … }
TEST_F(RecentTabsSubMenuModelTest, NoTabs) { … }
TEST_F(RecentTabsSubMenuModelTest, RecentlyClosedTabsFromCurrentSession) { … }
TEST_F(RecentTabsSubMenuModelTest, RecentlyClosedGroupsFromCurrentSession) { … }
TEST_F(RecentTabsSubMenuModelTest,
RecentlyClosedTabsAndWindowsFromLastSessionWithRefresh) { … }
TEST_F(RecentTabsSubMenuModelTest, OtherDevices) { … }
TEST_F(RecentTabsSubMenuModelTest, OtherDevicesDynamicUpdate) { … }
TEST_F(RecentTabsSubMenuModelTest, MaxSessionsAndRecency) { … }
TEST_F(RecentTabsSubMenuModelTest, MaxTabsPerSessionAndRecency) { … }