#include "chrome/browser/ui/tabs/recent_tabs_builder_test_helper.h"
#include <stddef.h>
#include <algorithm>
#include <string>
#include "base/memory/raw_ptr.h"
#include "base/rand_util.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "components/sync/base/client_tag_hash.h"
#include "components/sync/engine/commit_and_get_updates_types.h"
#include "components/sync/engine/data_type_processor.h"
#include "components/sync/protocol/data_type_state.pb.h"
#include "components/sync/protocol/entity_data.h"
#include "components/sync/protocol/session_specifics.pb.h"
#include "components/sync/protocol/sync_enums.pb.h"
#include "components/sync_sessions/open_tabs_ui_delegate.h"
#include "components/sync_sessions/session_store.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
const char kBaseSessionTag[] = …;
const char kBaseSessionName[] = …;
const char kBaseTabUrl[] = …;
const char kTabTitleFormat[] = …;
const uint64_t kMaxMinutesRange = …;
struct TitleTimestampPair { … };
bool SortTabTimesByRecency(const TitleTimestampPair& t1,
const TitleTimestampPair& t2) { … }
std::string ToSessionTag(SessionID session_id) { … }
std::string ToSessionName(SessionID session_id) { … }
std::string ToTabTitle(SessionID session_id,
SessionID window_id,
SessionID tab_id) { … }
std::string ToTabUrl(SessionID session_id,
SessionID window_id,
SessionID tab_id) { … }
}
struct RecentTabsBuilderTestHelper::TabInfo { … };
struct RecentTabsBuilderTestHelper::WindowInfo { … };
struct RecentTabsBuilderTestHelper::SessionInfo { … };
RecentTabsBuilderTestHelper::RecentTabsBuilderTestHelper() { … }
RecentTabsBuilderTestHelper::~RecentTabsBuilderTestHelper() { … }
void RecentTabsBuilderTestHelper::AddSession() { … }
int RecentTabsBuilderTestHelper::GetSessionCount() { … }
SessionID RecentTabsBuilderTestHelper::GetSessionID(int session_index) { … }
base::Time RecentTabsBuilderTestHelper::GetSessionTimestamp(int session_index) { … }
void RecentTabsBuilderTestHelper::AddWindow(int session_index) { … }
int RecentTabsBuilderTestHelper::GetWindowCount(int session_index) { … }
SessionID RecentTabsBuilderTestHelper::GetWindowID(int session_index,
int window_index) { … }
void RecentTabsBuilderTestHelper::AddTab(int session_index, int window_index) { … }
void RecentTabsBuilderTestHelper::AddTabWithInfo(int session_index,
int window_index,
base::Time timestamp,
const std::u16string& title) { … }
int RecentTabsBuilderTestHelper::GetTabCount(int session_index,
int window_index) { … }
SessionID RecentTabsBuilderTestHelper::GetTabID(int session_index,
int window_index,
int tab_index) { … }
base::Time RecentTabsBuilderTestHelper::GetTabTimestamp(int session_index,
int window_index,
int tab_index) { … }
std::u16string RecentTabsBuilderTestHelper::GetTabTitle(int session_index,
int window_index,
int tab_index) { … }
void RecentTabsBuilderTestHelper::ExportToSessionSync(
syncer::DataTypeProcessor* processor) { … }
void RecentTabsBuilderTestHelper::VerifyExport(
sync_sessions::OpenTabsUIDelegate* delegate) { … }
std::vector<std::u16string>
RecentTabsBuilderTestHelper::GetTabTitlesSortedByRecency() { … }
sync_pb::SessionSpecifics RecentTabsBuilderTestHelper::BuildHeaderSpecifics(
int session_index) { … }
void RecentTabsBuilderTestHelper::AddWindowToHeaderSpecifics(
int session_index,
int window_index,
sync_pb::SessionSpecifics* specifics) { … }
sync_pb::SessionSpecifics RecentTabsBuilderTestHelper::BuildTabSpecifics(
int session_index,
int window_index,
int tab_index) { … }
syncer::UpdateResponseData RecentTabsBuilderTestHelper::BuildUpdateResponseData(
const sync_pb::SessionSpecifics& specifics,
base::Time timestamp) { … }