#include "chrome/browser/diagnostics/diagnostics_model.h"
#include <algorithm>
#include <memory>
#include <vector>
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/diagnostics/diagnostics_test.h"
#include "chrome/browser/diagnostics/recon_diagnostics.h"
#include "chrome/browser/diagnostics/sqlite_diagnostics.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
namespace diagnostics {
#if BUILDFLAG(IS_WIN)
const int DiagnosticsModel::kDiagnosticsTestCount = 18;
#elif BUILDFLAG(IS_MAC)
const int DiagnosticsModel::kDiagnosticsTestCount = 15;
#elif BUILDFLAG(IS_POSIX)
#if BUILDFLAG(IS_CHROMEOS_ASH)
const int DiagnosticsModel::kDiagnosticsTestCount = 19;
#else
const int DiagnosticsModel::kDiagnosticsTestCount = …;
#endif
#endif
namespace {
class DiagnosticsModelImpl : public DiagnosticsModel { … };
#if BUILDFLAG(IS_WIN)
class DiagnosticsModelWin : public DiagnosticsModelImpl {
public:
DiagnosticsModelWin() {
tests_.push_back(MakeOperatingSystemTest());
tests_.push_back(MakeInstallTypeTest());
tests_.push_back(MakeVersionTest());
tests_.push_back(MakeUserDirTest());
tests_.push_back(MakeLocalStateFileTest());
tests_.push_back(MakeDictonaryDirTest());
tests_.push_back(MakeResourcesFileTest());
tests_.push_back(MakeDiskSpaceTest());
tests_.push_back(MakePreferencesTest());
tests_.push_back(MakeLocalStateTest());
tests_.push_back(MakeLocalOrSyncableBookmarksTest());
tests_.push_back(MakeAccountBookmarksTest());
tests_.push_back(MakeSqliteWebDataDbTest());
tests_.push_back(MakeSqliteCookiesDbTest());
tests_.push_back(MakeSqliteFaviconsDbTest());
tests_.push_back(MakeSqliteHistoryDbTest());
tests_.push_back(MakeSqliteTopSitesDbTest());
tests_.push_back(MakeSqliteWebDatabaseTrackerDbTest());
}
DiagnosticsModelWin(const DiagnosticsModelWin&) = delete;
DiagnosticsModelWin& operator=(const DiagnosticsModelWin&) = delete;
};
#elif BUILDFLAG(IS_MAC)
class DiagnosticsModelMac : public DiagnosticsModelImpl {
public:
DiagnosticsModelMac() {
tests_.push_back(MakeInstallTypeTest());
tests_.push_back(MakeUserDirTest());
tests_.push_back(MakeLocalStateFileTest());
tests_.push_back(MakeDictonaryDirTest());
tests_.push_back(MakeDiskSpaceTest());
tests_.push_back(MakePreferencesTest());
tests_.push_back(MakeLocalStateTest());
tests_.push_back(MakeLocalOrSyncableBookmarksTest());
tests_.push_back(MakeAccountBookmarksTest());
tests_.push_back(MakeSqliteWebDataDbTest());
tests_.push_back(MakeSqliteCookiesDbTest());
tests_.push_back(MakeSqliteFaviconsDbTest());
tests_.push_back(MakeSqliteHistoryDbTest());
tests_.push_back(MakeSqliteTopSitesDbTest());
tests_.push_back(MakeSqliteWebDatabaseTrackerDbTest());
}
DiagnosticsModelMac(const DiagnosticsModelMac&) = delete;
DiagnosticsModelMac& operator=(const DiagnosticsModelMac&) = delete;
};
#elif BUILDFLAG(IS_POSIX)
class DiagnosticsModelPosix : public DiagnosticsModelImpl { … };
#endif
}
DiagnosticsModel* MakeDiagnosticsModel(const base::CommandLine& cmdline) { … }
}