[core] Make it possible to reopen the database read-only for testing

Needed for Android, because the database is in readonly filesystem
and also because it is annoying to see files modified every time we
run the tests.
This commit is contained in:
Thiago Marcos P. Santos
2020-01-04 02:10:21 +02:00
parent f306957a6d
commit d08bb49c34
5 changed files with 120 additions and 38 deletions

View File

@@ -66,8 +66,14 @@ std::unique_ptr<AsyncRequest> ProxyFileSource::request(const Resource& resource,
std::shared_ptr<FileSource> FileSource::createPlatformFileSource(const ResourceOptions& options) {
auto fileSource = std::make_shared<ProxyFileSource>(options.cachePath(), options.assetPath());
fileSource->setAccessToken(options.accessToken());
fileSource->setAPIBaseURL(options.baseURL());
if (offline) {
fileSource->reopenDatabaseReadOnlyForTesting();
}
return fileSource;
}