[core] Moving caching logic to DefaultFileSource

This results in OnlineFileSource containing precisely the logic we want for reuse by OfflineFileSource, and no more.
This commit is contained in:
John Firebaugh
2016-01-13 17:10:13 -08:00
parent f3d4107d19
commit dbb8e58aea
22 changed files with 128 additions and 136 deletions

View File

@@ -1,7 +1,6 @@
#include "storage.hpp"
#include <mbgl/storage/online_file_source.hpp>
#include <mbgl/storage/sqlite_cache.hpp>
#include <mbgl/storage/default_file_source.hpp>
#include <mbgl/util/chrono.hpp>
#include <mbgl/util/run_loop.hpp>
@@ -11,8 +10,7 @@ TEST_F(Storage, CacheRevalidateSame) {
using namespace mbgl;
util::RunLoop loop;
SQLiteCache cache(":memory:");
OnlineFileSource fs(&cache);
DefaultFileSource fs(":memory:", ".");
const Resource revalidateSame { Resource::Unknown, "http://127.0.0.1:3000/revalidate-same" };
std::unique_ptr<FileRequest> req1;
@@ -61,8 +59,7 @@ TEST_F(Storage, CacheRevalidateModified) {
using namespace mbgl;
util::RunLoop loop;
SQLiteCache cache(":memory:");
OnlineFileSource fs(&cache);
DefaultFileSource fs(":memory:", ".");
const Resource revalidateModified{ Resource::Unknown,
"http://127.0.0.1:3000/revalidate-modified" };
@@ -111,8 +108,7 @@ TEST_F(Storage, CacheRevalidateEtag) {
using namespace mbgl;
util::RunLoop loop;
SQLiteCache cache(":memory:");
OnlineFileSource fs(&cache);
DefaultFileSource fs(":memory:", ".");
const Resource revalidateEtag { Resource::Unknown, "http://127.0.0.1:3000/revalidate-etag" };
std::unique_ptr<FileRequest> req1;