#include "chrome/browser/error_reporting/mock_chrome_js_error_report_processor.h"
#include "base/base_paths.h"
#include "base/check.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/strings/strcat.h"
#include "base/time/time.h"
#include "components/crash/content/browser/error_reporting/javascript_error_report.h"
#include "components/crash/content/browser/error_reporting/mock_crash_endpoint.h"
#include "components/variations/variations_crash_keys.h"
const char MockChromeJsErrorReportProcessor::
kDefaultExperimentListStringPreEscaping[] = …;
const char MockChromeJsErrorReportProcessor::kDefaultExperimentListString[] = …;
MockChromeJsErrorReportProcessor::MockChromeJsErrorReportProcessor() { … }
MockChromeJsErrorReportProcessor::~MockChromeJsErrorReportProcessor() = default;
void MockChromeJsErrorReportProcessor::SendErrorReport(
JavaScriptErrorReport error_report,
base::OnceClosure completion_callback,
content::BrowserContext* browser_context) { … }
void MockChromeJsErrorReportProcessor::SetAsDefault() { … }
void MockChromeJsErrorReportProcessor::SetDefaultTo(
scoped_refptr<JsErrorReportProcessor> new_default) { … }
void MockChromeJsErrorReportProcessor::SetCrashEndpoint(
std::string crash_endpoint) { … }
void MockChromeJsErrorReportProcessor::SetCrashEndpointStaging(
std::string crash_endpoint) { … }
variations::ExperimentListInfo
MockChromeJsErrorReportProcessor::GetExperimentListInfo() const { … }
#if BUILDFLAG(IS_CHROMEOS)
std::vector<std::string>
MockChromeJsErrorReportProcessor::GetCrashReporterArgvStart() {
base::FilePath mock_crash_reporter_path;
CHECK(base::PathService::Get(base::DIR_EXE, &mock_crash_reporter_path));
mock_crash_reporter_path =
mock_crash_reporter_path.Append("mock_chromeos_crash_reporter");
return {mock_crash_reporter_path.value(),
base::StrCat({"--upload_to=", crash_endpoint_})};
}
#else
std::string MockChromeJsErrorReportProcessor::GetOsVersion() { … }
std::string MockChromeJsErrorReportProcessor::GetCrashEndpoint() { … }
std::string MockChromeJsErrorReportProcessor::GetCrashEndpointStaging() { … }
void MockChromeJsErrorReportProcessor::UpdateReportDatabase(
std::string remote_report_id,
base::Time report_time) { … }
#endif
ScopedMockChromeJsErrorReportProcessor::ScopedMockChromeJsErrorReportProcessor(
const MockCrashEndpoint& endpoint)
: … { … }
ScopedMockChromeJsErrorReportProcessor::
~ScopedMockChromeJsErrorReportProcessor() { … }