diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2015-12-23 14:55:12 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2015-12-23 14:55:12 -0800 |
commit | 7a6076ea9df72f34565d8f316f8c5c19279677b8 (patch) | |
tree | 0018a698e9fa97273c5b515b71ccf0b8f7398253 /test/storage | |
parent | d238e00d9b1e78e98392ac2cab30f8a2fcd3c1fd (diff) | |
download | qtlocation-mapboxgl-7a6076ea9df72f34565d8f316f8c5c19279677b8.tar.gz |
[tests] Test with OnlineFileSource
When we introduce OfflineFileSource, the behavior of existing tests should
not change.
Diffstat (limited to 'test/storage')
-rw-r--r-- | test/storage/cache_response.cpp | 4 | ||||
-rw-r--r-- | test/storage/cache_revalidate.cpp | 8 | ||||
-rw-r--r-- | test/storage/directory_reading.cpp | 6 | ||||
-rw-r--r-- | test/storage/file_reading.cpp | 14 | ||||
-rw-r--r-- | test/storage/http_cancel.cpp | 6 | ||||
-rw-r--r-- | test/storage/http_coalescing.cpp | 8 | ||||
-rw-r--r-- | test/storage/http_error.cpp | 6 | ||||
-rw-r--r-- | test/storage/http_header_parsing.cpp | 6 | ||||
-rw-r--r-- | test/storage/http_issue_1369.cpp | 4 | ||||
-rw-r--r-- | test/storage/http_load.cpp | 4 | ||||
-rw-r--r-- | test/storage/http_other_loop.cpp | 4 | ||||
-rw-r--r-- | test/storage/http_reading.cpp | 10 | ||||
-rw-r--r-- | test/storage/http_retry_network_status.cpp | 6 | ||||
-rw-r--r-- | test/storage/http_timeout.cpp | 4 |
14 files changed, 45 insertions, 45 deletions
diff --git a/test/storage/cache_response.cpp b/test/storage/cache_response.cpp index 8207460aa4..16a9c3d47a 100644 --- a/test/storage/cache_response.cpp +++ b/test/storage/cache_response.cpp @@ -1,6 +1,6 @@ #include "storage.hpp" -#include <mbgl/storage/default_file_source.hpp> +#include <mbgl/storage/online_file_source.hpp> #include <mbgl/storage/sqlite_cache.hpp> #include <mbgl/util/chrono.hpp> #include <mbgl/util/run_loop.hpp> @@ -12,7 +12,7 @@ TEST_F(Storage, CacheResponse) { util::RunLoop loop; SQLiteCache cache(":memory:"); - DefaultFileSource fs(&cache); + OnlineFileSource fs(&cache); const Resource resource { Resource::Unknown, "http://127.0.0.1:3000/cache" }; Response response; diff --git a/test/storage/cache_revalidate.cpp b/test/storage/cache_revalidate.cpp index ab7fcd5d24..e0e0672ad5 100644 --- a/test/storage/cache_revalidate.cpp +++ b/test/storage/cache_revalidate.cpp @@ -1,6 +1,6 @@ #include "storage.hpp" -#include <mbgl/storage/default_file_source.hpp> +#include <mbgl/storage/online_file_source.hpp> #include <mbgl/storage/sqlite_cache.hpp> #include <mbgl/util/chrono.hpp> #include <mbgl/util/run_loop.hpp> @@ -12,7 +12,7 @@ TEST_F(Storage, CacheRevalidateSame) { util::RunLoop loop; SQLiteCache cache(":memory:"); - DefaultFileSource fs(&cache); + OnlineFileSource fs(&cache); const Resource revalidateSame { Resource::Unknown, "http://127.0.0.1:3000/revalidate-same" }; std::unique_ptr<FileRequest> req1; @@ -72,7 +72,7 @@ TEST_F(Storage, CacheRevalidateModified) { util::RunLoop loop; SQLiteCache cache(":memory:"); - DefaultFileSource fs(&cache); + OnlineFileSource fs(&cache); const Resource revalidateModified{ Resource::Unknown, "http://127.0.0.1:3000/revalidate-modified" }; @@ -132,7 +132,7 @@ TEST_F(Storage, CacheRevalidateEtag) { util::RunLoop loop; SQLiteCache cache(":memory:"); - DefaultFileSource fs(&cache); + OnlineFileSource fs(&cache); const Resource revalidateEtag { Resource::Unknown, "http://127.0.0.1:3000/revalidate-etag" }; std::unique_ptr<FileRequest> req1; diff --git a/test/storage/directory_reading.cpp b/test/storage/directory_reading.cpp index 5ef2983abf..2e6b90f0d3 100644 --- a/test/storage/directory_reading.cpp +++ b/test/storage/directory_reading.cpp @@ -1,6 +1,6 @@ #include "storage.hpp" -#include <mbgl/storage/default_file_source.hpp> +#include <mbgl/storage/online_file_source.hpp> #include <mbgl/util/chrono.hpp> #include <mbgl/util/run_loop.hpp> @@ -12,9 +12,9 @@ TEST_F(Storage, AssetReadDirectory) { util::RunLoop loop; #ifdef MBGL_ASSET_ZIP - DefaultFileSource fs(nullptr, "test/fixtures/storage/assets.zip"); + OnlineFileSource fs(nullptr, "test/fixtures/storage/assets.zip"); #else - DefaultFileSource fs(nullptr); + OnlineFileSource fs(nullptr); #endif std::unique_ptr<FileRequest> req = fs.request({ Resource::Unknown, "asset://TEST_DATA/fixtures/storage" }, [&](Response res) { diff --git a/test/storage/file_reading.cpp b/test/storage/file_reading.cpp index 7565ad3d66..757decb612 100644 --- a/test/storage/file_reading.cpp +++ b/test/storage/file_reading.cpp @@ -1,6 +1,6 @@ #include "storage.hpp" -#include <mbgl/storage/default_file_source.hpp> +#include <mbgl/storage/online_file_source.hpp> #include <mbgl/platform/platform.hpp> #include <mbgl/util/chrono.hpp> #include <mbgl/util/run_loop.hpp> @@ -18,7 +18,7 @@ std::string getFileSourceRoot() { class TestWorker { public: - TestWorker(mbgl::DefaultFileSource* fs_) : fs(fs_) {} + TestWorker(mbgl::OnlineFileSource* fs_) : fs(fs_) {} void run(std::function<void()> endCallback) { const std::string asset("asset://TEST_DATA/fixtures/storage/nonempty"); @@ -46,7 +46,7 @@ public: private: unsigned numRequests = 1000; - mbgl::DefaultFileSource* fs; + mbgl::OnlineFileSource* fs; std::unique_ptr<mbgl::FileRequest> request; std::function<void(mbgl::Response)> requestCallback; @@ -61,7 +61,7 @@ TEST_F(Storage, AssetStress) { util::RunLoop loop; - mbgl::DefaultFileSource fs(nullptr, getFileSourceRoot()); + mbgl::OnlineFileSource fs(nullptr, getFileSourceRoot()); unsigned numThreads = 50; @@ -97,7 +97,7 @@ TEST_F(Storage, AssetEmptyFile) { util::RunLoop loop; - DefaultFileSource fs(nullptr, getFileSourceRoot()); + OnlineFileSource fs(nullptr, getFileSourceRoot()); std::unique_ptr<FileRequest> req = fs.request({ Resource::Unknown, "asset://TEST_DATA/fixtures/storage/empty" }, [&](Response res) { req.reset(); @@ -122,7 +122,7 @@ TEST_F(Storage, AssetNonEmptyFile) { util::RunLoop loop; - DefaultFileSource fs(nullptr, getFileSourceRoot()); + OnlineFileSource fs(nullptr, getFileSourceRoot()); std::unique_ptr<FileRequest> req = fs.request({ Resource::Unknown, "asset://TEST_DATA/fixtures/storage/nonempty" }, [&](Response res) { req.reset(); @@ -149,7 +149,7 @@ TEST_F(Storage, AssetNonExistentFile) { util::RunLoop loop; - DefaultFileSource fs(nullptr, getFileSourceRoot()); + OnlineFileSource fs(nullptr, getFileSourceRoot()); std::unique_ptr<FileRequest> req = fs.request({ Resource::Unknown, "asset://TEST_DATA/fixtures/storage/does_not_exist" }, [&](Response res) { req.reset(); diff --git a/test/storage/http_cancel.cpp b/test/storage/http_cancel.cpp index 442a159fe5..a20e78fa53 100644 --- a/test/storage/http_cancel.cpp +++ b/test/storage/http_cancel.cpp @@ -1,6 +1,6 @@ #include "storage.hpp" -#include <mbgl/storage/default_file_source.hpp> +#include <mbgl/storage/online_file_source.hpp> #include <mbgl/storage/network_status.hpp> #include <mbgl/util/chrono.hpp> #include <mbgl/util/run_loop.hpp> @@ -13,7 +13,7 @@ TEST_F(Storage, HTTPCancel) { using namespace mbgl; util::RunLoop loop; - DefaultFileSource fs(nullptr); + OnlineFileSource fs(nullptr); auto req = fs.request({ Resource::Unknown, "http://127.0.0.1:3000/test" }, @@ -31,7 +31,7 @@ TEST_F(Storage, HTTPCancelMultiple) { using namespace mbgl; util::RunLoop loop; - DefaultFileSource fs(nullptr); + OnlineFileSource fs(nullptr); const Resource resource { Resource::Unknown, "http://127.0.0.1:3000/test" }; diff --git a/test/storage/http_coalescing.cpp b/test/storage/http_coalescing.cpp index a9edf00839..dc4d993b35 100644 --- a/test/storage/http_coalescing.cpp +++ b/test/storage/http_coalescing.cpp @@ -1,6 +1,6 @@ #include "storage.hpp" -#include <mbgl/storage/default_file_source.hpp> +#include <mbgl/storage/online_file_source.hpp> #include <mbgl/util/chrono.hpp> #include <mbgl/util/run_loop.hpp> @@ -13,7 +13,7 @@ TEST_F(Storage, HTTPCoalescing) { using namespace mbgl; util::RunLoop loop; - DefaultFileSource fs(nullptr); + OnlineFileSource fs(nullptr); static const Response *reference = nullptr; @@ -59,7 +59,7 @@ TEST_F(Storage, HTTPMultiple) { using namespace mbgl; util::RunLoop loop; - DefaultFileSource fs(nullptr); + OnlineFileSource fs(nullptr); const Resource resource { Resource::Unknown, "http://127.0.0.1:3000/test?expires=2147483647" }; std::unique_ptr<FileRequest> req1; @@ -104,7 +104,7 @@ TEST_F(Storage, HTTPStale) { using namespace mbgl; util::RunLoop loop; - DefaultFileSource fs(nullptr); + OnlineFileSource fs(nullptr); int updates = 0; int stale = 0; diff --git a/test/storage/http_error.cpp b/test/storage/http_error.cpp index 1889d85e00..3ed7638d48 100644 --- a/test/storage/http_error.cpp +++ b/test/storage/http_error.cpp @@ -1,6 +1,6 @@ #include "storage.hpp" -#include <mbgl/storage/default_file_source.hpp> +#include <mbgl/storage/online_file_source.hpp> #include <mbgl/storage/network_status.hpp> #include <mbgl/util/chrono.hpp> #include <mbgl/util/run_loop.hpp> @@ -13,7 +13,7 @@ TEST_F(Storage, HTTPTemporaryError) { using namespace mbgl; util::RunLoop loop; - DefaultFileSource fs(nullptr); + OnlineFileSource fs(nullptr); const auto start = Clock::now(); @@ -60,7 +60,7 @@ TEST_F(Storage, HTTPConnectionError) { using namespace mbgl; util::RunLoop loop; - DefaultFileSource fs(nullptr); + OnlineFileSource fs(nullptr); const auto start = Clock::now(); diff --git a/test/storage/http_header_parsing.cpp b/test/storage/http_header_parsing.cpp index 9f48e995b5..72c42e8f0a 100644 --- a/test/storage/http_header_parsing.cpp +++ b/test/storage/http_header_parsing.cpp @@ -1,6 +1,6 @@ #include "storage.hpp" -#include <mbgl/storage/default_file_source.hpp> +#include <mbgl/storage/online_file_source.hpp> #include <mbgl/util/chrono.hpp> #include <mbgl/util/run_loop.hpp> @@ -12,7 +12,7 @@ TEST_F(Storage, HTTPExpiresParsing) { using namespace mbgl; util::RunLoop loop; - DefaultFileSource fs(nullptr); + OnlineFileSource fs(nullptr); std::unique_ptr<FileRequest> req1 = fs.request({ Resource::Unknown, "http://127.0.0.1:3000/test?modified=1420794326&expires=1420797926&etag=foo" }, @@ -38,7 +38,7 @@ TEST_F(Storage, HTTPCacheControlParsing) { using namespace mbgl; util::RunLoop loop; - DefaultFileSource fs(nullptr); + OnlineFileSource fs(nullptr); const Seconds now = toSeconds(SystemClock::now()); diff --git a/test/storage/http_issue_1369.cpp b/test/storage/http_issue_1369.cpp index fff773de88..81cf964e7c 100644 --- a/test/storage/http_issue_1369.cpp +++ b/test/storage/http_issue_1369.cpp @@ -1,6 +1,6 @@ #include "storage.hpp" -#include <mbgl/storage/default_file_source.hpp> +#include <mbgl/storage/online_file_source.hpp> #include <mbgl/storage/sqlite_cache.hpp> #include <mbgl/util/chrono.hpp> #include <mbgl/util/run_loop.hpp> @@ -23,7 +23,7 @@ TEST_F(Storage, HTTPIssue1369) { util::RunLoop loop; SQLiteCache cache; - DefaultFileSource fs(&cache); + OnlineFileSource fs(&cache); const Resource resource { Resource::Unknown, "http://127.0.0.1:3000/test" }; diff --git a/test/storage/http_load.cpp b/test/storage/http_load.cpp index 947b850db6..9b37cbd231 100644 --- a/test/storage/http_load.cpp +++ b/test/storage/http_load.cpp @@ -1,6 +1,6 @@ #include "storage.hpp" -#include <mbgl/storage/default_file_source.hpp> +#include <mbgl/storage/online_file_source.hpp> #include <mbgl/util/chrono.hpp> #include <mbgl/util/run_loop.hpp> @@ -10,7 +10,7 @@ TEST_F(Storage, HTTPLoad) { using namespace mbgl; util::RunLoop loop; - DefaultFileSource fs(nullptr); + OnlineFileSource fs(nullptr); const int concurrency = 50; const int max = 10000; diff --git a/test/storage/http_other_loop.cpp b/test/storage/http_other_loop.cpp index d9c90397ad..9d98f1878b 100644 --- a/test/storage/http_other_loop.cpp +++ b/test/storage/http_other_loop.cpp @@ -1,6 +1,6 @@ #include "storage.hpp" -#include <mbgl/storage/default_file_source.hpp> +#include <mbgl/storage/online_file_source.hpp> #include <mbgl/util/chrono.hpp> #include <mbgl/util/run_loop.hpp> @@ -11,7 +11,7 @@ TEST_F(Storage, HTTPOtherLoop) { // This file source launches a separate thread to do the processing. util::RunLoop loop; - DefaultFileSource fs(nullptr); + OnlineFileSource fs(nullptr); std::unique_ptr<FileRequest> req = fs.request({ Resource::Unknown, "http://127.0.0.1:3000/test" }, [&](Response res) { diff --git a/test/storage/http_reading.cpp b/test/storage/http_reading.cpp index 3d7f9926e1..a4a7d0480d 100644 --- a/test/storage/http_reading.cpp +++ b/test/storage/http_reading.cpp @@ -1,6 +1,6 @@ #include "storage.hpp" -#include <mbgl/storage/default_file_source.hpp> +#include <mbgl/storage/online_file_source.hpp> #include <mbgl/util/exception.hpp> #include <mbgl/util/chrono.hpp> #include <mbgl/util/run_loop.hpp> @@ -14,7 +14,7 @@ TEST_F(Storage, HTTPTest) { using namespace mbgl; util::RunLoop loop; - DefaultFileSource fs(nullptr); + OnlineFileSource fs(nullptr); std::unique_ptr<FileRequest> req1 = fs.request({ Resource::Unknown, "http://127.0.0.1:3000/test" }, [&](Response res) { @@ -40,7 +40,7 @@ TEST_F(Storage, HTTP404) { using namespace mbgl; util::RunLoop loop; - DefaultFileSource fs(nullptr); + OnlineFileSource fs(nullptr); std::unique_ptr<FileRequest> req2 = fs.request({ Resource::Unknown, "http://127.0.0.1:3000/doesnotexist" }, [&](Response res) { @@ -68,7 +68,7 @@ TEST_F(Storage, HTTP500) { using namespace mbgl; util::RunLoop loop; - DefaultFileSource fs(nullptr); + OnlineFileSource fs(nullptr); std::unique_ptr<FileRequest> req3 = fs.request({ Resource::Unknown, "http://127.0.0.1:3000/permanent-error" }, [&](Response res) { @@ -96,7 +96,7 @@ TEST_F(Storage, HTTPNoCallback) { using namespace mbgl; util::RunLoop loop; - DefaultFileSource fs(nullptr); + OnlineFileSource fs(nullptr); try { fs.request({ Resource::Unknown, "http://127.0.0.1:3000/test" }, diff --git a/test/storage/http_retry_network_status.cpp b/test/storage/http_retry_network_status.cpp index 41cbed3431..7816fab01d 100644 --- a/test/storage/http_retry_network_status.cpp +++ b/test/storage/http_retry_network_status.cpp @@ -1,6 +1,6 @@ #include "storage.hpp" -#include <mbgl/storage/default_file_source.hpp> +#include <mbgl/storage/online_file_source.hpp> #include <mbgl/storage/network_status.hpp> #include <mbgl/util/chrono.hpp> #include <mbgl/util/run_loop.hpp> @@ -18,7 +18,7 @@ TEST_F(Storage, HTTPNetworkStatusChange) { using namespace mbgl; util::RunLoop loop; - DefaultFileSource fs(nullptr); + OnlineFileSource fs(nullptr); const Resource resource { Resource::Unknown, "http://127.0.0.1:3000/delayed" }; @@ -58,7 +58,7 @@ TEST_F(Storage, HTTPNetworkStatusChangePreempt) { using namespace mbgl; util::RunLoop loop; - DefaultFileSource fs(nullptr); + OnlineFileSource fs(nullptr); const auto start = Clock::now(); diff --git a/test/storage/http_timeout.cpp b/test/storage/http_timeout.cpp index 26ce0f5c3a..241d5f5549 100644 --- a/test/storage/http_timeout.cpp +++ b/test/storage/http_timeout.cpp @@ -1,6 +1,6 @@ #include "storage.hpp" -#include <mbgl/storage/default_file_source.hpp> +#include <mbgl/storage/online_file_source.hpp> #include <mbgl/storage/network_status.hpp> #include <mbgl/util/chrono.hpp> #include <mbgl/util/run_loop.hpp> @@ -11,7 +11,7 @@ TEST_F(Storage, HTTPTimeout) { using namespace mbgl; util::RunLoop loop; - DefaultFileSource fs(nullptr); + OnlineFileSource fs(nullptr); int counter = 0; |