diff --git a/cobalt/h5vcc/h5vcc_storage.cc b/cobalt/h5vcc/h5vcc_storage.cc index 9b6c095b8845..fb6ba6e9b739 100644 --- a/cobalt/h5vcc/h5vcc_storage.cc +++ b/cobalt/h5vcc/h5vcc_storage.cc @@ -38,6 +38,8 @@ namespace h5vcc { namespace { +const char kCrashpadDBName[] = "crashpad_database"; + const char kTestFileName[] = "cache_test_file.json"; const uint32 kBufferSize = 16384; // 16 KB @@ -429,6 +431,15 @@ void H5vccStorage::ClearServiceWorkerCache() { base::DeleteFile(service_worker_file_path); } +void H5vccStorage::ClearCrashpadDatabase() { + std::vector cache_dir(kSbFileMaxPath + 1, 0); + SbSystemGetPath(kSbSystemPathCacheDirectory, cache_dir.data(), + kSbFileMaxPath); + base::FilePath crashpad_db_dir = + base::FilePath(cache_dir.data()).Append(kCrashpadDBName); + ClearDirectory(crashpad_db_dir); +} + bool H5vccStorage::ValidatedCacheBackend() { if (!http_cache_) { return false; diff --git a/cobalt/h5vcc/h5vcc_storage.h b/cobalt/h5vcc/h5vcc_storage.h index ae1569e86709..36622442504d 100644 --- a/cobalt/h5vcc/h5vcc_storage.h +++ b/cobalt/h5vcc/h5vcc_storage.h @@ -71,6 +71,8 @@ class H5vccStorage : public script::Wrappable { void ClearServiceWorkerCache(); + void ClearCrashpadDatabase(); + DEFINE_WRAPPABLE_TYPE(H5vccStorage); private: diff --git a/cobalt/h5vcc/h5vcc_storage.idl b/cobalt/h5vcc/h5vcc_storage.idl index 9d4b1aadad24..0815bd8f0b51 100644 --- a/cobalt/h5vcc/h5vcc_storage.idl +++ b/cobalt/h5vcc/h5vcc_storage.idl @@ -31,4 +31,7 @@ interface H5vccStorage { void clearCache(); void clearCacheOfType(octet type_index); void clearServiceWorkerCache(); + + // Only intended to be used by tests + void clearCrashpadDatabase(); };