#include "components/visited_url_ranking/internal/session_url_visit_data_fetcher.h"
#include <memory>
#include <vector>
#include "base/callback_list.h"
#include "base/functional/callback.h"
#include "base/test/mock_callback.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "components/sync_sessions/open_tabs_ui_delegate.h"
#include "components/sync_sessions/session_sync_service.h"
#include "components/visited_url_ranking/public/fetch_options.h"
#include "components/visited_url_ranking/public/fetcher_config.h"
#include "components/visited_url_ranking/public/url_visit.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
constexpr char kSampleSearchUrl[] = …;
constexpr char kSampleSearchUrl2[] = …;
std::unique_ptr<sync_sessions::SyncedSession> BuildSampleSession(
const char* session_name,
std::vector<std::unique_ptr<sync_sessions::SyncedSessionWindow>>
session_windows,
base::Time modified_time = base::Time::Now()) { … }
std::unique_ptr<sync_sessions::SyncedSessionWindow> SampleSessionWindow(
std::vector<std::unique_ptr<sessions::SessionTab>> tabs,
base::Time time = base::Time::Now()) { … }
std::unique_ptr<sessions::SessionTab> SampleSessionTab(
int tab_id,
std::u16string title,
GURL url,
bool pinned,
base::Time timestamp = base::Time::Now()) { … }
std::unique_ptr<sync_sessions::SyncedSession> GetSampleSession() { … }
}
namespace sync_sessions {
class MockOpenTabsUIDelegate : public OpenTabsUIDelegate { … };
class MockSessionSyncService : public SessionSyncService { … };
}
namespace visited_url_ranking {
Source;
URLType;
ResultOption;
class SessionURLVisitDataFetcherTest
: public testing::Test,
public ::testing::WithParamInterface<Source> { … };
TEST_F(SessionURLVisitDataFetcherTest, FetchURLVisitDataNoOpenTabsUIDelegate) { … }
TEST_F(SessionURLVisitDataFetcherTest, FetchURLVisitDataDefaultSources) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(SessionURLVisitDataFetcherTest, FetchURLVisitData) { … }
}