chromium/chrome/browser/diagnostics/sqlite_diagnostics.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/diagnostics/sqlite_diagnostics.h"

#include <stdint.h>

#include "base/base_paths.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/memory/singleton.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "components/history/core/browser/history_constants.h"
#include "components/webdata/common/webdata_constants.h"
#include "content/public/common/content_constants.h"
#include "sql/database.h"
#include "sql/sqlite_result_code_values.h"
#include "sql/statement.h"
#include "storage/browser/database/database_tracker.h"

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/constants/ash_constants.h"
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

namespace diagnostics {

namespace {

// Generic diagnostic test class for checking SQLite database integrity.
class SqliteIntegrityTest : public DiagnosticsTest {};

}  // namespace

std::unique_ptr<DiagnosticsTest> MakeSqliteCookiesDbTest() {}

std::unique_ptr<DiagnosticsTest> MakeSqliteWebDatabaseTrackerDbTest() {}

std::unique_ptr<DiagnosticsTest> MakeSqliteHistoryDbTest() {}

#if BUILDFLAG(IS_CHROMEOS_ASH)
std::unique_ptr<DiagnosticsTest> MakeSqliteNssCertDbTest() {
  base::FilePath home_dir;
  base::PathService::Get(base::DIR_HOME, &home_dir);
  return std::make_unique<SqliteIntegrityTest>(
      SqliteIntegrityTest::REMOVE_IF_CORRUPT,
      DIAGNOSTICS_SQLITE_INTEGRITY_NSS_CERT_TEST,
      home_dir.Append(ash::kNssCertDbPath));
}

std::unique_ptr<DiagnosticsTest> MakeSqliteNssKeyDbTest() {
  base::FilePath home_dir;
  base::PathService::Get(base::DIR_HOME, &home_dir);
  return std::make_unique<SqliteIntegrityTest>(
      SqliteIntegrityTest::REMOVE_IF_CORRUPT,
      DIAGNOSTICS_SQLITE_INTEGRITY_NSS_KEY_TEST,
      home_dir.Append(ash::kNssKeyDbPath));
}
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

std::unique_ptr<DiagnosticsTest> MakeSqliteFaviconsDbTest() {}

std::unique_ptr<DiagnosticsTest> MakeSqliteTopSitesDbTest() {}

std::unique_ptr<DiagnosticsTest> MakeSqliteWebDataDbTest() {}

}  // namespace diagnostics