#include "content/browser/attribution_reporting/sql_query_plan_test_util.h"
#include <optional>
#include <ostream>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "base/check.h"
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/process/launch.h"
#include "base/process/process.h"
#include "base/ranges/algorithm.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "base/types/expected.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace content {
namespace {
base::FilePath GetExecPath(std::string_view name) { … }
class SqlIndexMatcher { … };
bool SqlIndexMatcher::MatchAndExplain(const SqlQueryPlan& plan,
std::ostream*) const { … }
size_t SqlIndexMatcher::FindIndexStart(std::string_view plan) const { … }
void SqlIndexMatcher::DescribeTo(std::ostream* out, bool negated) const { … }
bool HasFullTableScan(const SqlQueryPlan& plan) { … }
}
testing::Matcher<SqlQueryPlan> UsesIndex(std::string name,
std::vector<std::string> columns) { … }
testing::Matcher<SqlQueryPlan> UsesCoveringIndex(
std::string name,
std::vector<std::string> columns) { … }
testing::Matcher<SqlQueryPlan> UsesPrimaryKey() { … }
std::ostream& operator<<(std::ostream& out, const SqlQueryPlan& plan) { … }
SqlQueryPlanExplainer::SqlQueryPlanExplainer(base::FilePath db_path)
: … { … }
SqlQueryPlanExplainer::~SqlQueryPlanExplainer() = default;
base::expected<SqlQueryPlan, SqlQueryPlanExplainer::Error>
SqlQueryPlanExplainer::GetPlan(
std::string query,
std::optional<SqlFullScanReason> full_scan_reason) { … }
std::ostream& operator<<(std::ostream& out,
SqlQueryPlanExplainer::Error error) { … }
}