#include <algorithm>
#include <string>
#include <vector>
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/strings/stringprintf.h"
#include "base/test/scoped_run_loop_timeout.h"
#include "base/test/test_file_util.h"
#include "base/timer/elapsed_timer.h"
#include "build/build_config.h"
#include "components/visitedlink/browser/visitedlink_writer.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/perf/perf_result_reporter.h"
#include "url/gurl.h"
namespace visitedlink {
namespace {
static constexpr char kMetricAddAndQueryMs[] = …;
static constexpr char kMetricTableInitMs[] = …;
static constexpr char kMetricLinkInitMs[] = …;
static constexpr char kMetricDatabaseFlushMs[] = …;
static constexpr char kMetricColdLoadTimeMs[] = …;
static constexpr char kMetricHotLoadTimeMs[] = …;
static constexpr char kMetricAddURLTimeMs[] = …;
static constexpr char kMetricAddURLsTimeMs[] = …;
perf_test::PerfResultReporter SetUpReporter(const std::string& metric_suffix) { … }
class TimeLogger { … };
TimeLogger::TimeLogger(std::string metric_suffix)
: … { … }
TimeLogger::~TimeLogger() { … }
void TimeLogger::Done() { … }
const int kAddCount = …;
const int kLoadTestInitialCount = …;
const char kAddedPrefix[] = …;
const char kUnaddedPrefix[] = …;
GURL TestURL(const char* prefix, int i) { … }
class DummyVisitedLinkEventListener : public VisitedLinkWriter::Listener { … };
void CheckVisited(VisitedLinkWriter& writer,
const char* prefix,
int begin,
int end) { … }
void FillTable(VisitedLinkWriter& writer,
const char* prefix,
int begin,
int end,
int batch_size = 1) { … }
class VisitedLinkPerfTest : public testing::Test { … };
}
TEST_F(VisitedLinkPerfTest, TestAddAndQuery) { … }
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_ANDROID)
#define MAYBE_TestBigTable …
#else
#define MAYBE_TestBigTable …
#endif
TEST_F(VisitedLinkPerfTest, MAYBE_TestBigTable) { … }
}